|
|
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
|