nand2Tetris

This commit is contained in:
2024-12-01 13:42:54 +03:00
parent 0237c7bcb2
commit a69386c7b4
14 changed files with 274 additions and 17 deletions

View File

@ -0,0 +1,26 @@
module Fulladder (
input A,
input B,
input Cin,
output S,
output Cout
);
wire AxB, AnB1, AnB2;
halfadder h1 (
.A(A),
.B(B),
.Sum(AxB),
.Carry(AnB2)
);
halfadder h2 (
.A(AxB),
.B(Cin),
.Sum(S),
.Carry(AnB1)
);
or o1 (.Y(Cout), .A(AnB1), .B(AnB2));
endmodule

View File

@ -1,13 +0,0 @@
module fullAdder (
input A,
input B,
input Cin,
output S,
output Cout
);
wire AxB, AnB1, AnB2;
halfadder h1(A, B, AxB, AnB2);
halfadder h2(AxB, Cin, S, AnB1);
or o1(Cout, AnB1, AnB2);
endmodule

View File

@ -3,7 +3,7 @@ module fulladdertb ();
reg r1, r2, r3;
wire w1, w2;
fullAdder uut(
FullAdder uut(
.A(r1),
.B(r2),
.Cin(r3),
@ -26,4 +26,4 @@ initial begin
$display(w2);
end
endmodule
endmodule

View File

@ -14,5 +14,5 @@ initial begin
A = 1'b1; B = 1'b0; #10;
A = 1'b1; B = 1'b1; #10;
end
endmodule
endmodule