Transcription of SystemVerilog Versus OpenVera - EDA Direct
1 APPLICATION NOTES ystemVerilog Versus OpenVeraStephen BaileyMentor GraphicsVersion , 28 June inspiration for many of the new language capabilities in SystemVerilog has come from proprietary hardware verification languages (HVL) such as Vera and e, especially the , it is understandable that people may be prone to assume that the assertion and verifi-cation capabilities in SystemVerilog are identical to those of OpenVera . Although there are manysimilarities, the two languages are different. If they were identical, it would be possible to suc-cessfully compile and simulate Vera source code in any simulator that supports course, this is not true, and anyone who believes otherwise will be unpleasantly SystemVerilog differs from OpenVera is the topic of this Assertions Versus OpenVera AssertionsUnless otherwise indicated, in this paper, the terms assertionand assertionsrefer to all directives(assert, assume, and cover).
2 AssertionsInline SpecificationSystemVerilog assertions (SVA) can be placed inline (concurrently or procedurally), or they maybe organized with or within interfaces, modules and, to a limited extent, packages. OpenVeraAssertions (OVA) do not support inline specification of must be packaged inunits (as discussed below). In effect, SystemVerilog supports specification of assertions both inline and in separate only supports the specification of assertions in a separate source SystemVerilog , assertions are defined within module or generate regions as a concurrentstatement.
3 That is, they are located within OVA, the cover directives are located in OVAunits. An OVAunit looks like a Verilog moduleexcept the module/endmodule keywords are replaced by the unit/endunit keywords and the portdeclarations use the Verilog ANSI Versus OpenVera1 BindingOVA requires a binding of a unit to a module in the de-sign. Therefore, each OVA unit used inverification will have one or more bindspecifications. SystemVerilog does not require a bindingbut provides a bind construct to facilitate separation of design from verification . Furthermore,there are differences in the semantics of the differences:SVA:bind2module_or instance block_with_props inst_name ( ports ) ;OVA:bind modulemodule_name : instance_name ( ports ) ;bindinstancesinst1, inst2.
4 , instN : instance_name ( ports ) ;AssertThere are syntactic differences between SVA and OVA assert directives. The most obvious differenceis the lexical order of the assertion name and the assert keyword. The OVA message, severity, andcategory do not exist in SVA. SVA has an action block that can specify statements on pass or failconditions. Finally, OVAsupports built-in formulae meant for use with formal verification . SVAdoes not support these :<name> : assert( <expression> ) [ <action_block> ] ;OVA:assert<name> : builtin_formula ( <seq_expr> [, message [, severity [, category ]]] ) ;CoverThe syntax between SVAand OVAcover directives is also different.
5 The version of theOpenVera Language Reference Manual: Assertions(dated April 2003) contains no documentationfor a cover directive. However, there is a third-party tool that supports this undocumented the OVA cover directive is not documented in the OpenVera LRM, the information providedbelow is based on the best available information. While accurate, it may not be complete. SVA:<name> : cover property( <sva_sequence> ) [ pass_statement ] ;OVA:cover<name> : ( <ova_sequence> ) ;AssumeThe differences in syntax for the assume directive is similar to that documented above forassert and Versus OpenVera Miscellaneous DirectivesOVA defines restrictand modeldirectives that do not exist for SpecificationBoth SVA and OVA provide for the specification of a sampling event (clock specification).
6 However, the syntax differs between the two :The clock expression is specified in the sequence or property ;@(posedgeclk)ready |=> (ack);endpropertysequencebar;@(posedgesy sclk) a ##1 b ##2 c;endsequenceOVA:The clock specification defines a block (clocked entity) within which sequences are ( logic clk, logic ready, logic ack);clockposedge clk {s_foo : (ifready thenack);}endunitSystemVerilog Versus OpenVera3 Sequence SyntaxThe difference in sequence operator syntax between the two languages is best presented via a comparison table. The differences are not DescriptionSystemVerilogOpenVera AssertionTime/cycle advancement##n#nConsecutive repetitionwith rangeseq[*n]seq[*n:m]seq * [n]seq * [n.]
7 M]Non-consecutive repetitionseq[=n], seq[=n:m]N/AGoto repetitionseq[->n]N/AInfinite (unbounded) range[n:$][ ]Implication (same cycle)Next cycleAntecedent<LHS> |-> <RHS> <LHS> |=> <RHS>if(cond) then<T> [else<F>](else is optional)cond must be boolean conditionSequence conjunction (and)<LHS> and<RHS> <LHS> &&<RHS>Intersection (length-matching and)<LHS> intersect<RHS> <LHS> intersect<RHS>Sequence disjunction (or)<LHS> or<RHS> <LHS> || <RHS>Convert sequence to Boolean<seq>.matchedmatched<seq> )first_matchfirst_match(<seq> )first_match( <seq> )Condition over sequence(cond) throughout<seq>istrue(boolexpr) in<seq>length[int/range] in<seq>Sequence within another sequenceseq withinseqLocal variable assignmentSVAassignment w/in assignment is stmta ##1 (b[->1], var= e)initvar_name = const_value;var_name <= expr;Unconditional match`trueanyTemplates (reusable props)templatename ( params ) : {.}
8 }temp_name inst_name ( params ) ;Loop generationVerilog for generatefor(lcv=expr; end_expr; lcv=incr_expr) { .. }Formula operatorsalways(assertion block)N/AN/AN/Adisableiff(approximate)N/ AN/AN/AN/AN/Aalwayseventuallynext, wnextgloballyiffuntil, wuntilfollowed_bytriggersaccept .. in ..reject .. in ..Multiple-clocked sequencesMultiple @<clk_expr> clauses in sequenceMust use matchedto convert sequence inone clock domain to a Boolean value foruse in another clock Versus OpenVera Predefined/Built-in Functions and TasksThe following table shows the differences in support for various built-in functions and tasks for SystemVerilog and Versus SystemVerilog for Testbench and VerificationVera s syntax is more heavily influenced by C than is SystemVerilog s.
9 This is easily seen inthe use of curly braces {} to denote the beginning and ending of a block in Vera whereasSystemVerilog uses a semicolon ; to denote the end of a declaration, and it uses begin andendxyzkeywords to bracket differences exist in the syntax and semantics between the two BlockSystemVerilog program blocks can have ports and parameters. OpenVera program blocks do nothave an interface defined in this manner. Instead, an interface block is specified to provide theconnection between the OpenVera program block and the design. An OpenVera interface is not the same as a SystemVerilog interface (see section on interfacesbelow).
10 DescriptionSystemVerilogOpenVera AssertionsPrevious value of a signal$past( expr, clk_ev )past( sig, cycles )Future value of a signalN/Afuture( bit_vec_expr )Procedural sampling$sampled( expr, clk_ev )N/ARising edge$rose( expr, clk_ev )N/AFalling edge$fell( expr, clk_ev )N/ANo event for time$stable( expr, clk_ev )N/ANumber of bits 1 in vector$countones( expr )count( bit_vector_expr )One hot$onehot( expr )N/AOne hot with all 0 allowed$onehot0( expr )N/ACheck for unknowns$isunknown( expr )N/ASystemVerilog Versus OpenVera5 Syntactic Differences in Block SyntaxOpenVera:program <name> {.}