-
Notifications
You must be signed in to change notification settings - Fork 8
/
discrete_nmos_logic_cells.v
104 lines (82 loc) · 1.36 KB
/
discrete_nmos_logic_cells.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
Verilog description of cell library to allow for proper port mapping
Based on Yosys cmos example
*/
module nm_BUF(A, Y);
input A;
output Y;
assign Y = A;
endmodule
module nm_NOT(A, Y);
input A;
output Y;
assign Y = ~A;
endmodule
module nm_NAND2(A, B, Y);
input A, B;
output Y;
assign Y = ~(A & B);
endmodule
module nm_NAND3(A, B, C,Y);
input A, B, C;
output Y;
assign Y = ~(A & B & C);
endmodule
module nm_AOI2_2(A, B, C, D, Y);
input A, B, C, D;
output Y;
assign Y = ~((A & B) | (C & D));
endmodule
module nm_AOI1_2(A, B, C, Y);
input A, B, C;
output Y;
assign Y = ~((A & B) | (B & C));
endmodule
module nm_NOR2(A, B, Y);
input A, B;
output Y;
assign Y = ~(A | B);
endmodule
module nm_NOR3(A, B, C, Y);
input A, B , C;
output Y;
assign Y = ~(A | B | C);
endmodule
module nm_DFF(C, D, Q);
input C, D;
output reg Q;
always @(posedge C)
Q <= D;
endmodule
module hy_XOR2(A, B, Y);
input A, B;
output Y;
assign Y = (A ^ B);
endmodule
module hy_DFF7T(C, D, Q);
input C, D;
output reg Q;
always @(posedge C)
Q <= D;
endmodule
module nm_DFFNP(C, D, Q, QN);
input C, D;
output reg Q;
output QN;
always @(posedge C)
Q <= D;
assign QN = ~Q;
endmodule
module nm_DFFNP_CLR(C, CD, D, Q, QN);
input C, D, CD;
output reg Q;
output QN;
always @(posedge C or negedge CD)
begin
if (CD == 1'b0)
Q <= 1'b0;
else
Q <= D;
end
assign QN = ~Q;
endmodule