NOR GATE MODELLING METHODS:
Data Flow Modelling:
`timescale 1ns / 1ps module norGate(output z, input x,y); assign z= ~(x|y); endmodule
Behavioral Modeling:
`timescale 1ns / 1ps module norGate(output reg z, input x,y); always @ (x or y) begin if (x == 1'b0 & y == 1'b0) begin z = 1'b1; end else z = 1'b0; end endmodule
Gate Level Modelling:
`timescale 1ns / 1ps module norGate(output z, input x,y); nor(z, x, y); endmodule
TESTBENCH:
`timescale 1ns / 1ps module norGateTB(); reg tx,ty; wire tz; norGate 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("norGateTB.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