Week6 Lab Program Ade Co
Week6 Lab Program Ade Co
assign y = ~a;
endmodule
Truth table
Input a Output y
0 1
1 0
2. AND Gate
//AND gate using data flow modeling
module and_gate_d(a,b,y);
input a,b;
output y;
assign y = a & b;
endmodule
Truth table
3. OR Gate
//OR gate using data flow modeling
module or_gate_d(a,b,y);
input a,b;
output y;
assign y = a | b;
endmodule
Truth table
4. NAND Gate
//NAND gate using data flow modeling
module nand_gate_d(a,b,y);
input a,b;
output y;
assign y = ~(a & b);
endmodule
Truth table
0 0 1
0 1 1
1 0 1
1 1 0
5. NOR Gate
//NOR gate using data flow modeling
module nor_gate_d(a,b,y);
input a,b;
output y;
endmodule
Truth table
6. EX-OR Gate
//EX-OR gate using data flow modeling
module xor_gate_d(a,b,y);
input a,b;
output y;
assign y = a ^ b;
endmodule
Truth table
0 0 0
0 1 1
1 0 1
1 1 0
7. EX-NOR Gate
//EX-NOR gate using data flow modeling
module xnor_gate_d(a,b,y);
input a,b;
output y;
endmodule
Truth table
Input a Input b Output y
0 0 1
0 1 0
1 0 0
1 1 1