nand_gate.v
module nand_gate(a,b,y);
input a;
input b;
output y;
nand(y,a,b);
endmodule
tb_nand_gate.v
module tb_nand_gate;
reg a;
reg b;
wire y;
nand_gate UUT (.a(a), .b(b), .y(y));
initial begin
$display("Testing NAND gate");
a = 0; b=0;
#10;
$display("Input_A = %b, Input_B = %b, Output = %b", a,b,y);
a = 0; b=1;
#10;
$display("Input_A = %b, Input_B = %b, Output = %b", a,b,y);
a = 1; b=0;
#10;
$display("Input_A = %b, Input_B = %b, Output = %b", a,b,y);
a = 1; b=1;
#10;
$display("Input_A = %b, Input_B = %b, Output = %b", a,b,y);
$finish;
end
endmodule
The output waveform for nand gate will be as follows:
No comments:
Post a Comment