assert_no_underflow

Ensures that the value of a specified expression does not underflow.

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

Syntax

assert_no_underflow 
		[#(severity_level, width, min, max, 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. Width must be less than or equal to 32. Default: 1.
 
min
Minimum value in the test range of test_expr. Default: 0.
 
max
Maximum value in the test range of test_expr. Default: 2**width - 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 not change from a value of min to a value out of range or to a value equal to max.

Description

The assert_no_underflow assertion checker checks the expression test_expr at each rising edge of clk to determine if its value has changed from a value (at the previous rising edge of clk) that was equal to min. If so, the checker verifies that the new value has not underflowed min. That is, it verifies the value of test_expr is not less than min or greater than or equal to max (in which case, the assertion fails).

The checker is useful for verifying counters, where it can ensure the counter does not wrap from the lowest value to the highest value in a specified range. For example, it can be used to check that memory structure pointers do not wrap around. For a more general test for underflow, use assert_delta or assert_fifo_index.

Assertion Check

 
ASSERT_NO_UNDERFLOW
Expression changed value from min to a value not in the range min + 1 to max - 1.

Cover Points

 
test_expr_change
Expression changed value.
 
test_expr_at_min
Expression evaluated to min.
 
test_expr_at_max
Expression evaluated to max.

Errors

The parameters min and max must be specified such that min is less than or equal to max. Otherwise, the assertion fails on each tested clock cycle for which test_expr changed from max.

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_fifo_index, assert_decrement, assert_no_overflow

Example

  
assert_no_underflow #(
 
‘OVL_ERROR,
3,
3,
7,
‘OVL_ASSERT,
“Error: addr underflow”,
‘OVL_COVER_ALL)
// severity_level
// width
// min
// max
// property_type
// msg
// coverage_level
 
addr_with_underflow (
 
 
 
clk,
reset_n,
addr );
// clock
// reset
// test_expr
    

Ensures that addr does not underflow (i.e., change from a value of 3 at the rising edge of clk to a value of 7 or a value less than 3 at the next rising edge of clk).


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