Archived
1
0

add demux and testbench

This commit is contained in:
Erick
2022-03-01 00:36:52 +01:00
parent bcb06dae6a
commit 540aac9fca
2 changed files with 27 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
module demux(y, z, a, sel);
input a, sel;
output y, z;
wire notSel;
not(notSel, sel);
and(z, a, sel);
and(y, a, notSel);
endmodule
+18
View File
@@ -0,0 +1,18 @@
module demux_tb();
reg a,b, sel;
output y;
demux dut(y, z, a, sel);
initial begin
a = 0; sel = 0;
$monitor("IN: %b ",a, "SEL: ",sel, " OUT: a: %b, b: %b", y, z);
#5;
a = 1;sel = 0;
$monitor("IN: %b ",a, "SEL: ",sel, " OUT: a: %b, b: %b", y, z);
#5;
a = 0; sel = 1;
$monitor("IN: %b ",a, "SEL: ",sel, " OUT: a: %b, b: %b", y, z);
#5;
a = 1; sel = 1;
$monitor("IN: %b ",a, "SEL: ",sel, " OUT: a: %b, b: %b", y, z);
end
endmodule