-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelperModules.v
41 lines (32 loc) · 973 Bytes
/
helperModules.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module invert(input wire i, output wire o1);
assign o1 = !i;
endmodule
module and2(input wire i0, i1, output wire o2);
assign o2 = i0 & i1;
endmodule
module and3(input wire i0, i1, i2, output wire o6);
assign o6 = i0 & i1 & i2;
endmodule
module or2(input wire i0, i1, output wire o3);
assign o3 = i0 | i1;
endmodule
module xor2_v2(input wire i0, i1, output wire o3);
assign o3 = ( i0 & (!i1) ) | ( i1 & (!i0) );
endmodule
module xor2(input wire i0, i1, output wire o4);
assign o4 = i0 ^ i1;
endmodule
module xor3(input wire i0, i1, i2, output wire o7);
assign o7 = i0 ^ i1 ^ i2;
endmodule
module xor3E(input wire i0, i1, i2, output wire o7);
assign o7 = ( !i0 & !i1 & i2 ) | ( !i0 & i1 & !i2 ) | ( i0 & !i1 & !i2 );// | ( i0 & i1 & i2 );
endmodule
module or3(input wire i0, i1, i2, output wire o4);
assign o4 = i0 | i1 | i2;
endmodule
module nand2(input wire i0, i1, output wire o5);
wire t;
and2 and2_0 (i0, i1, t);
invert invert_0 (t, o5);
endmodule