Escolar Documentos
Profissional Documentos
Cultura Documentos
SystemVerilog
Versus
OpenVera
Stephen Bailey
Mentor Graphics
Version 0.3, 28 June 04
w w w. m e n t o r. c o m
Introduction
The 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 former.
Therefore, 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 many
similarities, 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 SystemVerilog.
Of course, this is not true, and anyone who believes otherwise will be unpleasantly surprised.
How SystemVerilog differs from OpenVera™ is the topic of this paper.
Assertions
Inline Specification
SystemVerilog assertions (SVA) can be placed inline (concurrently or procedurally), or they may
be organized with or within interfaces, modules and, to a limited extent, packages. OpenVera
Assertions™ (OVA) do not support inline specification of assertions.1 OVA must be packaged in
units (as discussed below).
In effect, SystemVerilog supports specification of assertions both inline and in separate files.
OVA only supports the specification of assertions in a separate source file.
Packaging
In SystemVerilog, assertions are defined within module or generate regions as a concurrent
statement. That is, they are located within modules.
In OVA, the cover directives are located in OVA units. An OVA unit looks like a Verilog module
except the module/endmodule keywords are replaced by the unit/endunit keywords and the port
declarations use the Verilog ANSI style.
Syntactic differences:
SVA:
bind 2module_or instance block_with_props inst_name ( ports ) ;
OVA:
bind module module_name : instance_name ( ports ) ;
bind instances inst1, inst2, …, instN : instance_name ( ports ) ;
Assert
There are syntactic differences between SVA and OVA assert directives. The most obvious difference
is the lexical order of the assertion name and the assert keyword. The OVA message, severity, and
category do not exist in SVA. SVA has an action block that can specify statements on pass or fail
conditions. Finally, OVA supports built-in formulae meant for use with formal verification. SVA
does not support these formulae.
SVA:
<name> : assert ( <expression> ) [ <action_block> ] ;
OVA:
assert <name> : builtin_formula ( <seq_expr> [, message [, severity [, category ]]] ) ;
Cover
The syntax between SVA and OVA cover directives is also different. The 2.3 version of the
OpenVera Language Reference Manual: Assertions (dated April 2003) contains no documentation
for a cover directive. However, there is a third-party tool that supports this undocumented directive.
Since the OVA cover directive is not documented in the OpenVera LRM, the information provided
below 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> ) ;
Assume
The differences in syntax for the assume directive is similar to that documented above for
assert and cover.
Clock Specification
Both SVA and OVA provide for the specification of a sampling event (clock specification).
However, the syntax differs between the two languages.
SVA:
The clock expression is specified in the sequence or property specification.
property foo;
@(posedge clk)
ready |=> (ack);
endproperty
sequence bar;
@(posedge sysclk) a ##1 b ##2 c;
endsequence
OVA:
The clock specification defines a block (clocked entity) within which sequences are defined.
unit foo( logic clk, logic ready, logic ack);
clock posedge clk {
s_foo : (if ready then ack);
}
endunit
Antecedent
<LHS> |=> <RHS> (else is optional)
cond must be boolean condition
Sequence 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>.matched matched <seq> )
first_match first_match( <seq> ) first_match( <seq> )
Condition over sequence (cond) throughout <seq> istrue (boolexpr) in <seq>
length [int/range] in <seq>
Sequence within another sequence seq within seq
Local variable assignment
SVA assignment w/in seq.
a ##1 (b[->1], var = e) init var_name = const_value;
Program Block
SystemVerilog program blocks can have ports and parameters. OpenVera program blocks do not
have an interface defined in this manner. Instead, an “interface” block is specified to provide the
connection between the OpenVera program block and the design.
An OpenVera interface is not the same as a SystemVerilog interface (see section on interfaces
below).
SystemVerilog:
program <name> [ ( port-list ) ] ;
…
endprogram
Classes
OpenVera classes can be declared as “extern” in a header file. Whereas, classes cannot be
declared as “extern” in SystemVerilog. OpenVera class members can be local or public.
SystemVerilog class members can be local, public (default), or protected. There is no public
keyword in SystemVerilog.
Data Types
Type SystemVerilog OpenVera
Integer 2-state int integer (always signed)
Integer 4-state integer N/A
64-bit integer longint N/A
Signed integer int signed N/A
Unsigned integer int unsigned N/A
in both languages)
Packed data Arrays: Location of index range Class members via use of the packed
Structs: use of packed keyword keyword. Can be modified with big_endian
and little_endian, bit_normal, and
bit_reverse. pack() and unpack() prede-
fined methods.
Miscellaneous
Capability SystemVerilog OpenVera
Regions (mutually exclusive access N/A Yes, regions
to values)
(cond) -> { <set> } (cond) => { <set> } Rand sequence production weightings
if (cond) { <set> } if (cond) { <set> }
else { <set> } else { <set> }
Lhs : rhs1 := 2 Lhs : &(2) rhs1 Aborting rand sequence productions
| rhs2 := 5 | &(5) rhs2
break terminates sequence block break terminates sequence block Passing values between productions
return aborts the current production continue aborts the current production