0% found this document useful (0 votes)
118 views

Sample Eda Lab (Part-A) Manual: Simulation Output

The document provides instructions and examples for writing lab reports for an EDA lab. It includes 7 experiments covering logic gates, encoders, decoders, multiplexers, converters and flip-flops. For each experiment, it provides the aim, hardware/software used, logic diagrams, truth tables, Verilog code, simulation outputs and results validating the code outputs. The instructions specify including a test bench in lab observations and records.

Uploaded by

mdzakir_hussain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views

Sample Eda Lab (Part-A) Manual: Simulation Output

The document provides instructions and examples for writing lab reports for an EDA lab. It includes 7 experiments covering logic gates, encoders, decoders, multiplexers, converters and flip-flops. For each experiment, it provides the aim, hardware/software used, logic diagrams, truth tables, Verilog code, simulation outputs and results validating the code outputs. The instructions specify including a test bench in lab observations and records.

Uploaded by

mdzakir_hussain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

SAMPLE EDA LAB(PART-A) MANUAL

By
Zakir Hussain
INSTRUCTIONS TO WRITE LAB OBSERVATION & LAB RECORD
1. YOU MUST FOLLOW THE WAY SHOWN IN THIS MANUAL
2. PLEAE NOTE, YOU MUST INCLUDE TEST BENCH(WHICH IS NOT
INCLUDED HERE) IN
i. Lab obsevation notes
ii. Lab record
3. IN PLACE OF SIMULATION OUTPUT(SEE IN THIS MANUAL), YOU HAVE TO
DRAW EXPECTED OUTPUT TIMING DIAGRAM
EXP:1- HDL CODE TO REALIZE ALL LOGIC GATES
AIM:
To develop the source code for logic gates by using VERILOG and obtain the simulation,
synthesis, place and route and implement into FPGA.
SOFTWARE & HARDWARE:
1. XILINX 8.2i
2. FPGA-SPARTAN-3E
LOGIC DIAGRAM:
AND GATE: OR GATE:
LOGIC DIAGRAM: TRUTH TABLE: LOGICDIAGRAM TRUTH TABLE:
NOT GATE: NAND GATE:
LOGIC DIAGRAM: TRUTH TABLE: LOGICDIAGRAM TRUTH TABLE
NOR GATE: XOR GATE:
LOGIC DIAGRAM: TRUTH TABLE: LOGICDIAGRAM TRUTH TABLE:
A B Y=A+B
0 0 0
0 1 1
1 0 1
1 1 1
A B Y=AB
0 0 0
0 1 0
1 0 0
1 1 1
A B Y=(AB)
0 0 1
0 1 1
1 0 1
1 1 0
A Y=A
0 0
0 1
A B Y=(A+B)
0 0 1
0 1 0
1 0 0
1 1 0
A B
0 0 0
0 1 1
1 0 1
1 1 0
DATE:
ZAKIR HUSSAIN 1
XNOR GATE:
LOGIC DIAGRAM: TRUTH TABLE:
VERILOG SOURCE CODE:
module logicgates1(a, b, c);
input a;
input b;
output [6:0] c;
assign c[0]= a & b;
assign c[1]= a | b;
assign c[2]= ~(a & b);
assign c[3]= ~(a | b);
assign c[4]= a ^ b;
assign c[5]= ~(a ^ b);
assign c[6]= ~ a;
endmodule
Simulation output:
RESULT:
Thus the OUTPUTs of all logic gates are verified by synthesizing and simulating the
VERILOG code.
A B
0 0 1
0 1 0
1 0 0
1 1 1
DATE:
ZAKIR HUSSAIN 2
EXP:2- DESIGN OF 8-TO-3 ENCODER
AIM:
To develop the source code for logic gates by using VERILOG and obtain the simulation,
synthesis, place and route and implement into FPGA.
SOFTWARE & HARDWARE:
1. XILINX 8.2i
2. FPGA-SPARTAN-3E
ENCODER:
LOGIC DIAGRAM: TRUTH TABLE:
VERILOG SOURCE CODE:
module encoderbehav(d, a,b,c);
input [7:0] d;
output a;
output b;
output c;
reg a,b,c;
always @ (d [7:0]) begin
a= d[4] | d[5] | d[6] | d[7];
b= d[2] | d[3] | d[6] | d[7];
c= d[1] | d[3] | d[5] | d[7];
end
endmodule
D0 D1 D2 D3 D4 D5 D6 D7 X Y Z
1 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 1 1
0 0 0 0 1 0 0 0 1 0 0
0 0 0 0 0 1 0 0 1 0 1
0 0 0 0 0 0 1 0 1 1 0
0 0 0 0 0 0 0 1 1 1 1
DATE:
ZAKIR HUSSAIN 3
Simulation output:
RESULT:
Thus the OUTPUTs of Encoded are verified by synthesizing and simulating the VERILOG
code.
DATE:
ZAKIR HUSSAIN 4
EXP:3-DESIGN OF 2-TO-4 DECODER
AIM:
To develop the source code for decoder by using VERILOG and obtain the simulation,
synthesis, place and route and implement into FPGA.
SOFTWARE & HARDWARE:
1. XILINX 8.2i
2. FPGA-SPARTAN-3E
LOGIC DIAGRAM: TRUTH TABLE:
VERILOG SOURCE CODE:
module decoderbehv(a, b, en, z);
input a;
input b;
input en;
output [3:0] z;
reg [3:0] z;
reg abar,bbar;
always @ (a,b,en) begin
z[0] = (abar&bbar&en);
z[1] = (abar&b&en);
z[2] = (a&bbar&en);
z[3] = (a&b&en);
end
endmodule
A B C Z(0) Z(1) Z(2) Z(3)
0 0 1 0 1 1 1
0 1 1 1 0 1 1
1 0 1 1 1 0 1
1 1 1 1 1 1 0
DATE:
ZAKIR HUSSAIN 5
Simulation output:
RESULT:
Thus the OUTPUTs of decoder are verified by synthesizing and simulating the VERILOG
code.
DATE:
ZAKIR HUSSAIN 6

EXP: 4-DESIGN OF MULTIPLEXER AND DEMULTIPLEXER
AIM:
To develop the source code for multiplexer and demultiplexer by using VERILOG and
obtain the simulation, synthesis, place and route and implement into FPGA.
SOFTWARE & HARDWARE:
1. XILINX 9.2i
2. FPGA-SPARTAN-3
MULTIPLEXER:
LOGIC DIAGRAM:
TRUTH TABLE:
VERILOG SOURCE CODE:
module mux_behv(d, s0, s1, y);
input [3:0] d;
input s0;
input s1;
output y;
reg y;
reg s0bar,s1bar;
reg p,q,r,s;
always@(d or s0 or s1)
begin
s0bar=~s0;s1bar=~s1;
p=(d[0]&s0bar&s1bar);
q=(d[1]&s0bar&s1);
SELECT
INPUT
OUTPUT
S1 S0 Y
0 0 D0
0 1 D1
1 0 D2
1 1 D3
DATE:
ZAKIR HUSSAIN 7


r=(d[2]&s0&s1bar);
s=(d[3]&s0&s1);
y=p | q |r |s;
end
endmodule
Simulation output:
DEMULTIPLEXER:
LOGIC DIAGRAM:
`
TRUTH TABLE:
INPUT OUTPUT
D S0 S1 Y0 Y1 Y2 Y3
1 0 0 1 0 0 0
1 0 1 0 1 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1
DATE:
ZAKIR HUSSAIN 8

Source Code:
module demux_behv(s0, s1,d, y, e);
input s0;
input s1;
input d,e;
output [3:0] y;
reg [3:0] y;
reg s0bar,s1bar;
always@(d or s0 or s1)
begin
s0bar=~s0;
s1bar=~s1;
y[0]=(d&s0bar&s1bar&e);
y[1]=(d&s0bar&s1&e);
y[2]=(d&s0&s1bar&e);
y[3]=(d&s0&s1&e);
end
endmodule
Simulation output:
RESULT:
Thus the OUTPUTs of Multiplexers and Demultiplexers are verified by synthesizing and
simulating the VERILOG code.
DATE:
ZAKIR HUSSAIN 9

EXP:5-DESIGN OF 4-BIT BINARY TO GRAY CONVERTER
AIM:
To develop the source code for binary to gray converter by using VERILOG and obtained
the simulation, synthesis, place and route and implement into FPGA.
SOFTWARE & HARDWARE:
1. XILINX 8.2i
2. FPGA-SPARTAN-3E
CODE CONVERTER (BCD TO GRAY):
TRUTH TABLE:
BCD GRAY
0000 0000
0001 0001
0010 0011
0011 0010
0100 0110
0101 0111
0110 0101
0111 0100
1000 1100
1001 1101
LOGIC DIAGRAM:
Behavioral Modeling:
module b2g_behv(b, g);
input [3:0] b;
output [3:0] g;
reg [3:0] g;
DATE:
ZAKIR HUSSAIN 10

always@(b) begin
g[3]=b[3];
g[2]=b[3]^b[2];
g[1]=b[2]^b[1];
g[0]=b[1]^b[0];
end
endmodule
Simulation output:
RESULT:
Thus the OUTPUTs of binary to gray converter are verified by synthesizing and simulating
the VERILOG code.
DATE:
ZAKIR HUSSAIN 11

EXP: 6-DESIGN OF FULL ADDER USING THREE MODELLING STYLES
AIM:
To develop the source code for full adder using three modeling styles by using VERILOG
and obtained the simulation, synthesis, place and route and implement into FPGA.
SOFTWARE & HARDWARE:
1. XILINX 8.2i
2. FPGA-SPARTAN-3E
FULL ADDER:
LOGIC DIAGRAM: TRUTH TABLE:
VERILOG SOURCE CODE:
Dataflow Modeling:
module fulladddataflow(a, b, c, sum, carry);
input a;
input b;
input c;
output sum;
output carry;
assign#2 p=a&b;
assign#2 q=b&c;
assign#2 r=c&a;
assign#4 sum=a^b^c;
assign#4carry =(p1 | p2) | p3;
endmodule
A B C SUM CARRY
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
DATE:
ZAKIR HUSSAIN 12

Behavioral Modeling:
module fuladbehavioral(a, b, c, sum, carry);
input a;
input b;
input c;
output sum;
output carry;
reg sum,carry;
reg p1,p2,p3;
always @ (a or b or c) begin
sum = (a^b)^c;
p1=a & b;
p2=b & c;
p3=a & c;
carry=(p1 | p2) | p3;
end
endmodule
Structural Modeling:
module fa_struct(a, b, c, sum, carry);
input a;
input b;
input c;
output sum;
output carry;
wire t1,t2,t3,s1
xor
x1(t1a,b),
x2(sum,s1,c);
and
a1(t1,a,b),
a2(t2,b,c),
a3(t3,a,c);
or
o1(carry,t1,t2,t3);
endmodule
DATE:
ZAKIR HUSSAIN 13

Simulation output:
RESULT:
Thus the OUTPUTs of full adder using three modeling styles are verified by synthesizing
and simulating the VERILOG code.
DATE:
ZAKIR HUSSAIN 14
EXP:7-DESIGN OF FLIP FLOPS (SR,JK,D)
AIM:
To develop the source code for FLIP FLOPS by using VERILOG and obtained the
simulation, synthesis, place and route and implement into FPGA.
SOFTWARE & HARDWARE:
1. XILINX 8.2i
2. FPGA-SPARTAN-3E
SR FLIPFLOP:
LOGIC DIAGRAM: TRUTH TABLE:
VERILOG SOURCE CODE:
Behavioral Modeling:
module srflipflop(s, r, clk, rst, q, qbar);
input s;
input r;
input clk;
input rst;
output q;
output qbar;
reg q,qbar;
always @ (posedge(clk) or posedge(rst)) begin
if(rst==1'b1) begin
q= 1'b0;qbar= 1'b1;
end
else if(s==1'b0 && r==1'b0)
begin
q=q; qbar=qbar;
end
Q(t) S R Q(t+1)
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 X
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 X
DATE:
ZAKIR HUSSAIN 15
else if(s==1'b0 && r==1'b1)
begin
q= 1'b0; qbar= 1'b1;
end
else if(s==1'b1 && r==1'b0)
begin
q= 1'b1; qbar= 1'b0;
end
else
begin
q=1'bx;qbar=1'bx;
end
end
endmodule
Simulation output:
JK FLIPFLOP:
LOGIC DIAGRAM: TRUTH TABLE:
Q(t) J K Q(t+1)
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0
DATE:
ZAKIR HUSSAIN 16

VERILOG SOURCE CODE:
Behavioral Modeling:
module jkff(j, k, clk, rst, q, qbar);
input j;
input k;
input clk;
input rst;
output q;
output qbar;
reg q;
reg qbar;
always @ (posedge(clk) or posedge(rst)) begin
if (rst==1'b1)
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'b0 && k==1'b1)
begin
q=1'b0;
qbar=1'b1;
end
else if (j==1'b1 && k==1'b0)
begin
q=1'b1;
qbar=1'b0;
end
else
begin
q=~q;
qbar=~qbar;
end
end
endmodule
DATE:
ZAKIR HUSSAIN 17

Simulation output:
D FLIPFLOP:
LOGIC DIAGRAM: TRUTH TABLE:

VERILOG SOURCE CODE:
Behavioral Modeling:
module dff(d, clk, rst, q, qbar);
input d;
input clk;
input rst;
output q;
output qbar;
reg q;
reg qbar;
always @ (posedge(clk) or posedge(rst)) begin
if (rst==1'b1)
begin
q=1'b0;
qbar=1'b1;
end
else if (d==1'b0)
begin
q=1'b0;
qbar=1'b1;
end
else
Q(t) D Q(t+1)
0 0 0
0 1 1
1 0 0
1 1 1
DATE:
ZAKIR HUSSAIN 18
begin
q=1'b1;
qbar=1'b0;
end
end
endmodule
Simulation output:
RESULT:
Thus the OUTPUTs of Flip flops using three modeling styles are verified by synthesizing
and simulating the VERILOG code.
DATE:
ZAKIR HUSSAIN 19

You might also like