반응형
목차
Reduction Operator
- Reduction Operator들은 벡터를 단 하나의 비트로만 줄입니다.
- Bitwise 연산입니다.
- If there are the characters Z and X, the result can be a known value.
Example
a = 5’b10101 b = 4’b0011 c = 3’bz00 d = 3’bx011
Character
|
Operation performed
|
Example
|
Type
|
&
|
And all bits
|
&a = 1’b0, &d = 1’b0
|
Unary
|
~&
|
Nand all bits
|
~&a = 1’b1
|
Unary
|
|
|
Or all bits
|
|a = 1’b1, |c = 1’bX
|
Unary
|
~|
|
Nor all bits
|
~|a= 1’b0
|
Unary
|
^
|
Xor all bits
|
^a = 1’b1
|
Unary
|
^~ ~^
|
Xnor all bits
|
~^a = 1’b0
|
Unary
|
Code example
reg[7:0] cnt;
assign parity = ^cnt;
assign parity = cnt[7]^cnt[6]^cnt[5]^cnt[4]^cnt[3]^cnt[2]^cnt[1]^cnt[0];
|
728x90
반응형
'Language > Verilog & SV' 카테고리의 다른 글
[Verilog & SV] 시프트 연산자(Shift Operators) (0) | 2025.04.09 |
---|---|
[Verilog & SV] 논리 연산자(Logical Operators) (0) | 2025.04.09 |
[Verilog & SV] 산술연산자(Arithmetic Operators) (0) | 2025.04.09 |
[Verilog & SV] 관계 연산자(Relational Operators) (0) | 2025.04.09 |
[Verilog & SV] 비트 연산자(Bitwise Operators) (0) | 2025.04.09 |