Professional Documents
Culture Documents
Sva PDF
Sva PDF
e2 e1
e1 and e2 e2
e1
e5
e2
e1 ##[1:5] e2
e3
e3 ##2 e4 ##2 e5
e4
(e1 ##[1:5] e2) intersect
(e3 ##2 e4 ##2 e5)
e5 • Sequence ended: the ended method returns a Boolean that
is true in the cycle at which the associated sequence has
e1 ##[1:5] e2 achieves a match, regardless of when the sequence started.
E.g., s1 ##1 s2.ended
e3 ##2 e4 ##2 e5 s1
s1
s2
e1 burst_mode
e2
irdy
e1 and e2
mclk 1 2 3 4 5 6 7 8 9 10 11 12 13 14
e3
e4 burst_mode
e5 irdy
e1 ##[1:5] e2
trdy
e3 ##2 e4 ##2 e5
(trdy==0)&& 1 2 3 4 5 6 7
(e1 ##[1:5] e2) or (irdy==0)
(e3 ##2 e4 ##2 e5)
Burst_rule1
• Throughout construct example
sequence burst_rule1; • Local variables
@(posedge mclk) • Sequences Can have local variable
$fell(burst_mode) ##0 • New copy of local variable is created and no hierarchical
(!burst_mode) throughout (##2 ((trdy==0)&&(irdy==0)) [*7]); access to these local variables are allowed
endsequence • Assigned using a comma separated list along with other
expression
• Eg:
sequence s1( int test );
int i;
i = test;
(data_valid, (i=tag_in)) |-> ##7 (tag_out==i);
endsequence
• Cannot be accessed outside the sequence where it is
instantiated
• Local variable can be passed only as an entire actual • An instance of a named property can be used as a valid
argument property expression. For instance, the property
• System functions sequence_example defined above is itself can be a
Function Meaning property expression
$onehot(expression) true, if only one of the bits in the property property_example;
expression is high Sequence_example
$onehot0(expression) true, if at most one of the bit in endproperty
the expression is high • A property may call itself resulting in a recursive
$isunknown(expression) true, if any bit of the expression is property
X or Z • Property Type 3: Property Type Inverse
$countones(expression) returns the number of 1s in a bit • A property expression may be an inverse of another
vector expression property expression. The inversion is done by using the
• Property layer not operator
• Built on the foundation of Sequences, Boolean expressions property inversion_example;
• Property block not Sequence_example
property identifier (formal_arg_list); endproperty
variable declaration • Property Type 4: Property Type Disjunction
property_spec • A disjunction property is true if either of its constituent
endproperty property expressions is true. The disjunction operator or
• Property declaration can occur in is used to describe a disjunction operator
• A module property disjunction_example;
• An interface sequence_example or inversion_example;
• A program endproperty
• A clocking block • Property Type 5: Property Type Conjunction
• A package • A conjunction is equivalent of a logical and operation,
• A compilation unit and very aptly, is expressed by an and operator
• Property declaration does not affect a simulation behavior until property conjunction_example;
the property is designated as following sequence_example and inversion_example
• An assumed or anticipated behavior: By associating the endproperty
property using an assume keyword. The verification • Property Type 6: An ‘if..else’
environment assumes that the behavior occurs • An 'if...else' property expression is a conditional
• A checker: By associating the property using an assert statement that describes two possible behaviors based
keyword. The verification environment checks if the behavior on the value of an expression
occurs property ifelse_example;
• A coverage specification: By associating the property using a if ( expr == 2’b10)
cover keyword. The verification environment uses the inversion_example;
statement for measuring coverage else sequence_example
• Types of Properties endproperty
• Property Type 1: A Sequence • Property Type 7: An Implication
• A property expression may be a simple sequence • An implication property describes a behavior that occurs
expression as shown below when a preceding behavior takes place
property sequence_example; • The implication operators '|->' and '|=>' are used for
s1; // s1 is a sequence defined elsewhere describing such a property
endproperty property conjunction_example;
• A sequence as a property expression is valid if the s0 |-> sequence_example
sequence is not an empty match (i.e., it contains a endproperty
specific non-empty expression to match). • Implication construct
• Property Type 2: Another Property • Two Types
• ->
• => • Concurrent Assertion using sequence
• Usage: sequence s1;
Res = A (Antecedent) -> B (Consequent) @(posedge clk) a ##1 b ##[1:2] c;
• Note: endsequence;
• Antecedent seq_expr can have multiple success My_Assertion : assert property (@(posedge clk) s1);
• If there is no match of the antecedent seq_expr, • Concurrent Assertion using property
implication succeeds vacuously by returning true. property p1;
• Truth table for Res is: @(posedge clk) s1 ##1 s1 ##1 s1;
A B Res endproperty
0 0 Vacuous success Top_Assertion : assert property (p1) pass_stmt;
0 1 Vacuous success else fail_stmt;
1 0 False • Also have “cover” construct. Can be used for functional
1 1 True coverage.
• Example cover property (p1);
Property data_end; • Property expression qualifiers
@(posedge mclk) • Clocking event
Data_phase |-> • The clocking event describes when a property expression
((irdy==0)&&($fell(trdy) || $fell(stop))); should take place. An example of this is shown below.
endproperty property clocking_example;
mclk 1 2 3 4 5 6 7 8 9 10 11 12 13 14 @(posedge clk) Sequence_example
endproperty
• Disable iff
data_phase • A 'disable iff' command is similar to a reset statement -
the property expression is valid only if the reset situation
is lifted. Here is an example of this command
irdy property disable_iff_example;
Disable iff (reset_expr) Sequence_example
endproperty
trdy (high) • Recursive properties
• Eg:
property recursive_always;
stop Sig_x and (1’b1 |=> recursive_always);
endproperty
• Restrictions for Recursive Properties
data_end • A recursive property can not use a not operator.
• The operator disable iff can not be used in a recursive
• Implication construct property.
Sequence Operator Property Operator Associativity • A recursive property can call itself only after a positive
[*], [=], [->] - time delay (to avoid an infinite loop).
## left • Assertion layer
• Adds sense to the property described
throughout right
• Key words that define a sense for a assertion
within left
• assert: The keyword assert indicates that a property acts
intersect left
a checker. The verification environment should check if
not - the behavior occurs.
and and left • assume: The assume keyword indicates that the
or or left property behavior is anticipated or assumed and should
if..else right be treated so by the verification tool.
|->, |=> right
• cover: If a property is associated with the keyword blocks, tasks and functions), and is used to block the execution until
cover, it indicates that the property evaluation will be the property succeeds.
monitored for coverage. task mytask;
• Concurrent Can be specified inside the following construct ...
• an always block if (expr1)
• an initial block expect (my_property)
• a module pass_block();
• a program else // associated with the 'expect',
• an interface // not with the 'if'
• When instantiated outside the scope of a procedural block fail_block();
(initial or always), a property behaves as if it is within an ...
always block. endtask
assert property (p1);
• outside the scope of a procedural block is equivalent to: Binding properties to scopes or instances
always • To facilitate verification separate from design, it is possible to specify
assert property (p1); properties and bind them to specific modules or instances.
• Assert statement • Uses:
• Property associated with a assert statement is treated as checker • It allows verification engineers to verify with minimum changes to
property top_prop; the design code/files.
seq0 |-> prop0 • It allows a convenient mechanism to attach VIP to a module or
endproperty instance.
assert to_prop: • No semantic changes to the assertions are introduces due to this
assert property (top_prop) begin feature. It is equivalent to writing properties external to a module,
int pass count; using hierarchical path name.
$display ( “pass: top_prop”); • Example of binding two modules.
pass_count = pass_count +1’b1; module cpu ( a, b, c)
end < RTL Code >
• Assume statement endmodule
• A property associated with an assume statement implies that the module cpu_props ( a, b, c)
property holds during verification < Assertion Properties >
• For a formal or dynamic simulation environment, the statement is endmodule
simply assumed to be true and rest of the statements that need to • bind cpu cpu_props cpu_rules_1(a, b, c);
be verified are constrained accordingly • cpu and cpu_props are the module name.
Assume_property_reset_seq0: assume property (reset_seq0); • cpu_rules_1 is cpu_props instance name.
property reset_seq0; • Ports (a, b, c) gets bound to the signals (a, b, c) of the
@(posedge clk) reset |-> not seq0; module cpu.
end • every instance of cpu gets the properties.
• Cover statement
• A cover statement measures the coverage of the various
components
cover_property_top_prop:
cover property (top_prop)
$display ("top_prop is a hit");
property top_prop;
seq0 |-> prop0;
endproperty
• Expect statement
• An expect statement is very similar to an assert statement, but it
must occur within a procedural block (including initial or always