1 - Updated - Ecad Lab Manual
1 - Updated - Ecad Lab Manual
E-CAD LABORATORY
MANUAL
2
EXPERIMENT-1
AIM: To Design all gates using Verilog and Simulate the design.
VERILOG CODE:
output nand_out;
output nor_out;
output xor_out;
output xnor_out;
not g1(notA_out,a);
not g2(notB_out,b);
and g3(and_out,a,b);
or g4(or_out,a,b);
nand g5(nand_out,a,b);
nor g6(nor_out,a,b);
xor g7(xor_out,a,b);
xnor g8(xnor_out,a,b);
endmodule
3
RESULT:
4
EXPERIMENT-2
AIM: To Design the 2x4 Decoder using Verilog and Simulate the design.
VERILOG CODE:
wire not_i1,not_i2;
assign not_i1=~i1;
assign not_i2=~i2;
endmodule
RESULT:
5
EXPERIMENT-3
AIM: To Design the 4x2 encoder (with and without priority) using Verilog and Simulate the
design.
VERILOG CODE:
Without Priority:
module encoder4x2(in,reset,clock,out);
input [3:0] in;
input clock,reset;
output [1:0] out;
reg [1:0] out;
always @(posedge clock)
if (reset)
out <= 2'b00;
else
case (in)
4'b0001 : out <= 2'b00;
4'b0010 : out <= 2'b01;
4'b0100 : out <= 2'b10;
4'b1000 : out <= 2'b11;
default : out <= 2'b00;
endcase
endmodule
6
With Priority:
module priority_encoder4x2(in,reset,clock,out);
input clock,reset;
if (reset)
else
casex (in)
endcase
endmodule
RESULT:
Encoder
Priority Encoder
7
EXPERIMENT-4
AIM: To Design the 8x1 Multiplexer using Verilog and Simulate the design.
VERILOG CODE:
module Mux8x1(in1,in2,in3,in4,in5,in6,in7,in8,sel3,out);
input in1,in2,in3,in4,in5,in6,in7,in8;
input [2:0] sel3;
output out;
reg out;
always @(sel3,in1,in2,in3,in4,in5,in6,in7,in8)
case (sel3)
3'b000: out = in1;
3'b001: out = in2;
3'b010: out = in3;
3'b011: out = in4;
3'b100: out = in5;
3'b101: out = in6;
3'b110: out = in7;
3'b111: out = in8;
endcase
endmodule
RESULT:
8
EXPERIMENT-5
AIM: To Design the 4-bit binary to gray code using Verilog and Simulate the Design.
VERILOG CODE:
assign gray_out[3]=bin_in[3];
assign gray_out[2]=bin_in[3]^bin_in[2];
assign gray_out[1]=bin_in[2]^bin_in[1];
assign gray_out[0]=bin_in[1]^bin_in[0];
endmodule
RESULT:
9
EXPERIMENT-6
AIM: To Design the comparator using Verilog and Simulate the design.
VERILOG CODE:
Comparator
input [7:0] A;
input [7:0] B;
output Comp;
endmodule
RESULT:
10
EXPERIMENT-7
AIM: To Design the fulladder using Verilog and Simulate the Design.
VERILOG CODE:
input a;
input b;
input c;
output sum;
output carry;
assign sum = a ^ b ^ c;
endmodule
RESULT:
11
EXPERIMENT-8
AIM: To Design all the SR, D, T, JK flipflops using Verilog and Simulate the Design.
VERILOG CODE:
SR Flipfloop:
input S, reset;
input R;
input clock;
output Q,Qbar;
reg Q,Qbar;
always@(posedge clock)
if (reset)
begin
Q<=1'b0;
Qbar<=1'b1;
end else
begin
Q<=Q;
Qbar<=Qbar;
end else
begin
Q<=1'b1;
Qbar<=1'b0;
end else
E-CAD & VLSI LAB 12
begin
Q<=1'b0;
Qbar<=1'b1;
end else
begin
Q<=1'bx;
Qbar<=1'bx;
end
endmodule
D Flipfloop:
input D;
output Q;
input reset;
input clock;
reg Q;
always@(posedge clock)
if(reset)
Q<=1'b0;
else
Q<=D;
endmodule
E-CAD & VLSI LAB 13
JK Flipfloop:
output Q;
output Qbar;
reg Q, Qbar;
always@(posedge clock)
if (reset)
begin
Q<=1'b0;
Qbar<=1'b1;
end else
if (j==1'b0 && k==1'b0)
begin
Q<=Q;
Qbar<=Qbar;
end else
if (j==1'b1 && k==1'b0)
begin
Q<=1'b1;
Qbar<=1'b0;
end else
if (j==1'b0 && k==1'b1)
begin
E-CAD & VLSI LAB 14
Q<=1'b0;
Qbar<=1'b1;
end else
if (j==1'b1 && k==1'b1)
begin
Q<=~Q;
Qbar<=~Qbar;
end
endmodule
T Flipfloop:
input T;
output Q;
input clock;
input reset;
reg Q;
always@(posedge clock)
if(reset)
Q<=1'b0;
else
if (!T)
Q<=Q;
else
Q<=~Q;
endmodule
E-CAD & VLSI LAB 15
RESULT:
SR FlipFlop
D FlipFlop
JK FlipFlop
T FlipFlop
VLSI LAB 1
EXPERIMENT- 1
AIM: To design and simulate the CMOS inverter and perform LVS.
CIRCUIT DIAGRAM:
PROCEDURE:
VLSI LAB 2
LAYOUT:
VLSI LAB 3
RESULT:
VLSI LAB 4
EXPERIMENT- 2
AIM: To design and simulate the CMOS NAND gate and perform LVS.
CIRCUIT DIAGRAM:
VLSI LAB 5
PROCEDURE:
LAYOUT:
RESULT:
VLSI LAB 7
EXPERIMENT- 3
AIM: To design and simulate the CMOS NOR gate and perform LVS.
CIRCUIT DIAGRAM:
VLSI LAB 8
PROCEDURE:
LAYOUT:
RESULT:
VLSI LAB 10
EXPERIMENT- 4
AIM: To design and simulate the CMOS AND gate and perform LVS.
CIRCUIT DIAGRAM:
VLSI LAB 11
PROCEDURE:
LAYOUT:
RESULT: