nor_gate.v
module nor_gate(a,b,y);
input a;
input b;
output y;
nor(y,a,b);
endmodule
tb_nor_gate.v
module tb_nor_gate;
reg a;
reg b;
wire y;
nor_gate UUT (.a(a), .b(b), .y(y));
initial begin
$display(“Testing NOR 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 nor gate will be as follows:
No comments:
Post a Comment