assert_one_hot

Ensures that the value of a specified expression is one-hot.

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

Syntax

assert_one_hot 
		[#(severity_level, width, 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: 32.
 
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 one-hot value on the rising clock edge.

Description

The assert_one_hot assertion checker checks the expression test_expr at each rising edge of clk to verify the expression evaluates to a one-hot value. A one-hot value has exactly one bit set to 1.

The checker is useful for verifying control circuits, for example, it can ensure that a finite-state machine with one-hot encoding operates properly and has exactly one bit asserted high. In a datapath circuit the checker can ensure that the enabling conditions for a bus do not result in bus contention.

Assertion Checks

 
ASSERT_ONE_HOT
Expression evaluated to zero or to a value with multiple bits set to 1.
 
test_expr contains X/Z value
Expression evaluated to a value with an X or Z bit, and ‘OVL_XCHECK_OFF is not set.

Cover Points

 
all_one_hots_checked
Expression evaluated to all possible combinations of one-hot values.
 
test_expr_change
Expression has changed value.

Notes

1. By default, the assert_one_hot assertion is optimistic and the assertion fails if test_expr is zero or has multiple bits not set to 0 (i.e.equals 1, X, Z, etc.). However, if ‘OVL_XCHECK_OFF is set, the ASSERT_ONE_HOT assertion fails if and only if test_expr is zero or has multiple bits that are 1.

See also

assert_one_cold, assert_zero_one_hot

Example

assert_one_hot #(
 
‘OVL_ERROR,
4,
‘OVL_ASSERT,
“Error: sel not one-hot”,
‘OVL_COVER_ALL)
// severity_level
// width
// property_type
// msg
// coverage_level
 
valid_sel_one_hot (
 
 
 
clk,
reset_n,
sel );
// clock
// reset
// test_expr

Ensures that sel is one-hot at each rising edge of clk.


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