forked from Ravenslofty/74xx-liberty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
74_models.v
67 lines (49 loc) · 971 Bytes
/
74_models.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
module \74HC85_1x1CMP4 (A, B, Li, Ei, Gi, Lo, Eo, Go);
input [3:0] A;
input [3:0] B;
input Li, Ei, Gi;
output Lo, Eo, Go;
assign Lo = (A < B) || (A == B && !Gi && !Ei);
assign Go = (A > B) || (A == B && !Li && !Ei);
assign Eo = (A == B) && Ei;
endmodule
module \74AC283_1x1ADD4 (A, B, CI, S, CO);
input [3:0] A;
input [3:0] B;
input CI;
output [3:0] S;
output CO;
assign {CO, S} = A + B + CI;
endmodule
/*
module \74AC377_8x1DFFE (D, CE, CP, Q);
input D, CE, CP;
output reg Q;
always @(posedge CP) begin
if (!CE) Q <= D;
end
endmodule
*/
module \74HC688_1x1EQ8 (A, B, E, Q);
input [7:0] A;
input [7:0] B;
input E;
output Q;
assign Q = E || !(A == B);
endmodule
module \74AC161_1x1COUNT4 (A, Q, RCO, ENT, CLK, LOAD);
input [3:0] A;
input CLK;
input ENT;
input LOAD;
output reg [3:0] Q;
output RCO;
assign RCO = Q == 4'b1111;
always @ (posedge CLK) begin
if (!LOAD) begin
Q <= A;
end else if (ENT) begin
Q <= Q + 1'b1;
end
end
endmodule