NOR GATE MODELING USING NAND GATES:
`timescale 1ns / 1ps module norUsingNand(output z, input x,y); wire w1,w2,w3; nand (w1,x,x); nand (w2,y,y); nand (w3,w2,w1); nand (z,w3,w3); endmodule
TESTBENCH:
`timescale 1ns / 1ps module norUsingNandTB(); reg tx,ty; wire tz; norUsingNand DUT(.z(tz),.x(tx),.y(ty)); initial begin tx=0;ty=0; #2 tx=0;ty=1; #2 tx=1;ty=0; #2 tx=1;ty=1; #2 $finish; end initial begin $monitor ($time, " tx=%d, ty=%d, tz=%d",tx,ty,tz); end initial begin $dumpfile("norUsingNandTB.vcd"); $dumpvars; end endmodule
Output:
0 tx=0, ty=0, tz=1 2 tx=0, ty=1, tz=0 4 tx=1, ty=0, tz=0 6 tx=1, ty=1, tz=0