Logic Gates Verilog Models
Logic Gates Verilog Models
DATAFLOW MODEL:
STRUCTURAL MODEL:
Module logicgates (a,b,andout,nandout,orout,norout,xorout,xnorout,notout,bufout);
input a,b;
output andout,nandout,orout,norout,xorout,xnorout,notout,bufout;
and a1 (andout,a,b);
nand a2 (nandout,a,b);
or a3 (orout,a,b);
nor a4 (norout,a,b);
xor a5 (xorout,a,b);
xnor a6 (xnorout,a,b);
not a7 (notout,a);
buf a8 (bufout,a);
endmodule
TESTBENCH:
module logicgates_tb;
// Inputs
reg a;
reg b;
// Outputs
wire [7:0] y;
// Instantiate the Unit Under Test (UUT)
logicgates uut (
.a(a),
.b(b),
.y(y)
);
initial begin
// Initialize Inputs
a = 0;b = 0;
#10 a = 0;b = 1;
#10 a = 1; b = 0;
#10 a = 1; b = 1;
// Wait 100 ns for global reset to finish
#100;
// Add stimulus here
end
initial #100 $stop;
endmodule