-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgates.v
More file actions
36 lines (31 loc) · 747 Bytes
/
gates.v
File metadata and controls
36 lines (31 loc) · 747 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
32
33
34
35
36
module gates(); // it has no in/op port
// it's like a test bench.. input of the DUT
// can be driven by registers.. which is done
// in this case...
// Output to external environment for DUT is
// always a wire... therefore out0/1/2 is
// of type wire..
wire out0;
wire out1;
wire out2;
reg in1, in2, in3, in4;
// creating instances for different gates...
not U1(out0, in1);
and U2(out1, in1, in2, in3, in4);
xor U3(out2, in1, in2, in3);
initial begin
$monitor(
" %g in1=%b in2=%b in3=%b in4=%b out0=%b out1=%b out2=%b",
$time, in1, in2, in3, in4, out0, out1, out2);
// initializing the values for the simulation....
in1 = 0;
in2 = 0;
in3 = 0;
in4 = 0;
#1 in1 = 1;
#1 in2 = 1;
#1 in3 = 1;
#1 in4 = 1;
#1 $finish;
end
endmodule