-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdiscrete_RTPG_logic_cells.v
75 lines (61 loc) · 1.02 KB
/
discrete_RTPG_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
/*
Verilog description of cell library to allow for proper port mapping
Based on Yosys cmos example
*/
module BUF(A, Y);
input A;
output Y;
assign Y = A;
endmodule
module rtpg_NOT(A, Y);
input A;
output Y;
assign Y = ~A;
endmodule
module rtpg_XOR2(A, B, Y);
input A, B;
output Y;
assign Y = (A ^ B);
endmodule
module rtpg_NOR2(A, B, Y);
input A, B;
output Y;
assign Y = ~(A | B);
endmodule
module rtpg_NOR3(A, B, C, Y);
input A, B , C;
output Y;
assign Y = ~(A | B | C);
endmodule
module rtpg_NOR4(A, B, C, D, Y);
input A, B , C, D;
output Y;
assign Y = ~(A | B | C | D);
endmodule
module rtpg_DFF7T(nC, D, Q);
input nC, D;
output reg Q;
always @(negedge nC)
Q <= D;
endmodule
module rtpg_DFF7T_PN(nC, D, Q, QN);
input nC, D;
output reg Q;
output QN;
always @(negedge cC)
Q <= D;
assign QN = ~Q;
endmodule
module rtpg_DFF7T_CLR(C, CD, D, Q, QN);
input C, D, CD;
output reg Q;
output QN;
always @(negedge C or negedge CD)
begin
if (CD == 1'b0)
Q <= 1'b0;
else
Q <= D;
end
assign QN = ~Q;
endmodule