module test_Nand_Latch_1;
reg preset,clear;
wire q,qbar;
Nand_Latch_1 K1(q,qbar,preset,clear);
initial
begin
$monitor($time,"preset=%b clear==%b q=%b qbar=%b",preset,clear,q,qbar);
end
initial
begin
#10 preset=0;clear=1;
#10 preset=1;$stop;
#10 clear=0;
#10 clear=1;
#10 preset=0;
end
initial
#60 $finish;
endmodule
module Nand_Latch_1(q,qbar,preset,clear);
output q,qbar;
input preset,clear;
nand G1(q,preset,qbar),
G2(qbar,clear,q);
endmodule
沒有留言:
張貼留言