位向量系统函数
1 基本概念
$countbits ( expression , list_of_control_bits )
$countones ( expression )
$onehot ( expression )
$onehot0 ( expression )
$isunknown ( expression )
2 示例
1 $countbits
The function $countbits counts the number of bits that have a specific set of values (e.g., 0, 1, X, Z) in a
This function returns an int equal to the number of bits in expression whose values match one of the control_bit entries. For example:
— $countbits (expression, '1) returns the number of bits in expression having value 1.
— $countbits (expression, '1, '0) returns the number of bits in expression having values
1 or 0.
— $countbits (expression, 'x, 'z) returns the number of bits in expression having values X
or Z.
2 $countones
$countones ( expression ) is equivalent to $countbits(expression,'1).
3 $onehot
— $onehot ( expression ) returns true (1'b1) if $countbits(expression,'1)==1, otherwise it
returns false (1'b0).
4 $onehot
— $onehot0 ( expression ) returns true (1'b1) if $countbits(expression,'1)<=1, otherwise it
returns false (1'b0).
5 $isunknown
$isunknown ( expression ) returns true (1'b1) if $countbits(expression,'x,'z)!=0,
otherwise it returns false (1'b0).