Professional Documents
Culture Documents
Laboratory No.2
Verilog Model Components
A. Run the additional logic gate operation to learn the software in Verilog HDL. Simulate
the operation of Logic Gates using Verilog.
Logic Gates Logic Symbol Boolean Expression Logic gate primitive code
module NOT_gate(a,x);
1. NOT Gate input a;
Q = A’ output x;
not(a,x);
endmodule
module OR_gate(x,a,b);
2. OR gate input a,b;
output y;
Q = A+B or(x,a,b);
endmodule
module NAND_gate(x,a,b);
3. NAND gate input a,b;
output x;
Q = (A.B)’ nand(x,a,b);
endmodule
module NOR_gate(x,a,b);
4. NOR gate input a,b;
output x;
Q =(A+B)’ nor(x,a,b);
endmodule
module XOR_gate(x,a,b);
5. XOR gate input a,b;
output x;
Q = A⊕B xor(x,a,b);
endmodule
module XNOR_gate(x,a,b);
6. XNOR gate input a,b;
output x;
Q =(A⊕B)’ xnor(x,a,b);
endmodule
B. Create appropriate Test Bench for each Verilog code.
Note: To verify if the result is correct, get the truth table of each logic gate.
1. NOT Gate
2. OR gate
3. NAND gate
4. NOR gate
5. XOR gate
6. XNOR gate