Skip to content

Commit 67a1a0f

Browse files
committed
如果採用,此提交將新增一位元全加法器
修改項目: 模組: 議題
1 parent 1c2805c commit 67a1a0f

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module full_add_one (A, B, Ci, Co, S);
2+
3+
input A, B, Ci;
4+
output Co, S;
5+
wire AB, ACi, BCi;
6+
7+
and (AB, A, B);
8+
and (ACi, A, Ci);
9+
and (BCi, B, Ci);
10+
or (Co, AB, ACi, BCi);
11+
xor (S, A, B, Ci);
12+
13+
endmodule // full_add_one
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module full_add_one_test ();
2+
`timescale 1ns / 1ps
3+
4+
reg A = 0'b0;
5+
reg B = 0'b0;
6+
reg Ci = 0'b0;
7+
8+
wire Co, S;
9+
10+
full_add_one UUT (.A(A), .B(B), .Ci(Ci), .Co(Co), .S(S));
11+
12+
initial begin
13+
#100; A = 0'b0; B = 0'b0; Ci = 0'b1;
14+
#100; A = 0'b0; B = 0'b1; Ci = 0'b0;
15+
#100; A = 0'b0; B = 0'b1; Ci = 0'b1;
16+
#100; A = 0'b1; B = 0'b0; Ci = 0'b0;
17+
#100; A = 0'b1; B = 0'b0; Ci = 0'b1;
18+
#100; A = 0'b1; B = 0'b1; Ci = 0'b0;
19+
#100; A = 0'b1; B = 0'b1; Ci = 0'b1;
20+
21+
end
22+
23+
initial begin
24+
#900;
25+
$stop;
26+
27+
end
28+
29+
endmodule // full_add_one_test

0 commit comments

Comments
 (0)