Lab 1 Introduction To Verilog HDL: Vetal Akshay Pandit (SC13B125)
Lab 1 Introduction To Verilog HDL: Vetal Akshay Pandit (SC13B125)
Lab 1
Introduction to Verilog HDL
Vetal Akshay Pandit
(SC13B125)
Sub - Verilog HDL lab
----------------------------------------------------------------------------------------------Question 1:
Implement all logic gates using verilog HDL
Program code:
module gates (o1,o2,o3,o4,o5,o6,o7,x,y);
input x,y;
output o1,o2,o3,o4,o5,o6,o7;
assign o1=x&y;
assign o2=x^y;
assign o3=x|y;
assign o4=~x;
assign o5=~(x&y);
assign o6=~(x|y);
assign o7=x~^y;
endmodule
Question 2:
Implement Half adder using Verilog HDL
Program Code :
module adder (s,c,a,b);
input a,b;
output s,c;
assign s=a^b;
assign c=a&b;
endmodule
Question 3:
Implement Full adder using Verilog HDL
Program Code:
module FullAdder (s,c,x,y,z);
input x,y,z;
output s,c;
assign s=x^y^z;
assign c=((x^y)&z)|(x&y);
endmodule
Question 4:
Implement Full subtractor using Verilog HDL
Program Code:
module FullSubtractor (s,c,x,y,z);
input x,y,z;
output s,c;
assign s=x^y^z;
assign c=(~x&(y^z))|(y&z);
endmodule
Question 5:
Implement Gray to Binary converter using Verilog HDL
Program Code:
module GreytoBinary (w,x,y,z,a,b,c,d);
input w,x,y,z;
output a,b,c,d;
assign a=w;
assign b=w^x;
assign c=b^y;
assign d=c^z;
endmodule