assert_no_overflow

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

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

Syntax

assert_no_overflow 
		[#(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 max to a value out of the test range or to a value equal to min.

Description

The assert_no_overflow 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 max. If so, the checker verifies that the new value has not overflowed max. That is, it verifies the value of test_expr is not greater than max or less than or equal to min (in which case, the assertion fails).

The checker is useful for verifying counters, where it can ensure the counter does not wrap from the highest value to the lowest 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 overflow, use assert_delta or assert_fifo_index.

Assertion Check

 
ASSERT_NO_OVERFLOW
Expression changed value from max 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_increment, assert_no_overflow

Example

  
assert_no_overflow #(
 
‘OVL_ERROR,
3,
0,
4,
‘OVL_ASSERT,
“Error: addr overflow”,
‘OVL_COVER_ALL)
// severity_level
// width
// min
// max
// property_type
// msg
// coverage_level
 
addr_with_overflow (
 
 
 
clk,
reset_n,
addr );
// clock
// reset
// test_expr
    

Ensures that addr does not overflow (i.e., change from a value of 4 at the rising edge of clk to a value of 0 or a value greater than 4 at the next rising edge of clk).


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