assert_decrement

Ensures that the value of a specified expression changes only by the specified decrement value.

Parameters:
severity_level
width
value
property_type
msg
coverage_level
Class:
2-cycle assertion

Syntax

assert_decrement 
		[#(severity_level, width, value, property_type, msg, coverage_level )] 
		instance_name (clk, reset_n, test_expr );

Parameters

 
severity_level
Severity of the failure. Default: ‘OVL_ERROR.
 
width
Width of the test_expr argument. Default: 1.
 
value
Decrement value for test_expr. Default: 1.
 
property_type
Property type. Default: ‘OVL_ASSERT.
 
msg
Error message printed when assertion fails. Default: “VIOLATION”.
 
coverage_level
Coverage level. Default: ‘OVL_COVER_ALL.

Ports

 
clk
 
Clock event for the assertion. The checker samples on the rising edge of the clock.
 
reset_n
 
Active low synchronous reset signal indicating completed initialization.
 
test_expr
[ width - 1: 0 ]
Expression that should decrement by value whenever its value changes from the rising edge of clk to the next rising edge of clk.

Description

The assert_decrement assertion checker checks the expression test_expr at each rising edge of clk to determine if its value has changed from its value at the previous rising edge of clk. If so, the checker verifies that the new value equals the previous value decremented by value. The checker allows the value of test_expr to wrap, if the total change equals the decrement value. For example, if width is 5 and value is 4, then the following change in test_expr is valid:

	5’b00010 ——> 5’b11110

The checker is useful for ensuring proper changes in structures such as counters and finite-state machines. For example, the checker is useful for circular queue structures with address counters that can wrap. Do not use this checker for variables or expressions that can increment. Instead consider using the assert_delta checker.

Assertion Check

 
ASSERT_DECREMENT
Expression evaluated to a value that is not its previous value decremented by value.

Cover Point

 
test_expr_change
Expression changed value.

Notes

1. The assertion check compares the current value of test_expr with its previous value. Therefore, checking does not start until the second rising clock edge of clk after reset_n deasserts.

See also

assert_delta, assert_increment, assert_no_underflow

Example

  
assert_decrement #(
 
‘OVL_ERROR,
4,
1,
‘OVL_ASSERT,
“Error: invalid binary decrement”,
‘OVL_COVER_ALL)
// severity_level
// width
// value
// property_type
// msg
// coverage_level
 
valid_count (
 
 
 
clk,
reset_n,
count );
// clock
// reset
// test_expr
    

Ensures that the programmable counter’s count variable only decrements by 1. If count wraps, the assertion fails, because the change is not a binary decrement.


  © Accellera Organization, Inc. 2005
All Rights Reserved.
Standard OVL V1.1a