-
Notifications
You must be signed in to change notification settings - Fork 0
/
mux_2x1.v
63 lines (49 loc) · 863 Bytes
/
mux_2x1.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
module mux(in1,in2,sel,out);
input in1,in2,sel;
output out;
assign out = sel ? in2 : in1 ;
endmodule
module test;
reg i1, i2, s;
wire o;
mux m1(i1,i2,s,o);
initial begin
$dumpfile("vcd/Mux.vcd");
$dumpvars(0, test);
$display("in1 \t in2 \t sel \t out");
$monitor("%b \t %b \t %b \t %b", i1, i2, s, o);
i1 = 0;
i2 = 0;
s = 0;
#10
i1 = 0;
i2 = 0;
s = 1;
#10
i1 = 0;
i2 = 1;
s = 0;
#10
i1 = 0;
i2 = 1;
s = 1;
#10
i1 = 1;
i2 = 0;
s = 0;
#10
i1 = 1;
i2 = 0;
s = 1;
#10
i1 = 1;
i2 = 1;
s = 0;
#10
i1 = 1;
i2 = 1;
s = 1;
#10
$finish;
end
endmodule