assert_range

Ensures that the value of a specified expression is in a specified range.

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

Syntax

assert_range 
		[#(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. Default: 1.
 
min
Minimum value allowed for test_expr. Default: 0.
 
max
Maximum value allowed for 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 evaluate to a value in the range from min to max (inclusive) on the rising clock edge.

Description

The assert_range assertion checker checks the expression test_expr at each rising edge of clk to verify the expression falls in the range from min to max, inclusive. The assertion fails if test_expr < min or max < test_expr.

The checker is useful for ensuring certain control structure values (such as counters and finite-state machine values) are within their proper ranges. The checker is also useful for ensuring datapath variables and expressions are in legal ranges.

Assertion Check

 
ASSERT_RANGE
Expression evaluated outside the range min to max.

Cover Points

 
cover_test_expr_change
Expression changed value.
 
cover_test_expr_at_min
Expression evaluated to min.
 
cover_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.

See also

assert_always, assert_implication, assert_never, assert_proposition

Example

assert_range #(
 
‘OVL_ERROR,
3,
2,
5,
‘OVL_ASSERT,
“Error: sel_high - sel_low not within 2 to 5”,
‘OVL_COVER_ALL)
// severity_level
// width
// min
// max
// property_type
// msg
// coverage_level
 
valid_sel (
 
 
 
clk,
reset_n,
sel_high - sel_low );
// clock
// reset
// test_expr

Ensures that (sel_high - sel_low) is in the range 2 to 5 at each rising edge of clk.


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