|
|
|
|
|
|
|
|
|
|
|
|
Reduction Operators
|
|
|
Like in Verilog and SystemVerilog, VERA reduction operators are unary, they perform a bit-wise operation on signle operand to produce a single bit result. |
|
|
|
|
|
Following reduction Operators are supported in VERA |
|
|
|
|
|
Operator
|
Description
|
&
|
and
|
~&
|
nand
|
|
|
or
|
~|
|
nor
|
^
|
xor
|
^~ or ~^
|
xnor
|
|
|
|
|
|
|
|
|
|
|
|
|
Example : Reduction Operators
|
|
|
|
|
|
1 program reduction {
2 // Bit Wise AND reduction
3 printf (" & 4'b1001 = %b\n", (& 4'b1001));
4 printf (" & 4'bx111 = %b\n", (& 4'bx111));
5 printf (" & 4'bz111 = %b\n", (& 4'bz111));
6 // Bit Wise NAND reductio\n"
7 printf (" ~& 4'b1001 = %b\n", (~& 4'b1001));
8 printf (" ~& 4'bx001 = %b\n", (~& 4'bx001));
9 printf (" ~& 4'bz001 = %b\n", (~& 4'bz001));
10 // Bit Wise OR reduction
11 printf (" | 4'b1001 = %b\n", (| 4'b1001));
12 printf (" | 4'bx000 = %b\n", (| 4'bx000));
13 printf (" | 4'bz000 = %b\n", (| 4'bz000));
14 // Bit Wise OR reduction
15 printf (" ~| 4'b1001 = %b\n", (~| 4'b1001));
16 printf (" ~| 4'bx001 = %b\n", (~| 4'bx001));
17 printf (" ~| 4'bz001 = %b\n", (~| 4'bz001));
18 // Bit Wise XOR reduction\n"
19 printf (" ^ 4'b1001 = %b\n", (^ 4'b1001));
20 printf (" ^ 4'bx001 = %b\n", (^ 4'bx001));
21 printf (" ^ 4'bz001 = %b\n", (^ 4'bz001));
22 // Bit Wise XNOR
23 printf (" ~^ 4'b1001 = %b\n", (~^ 4'b1001));
24 printf (" ~^ 4'bx001 = %b\n", (~^ 4'bx001));
25 printf (" ~^ 4'bz001 = %b\n", (~^ 4'bz001));
26 }
You could download file reduction.vr here
|
|
|
|
|
|
Simulation : Reduction Operators
|
|
|
|
|
|
& 4'b1001 = 0
& 4'bx111 = x
& 4'bz111 = x
~& 4'b1001 = 1
~& 4'bx001 = 1
~& 4'bz001 = 1
| 4'b1001 = 1
| 4'bx000 = x
| 4'bz000 = x
~| 4'b1001 = 0
~| 4'bx001 = 0
~| 4'bz001 = 0
^ 4'b1001 = 0
^ 4'bx001 = x
^ 4'bz001 = x
~^ 4'b1001 = 1
~^ 4'bx001 = x
~^ 4'bz001 = x
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|