forked from RudraNilBasu/verilog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfhadder.v
More file actions
32 lines (26 loc) · 723 Bytes
/
Copy pathfhadder.v
File metadata and controls
32 lines (26 loc) · 723 Bytes
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
module testbench;
wire i0, i1, i2, ps, pc, fs, fc;
halfadder h1(i0, i1, ps, pc), h2(i2, ps, fs, fc);
or(o, fc, pc);
test t1(i0, i1, i2, fs, o);
endmodule
module halfadder(input a, b, output sum, carry);
xor(sum, a, b);
and(carry, a, b);
endmodule
module test(output reg i0, i1, i2, input fs, fc);
initial begin
$dumpfile("fadump.vcd");
$dumpvars(2, testbench);
$monitor($time,,, "i0 = %b i1 = %b i2 = %b sum = %b carry = %b\n\n", i0, i1, i2, fs, fc);
{i0, i1, i2} = #1 3'b000;
{i0, i1, i2} = #1 3'b001;
{i0, i1, i2} = #1 3'b010;
{i0, i1, i2} = #1 3'b011;
{i0, i1, i2} = #1 3'b100;
{i0, i1, i2} = #1 3'b101;
{i0, i1, i2} = #1 3'b110;
{i0, i1, i2} = #1 3'b111;
$finish;
end
endmodule