Professional Documents
Culture Documents
Prepared by
Mr. Sandeep
Assistant Professor
JUNE 2018
EMBEDDED LAB MANUAL R18 & R20
Vision
The Electronics & Communication Engineering department intends to be a leader in
creating the high quality engineers in the field of electronics and associated
technologies to cater to national and global technological needs promoting the human
prosperity and wellbeing.
Mission
Providing an infrastructural and conducive environment to the students, faculty and
researchers for attaining domain knowledge and expertise in electronics &
communication engineering.
Enable the students to develop into outstanding professionals with high ethical standards
capable of creating, developing and managing global engineering enterprises.
Inculcate the spirit of lifelong learning by interacting with outside world and strengthen
professional, communication skills.
Quality Policy
Our policy is to nurture and build diligent and dedicated community of engineers
providing a professional and unprejudiced environment, thus justifying the purpose of
teaching and satisfying the stake holders.
A team of well qualified and experienced professionals ensure quality education with
its practical application in all areas of the Institute.
Philosophy
The essence of learning lies in pursuing the truth that liberates one from the darkness
of ignorance and Institute of Vidya Jyothi Institute of Technology firmly believes that
education is for liberation. Contained therein is the notion that engineering education
includes all fields of science that plays a pivotal role in the development of world-
wide community contributing to the progress of civilization. This institute, adhering to
the above understanding, is committed to the development of science and technology
in congruence with the natural environs. It lays great emphasis on intensive research
and education that blends professional skills and high moral standards with a sense of
individuality and humanity. We thus promote ties with local communities and
encourage transnational interactions in order to be socially accountable. This
accelerates the process of transfiguring the students into complete human beings
making the learning process relevant to life, instilling in them a sense of courtesy and
responsibility.
3. Students have to bring the lab manual cum observation book, record etc along
with them whenever they come for lab work.
4. Should take only the lab manual, calculator (if needed) and a pen or pencil to the
work area.
5. Should learn the prelab questions. Read through the lab experiment to familiarize
themselves with the components and assembly sequence.
6. Should utilize 3 hours’ time properly to perform the experiment and to record the
readings. Do the calculations, draw the graphs and take signature from the
instructor.
7. If the experiment is not completed in the stipulated time, the pending work has to
be carried out in the leisure hours or extended hours.
8. Should submit the completed record book according to the deadlines set up by the
instructor.
9. For practical subjects there shall be a continuous evaluation during the semester
for 25 seasonal marks and 50 end examination marks.
10. Out of 25 internal marks, 15 marks shall be awarded for day-to-day work and 10
marks to be awarded by conducting an internal laboratory test.
LAB SYLLABUS
VLSI LABORATORY
In our Lab, the scope is limited to design and analyze the design using test benches &
simulation.
The following is the step by step procedure to design in the Xilinx ISE:
2. Continue to the next window and check if preferred language is selected as” verilog”
3. Proceed by clicking „Next‟ and create a „New Source‟ using the „Create New
Source‟Window
4. Select the source type as „Verilog Module‟ and input a filename and proceed
to „Next‟.In the next window „Define Module‟ enter the ports.
5. Finish with the New project setup with the „Summary‟ window.
11. Double click on implement design, it turns green (in color) once
the design isimplemented successfully and the Summary report
is displayed.
To add a test-bench to the existing design, right click on the „.v‟ file from
the Hierarchywindow and select „New Source‟
13. Select „Verilog Text Fixture‟ from the Select Source Type and name the Test-Bench
15. Edit the test bench as per your simulation requirements and select
„Behavioral Simulation‟ in the „Design Window‟. In the Processes window
Isim Simulator would be displayed. First Proceed with the Behavioral Check
Syntax
16. D
o
u
b
l
e
c
l
i
c
k
o
n
„ 17. Then double click on „Simulate Behavioral Model‟ and the ISIM
B simulator windowwould open. Check for the outputs
e
h
a
v
i
o
r
a
l
C
h
17e DEPT of ECE, VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75
c
k
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.
1. XILINX 7.1i
LOGIC DIAGRAM:
A B Y=AB A B Y=A+B
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
A B Y=(A+B)’
A B
0 0 1
0 1 0 0 0 0
1 0 0 0 1 1
1 1 0
1 0 1
1 1 0
module logicgates1(a,b,and1,or1,nand1,nor1,xor1,xnor1,not1);
input a;
input b;
output and1,or1,nand1,nor1,xor1,xnor1,not1;
assign and1=a&b;
assign or1=a|b;
assign nand1=~(a&b);
assign nor1=~(a|b);
assign xor1=a^b;
assign xnor1=~(a^b);
assign not1=~a;
endmodule
TEST BENCH:
module tb_logicgates();
reg a,b;
wire and1,or1,nand1,nor1,xor1,xnor1,not1;
logicgates dut
(.a(a),.b(b),.and1(and1),.or1(or1),.nand1(nand1),.nor1(nor1),.xor1(xor1),.xnor1(xnor1),.not1(not1)
);
initial
begin
a=1'b0;
b=1'b0;
#10
a=1'b0;
b=1'b1;
#10
a=1'b1;
b=1'b0;
#10
a=1'b1;
b=1'b1;
end
initial
begin
$monitor("%time,a=%b,b=%b,and1=%b,or1=%b,nand1=%b,nor1=%b,xor1=%b,xnor1=%b,not1=
%b",$time,a,b,and1,or1,nand1,nor1,xor1,xnor1,not1);
end
endmodule
RESULT:
AIM: To develop the source code for De margan’s theorem by using verilog code and
obatain simulation and synthesis report
Circuit Diagram:
Truth Table:
Aim: The purpose of this experiment is to write and simulate a VERILOG program
for Multiplexers
XILINX 7.1i
Theory:
Multiplexer is a special type of combinational circuit. There are n-data inputs, one output and m
select inputs with 2m = n. It is a digital circuit which selects one of the n data inputs and routes it
to the output. The selection of one of the n inputs is done by the selected inputs. Depending on the
digital code applied at the selected inputs, one out of n data sources is selected and transmitted to
the single output Y. E is called the strobe or enable input which is useful for the cascading. It is
generally an active low terminal that means it will perform the required operation when it is low.
LOGIC DIAGRAM:
modulemux81str(i0,i1,i2,i3,i4,i5,i6,i7,s0, s1,s2,y);
input i0,i1,i2,i3,i4,i5,i6,i7,s0,s1,s2; wire a,b,c,d,e,f,g,h;
output y;
and g1(a,i7,s0,s1,s2);
and g2(b,i6,(~s0),s1,s2);
and g3(c,i5,s0,(~s1),s2);
and g4(d,i4,(~s0),(~s1),s2);
and g5(e,i3,s0,s1,(~s2));
and g6(f,i2,(~s0),s1,(~s2));
and g7(g,i1,s0,(~s1),(s2));
and g8(h,i0,(~s0),(~s1),(~s2));
or(y,a,b,c,d,e,f,g,h);
endmodule
Aim: The purpose of this experiment is to write verilog code and simulate a
VERILOG program for De-Multiplexers
XILINX 7.1i
Theory:
A demultiplexer performs the reverse operation of a multiplexer i.e. it receives one input and
distributes it over several outputs. It has only one input, n outputs, m select input. At a time only
one output line is selected by the select lines and the input is transmitted to the selected output line.
Logic Diagram:
Aim: The purpose of this experiment is to write verilog code and simulate a VERILOG
program for De-Multiplexers
SOFTWARE & HARDWARE:
XILINX 7.1i
Theory:
An Encoder is a combinational circuit that performs the reverse operation of Decoder. It has
maximum of 2n input lines and ‘n’ output lines. It will produce a binary code equivalent to
the input, which is active High. Therefore, the encoder encodes 2n input lines with ‘n’ bits. It
is optional to represent the enable signal in encoders
Circuit diagram:
Test Bench:
Simulation Results:
Synthesis Results:
AIM : To develop the source code for Comparator by using VERILOG and obtained the
simulation, synthesis.
Components used:
1 Xilinx ISE 7.1i Tool
4 BIT COMPARATOR:
A=B 1 0 0
A>B 0 0 1
SOURCE CODE:
TEST BENCH:
module tb_comparator();
reg [3:0]a;
reg [3:0]b;
wire x,y,z;
comparator dut (.a(a),.b(b),.x(x),.y(y),.z(z));
initial
begin
a=4'b0000;
b=4'b0100;
#10
a=4'b0100;
b=4'b0100;
#10
a=4'b0100;
b=4'b0000;
end
initial
begin
$monitor("%t,a=%b,b=%b,x=%b,y=%b,z=%b",$time,a,b,x,y,z);
end
endmodule
Simulation Results:
RESULT:
Thus the OUTPUT of Comparator are verified by synthesizing and simulating the
VERILOG code
AIM : To develop the source code for code converters by using VERILOG and obtained the
simulation, synthesis, place and route and implement into FPGA.
TRUTH TABLE:
BINA GRAY
RY
0000 0000 LOGIC DIAGRAM:
0001 0001
0010 0011
0011 0010
0100 0110
0101 0111
0110 0101
0111 0100
1000 1100
1001 1101
1010 1111
1011 1110
1100 1010
1101 1011
1110 1001
1111 1000
SOURCE CODE:
module binary2gray(b,g);
input [3:0] b;
output [3:0] g;
assign g[3]=b[3];
assign g[2]=b[3]^b[2];
assign g[1]=b[2]^b[1];
assign g[0]=b[1]^b[0];
endmodule
TEST BENCH:
module tb_binary2gray();
reg [3:0]b;
RESULT: Thus the OUTPUT’s of Code converters are verified by synthesizing and
simulating the VERILOG code
AIM : To develop the source code for code full adder by using VERILOG and obtained the
simulation, synthesis, place and route and implement into FPGA.
FULL ADDER:
LOGIC DIAGRAM: TRUTH TABLE:
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
SOURCE CODE: 1 1 1 1 1
module fulladdder(a, b, c, s, ca);
input a;
input b;
input c;
output s;
output ca;
wire p,q,r;
assign p=a&b;
assign q=b&c;
assign r=c&a;
assign s=a^b^c;
assign ca =(p|q|r);
endmodule
TEST BENCH:
module tb_fulladdder();
reg a,b,c;
wire s,ca;
fulladdder dut (.a(a),.b(b),.c(c),.s(s),.ca(ca));
initial
begin
a=1'b0;
b=1'b0;
c=1'b0;
#10
a=1'b0;
b=1'b0;
Simulation results:
RESULT:
Thus the OUTPUT’s of Full Adders is verified by synthesizing and simulating the
VERILOG code.
I A. SR FLIPFLOP:
LOGIC DIAGRAM TRUTH TABLE:
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
SOURCE CODE:
module srflipflop(s,r,clk,clr,q,qbar);
input s;
input r;
input clk;
input clr;
output q;
output qbar;
reg q,qbar;
always@(posedge(clk) or posedge(clr))
begin
if(clr==1'b1)
begin
q=1'b0;qbar=~q;
end
else if(s==1'b0 && r==1'b0)
begin
q=q; qbar=~q;
end
else if(s==1'b0 && r==1'b1)
begin
RESULT: Thus the OUTPUT’s of Flip Flops are verified by synthesizing and simulating the
VERILOG code
Theory:
Flip-flops are synchronous bitable devices. The term synchronous means the output
changes state only when the clock input is triggered. That is, changes in the output occur
in synchronization with the clock. Lab Manual/CSE 27 A flip-flop circuit has two
outputs, one for the normal value and one for the complement value of the stored bit.
Since memory elements in sequential circuits are usually flip-flops, it is worth
summarizing the behavior of various flip-flop types before proceeding further. All flip-
flops can be divided into four basic types: SR, JK, D and T. They differ in the number of
inputs and in the response invoked by different value of input signals. The four types of
flip-flops are defined in the Table 5.1. Each of these flip-flops can be uniquely described
by its graphical symbol, its characteristic table, its characteristic equation or excitation
table. All flip-flops have output signals Q and Q'
Logic Diagram
T Flip Flop
D Flip Flop
Behavioral Modelling Dataflow Modelling Structural Modelling
Module dff_async_reset( data, clk, module dff_df(d,c,q,q1); module
reset ,q ); input d,c; dff_df(d,c,q,q1)
input data, clk, reset ; output q,q1; ; input d,c;
output q; assign w1=d&c; output
reg q; assign w2=~d&c; q,q1;
always @ ( posedgeclk or negedge q=~(w1|q1); and
reset) q1=~(w2|q); g1(w1,
if (~reset) begin endmodule d,c);
q <= 1'b0; and g2(w2,~d,c);
end nor g3(q,w1,q1);
else begin nor
q <= data; g4(q1,w
end 2,q);
endmodule endmod
ule
T Flip Flop
Structural Modelling Dataflow Modelling
Behavioral Modelling
We will supply a 1Khz clock signal to the first T Flip Flop, and the rest of the three Flip Flops
will have their clocks from the output (Q) of the previous Flip Flop. The circuit contains 4 T
Flip Flops because we need 4 bit Ripple Counter. T1 has its clock supplied by a Digital source
of 1Khz, and the rest of Flip Flops used previous Flip Flop output as the clock. Input T of all T
flip flops is HIGH (1) so that T Flip Flop toggles input on every clock edge.
Process: We will design the program in Structural modelling. We will do three modules to
implement this counter. The first module is to implement the main program. The second
module is used to implement T flip flop logic and the third to implement D Flip Flop logic.
Program: Save the file separately as DFF, ripple,
module dff (input d,
input clk,
input rstn,
output reg q,
output qn);
always @ (posedge clk or negedge rstn)
if (!rstn)
q <= 0;
else
q <= d;
assign qn = ~q;
endmodule
Simulation Results:
Results:
Process: Modulus counter counts till N-1 one values of the count value specified. Suppose we
design a MOD 10 counter, the counter counts from 0 to 9 and resets to 0 and the process
continues.
Program:
module modN_ctr
# (parameter N = 10,
parameter WIDTH = 4)
( input clk,
input rstn,
output reg[WIDTH-1:0] out);
always @ (posedge clk) begin
if (!rstn) begin
out <= 0;
end else begin
if (out == N-1)
out <= 0;
else
out <= out + 1;
end
end
endmodule
Simulation Results:
Results
In Moore machine, the outputs depend on states only, therefore it is ‘synchronous machine’ and
the output is available after 1 clock cycle . Whereas, in Mealy machine output depends on states
along with external inputs; and the output is available as soon as the input is changed therefore it
is ‘asynchronous machine’
Mealy machine requires fewer number of states as compared to Moore machine
Moore machine should be preferred for the designs, where glitches are not the problem in the
systems.
Mealy machines are good for synchronous systems which requires ‘delay-free and glitch-free’
system, but careful design is required for asynchronous systems. Therefore, Mealy machine can
be complex as compare to Moore machine.
Edge detector design using Moore Machine Edge detector design using Mealy Machine
The state diagrams for Mealy and Moore designs respectively. In the output of the system is set to 1,
whenever the system is in the state ‘zero’ and value of the input signal ‘level’ is 1; i.e. output depends on
both the state and the input. Whereas in second diagram, the output is set to 1 whenever the system is in
the state ‘edge’ i.e. output depends only on the state of the system.
module edgeDetector
(
input wire clk, reset,
input wire level,
output reg Mealy_tick, Moore_tick
);
// Mealy Design
always @(stateMealy_reg, level)
begin
// store current state as next
stateMealy_next = stateMealy_reg; // required: when no case statement is satisfied
Mealy_tick = 1'b0; // set tick to zero (so that 'tick = 1' is available for 1 cycle only)
case(stateMealy_reg)
zeroMealy: // set 'tick = 1' if state = zero and level = '1'
if(level)
begin // if level is 1, then go to state one,
// Moore Design
always @(stateMoore_reg, level)
begin
// store current state as next
stateMoore_next = stateMoore_reg; // required: when no case statement is satisfied
Moore_tick = 1'b0; // set tick to zero (so that 'tick = 1' is available for 1 cycle only)
case(stateMoore_reg)
zeroMoore: // if state is zero,
if(level) // and level is 1
stateMoore_next = edgeMoore; // then go to state edge.
edgeMoore:
begin
Moore_tick = 1'b1; // set the tick to 1.
if(level) // if level is 1,
stateMoore_next = oneMoore; // go to state one,
else
stateMoore_next = zeroMoore; // else go to state zero.
end
oneMoore:
if(~level) // if level is 0,
stateMoore_next = zeroMoore; // then go to state zero.
endcase
end
endmodule
Simulation Results:
It can be seen that output-tick of Mealy detector is generated as soon as the ‘level’ goes to 1,
whereas Moore design generate the tick after 1 clock cycle. These two ticks are shown with the
help of the two red cursors in the figure. Since, output of Mealy design is immediately available
therefore it is preferred for synchronous designs.
AIM: To develop the source code for basic logic gates by using VERILOG in switch level
design and obtain the simulation.
Components used: 1. Xilinix 7.1
LOGIC DIAGRAM:
12. A .NOT GATE
TRUTH TABLE:
A Y=A’
0 1
1 0
SOURCE CODE:
module swinv(in , out);
input in;
output out;
supply1 pwr;
supply0 gnd;
pmos(out,pwr,in);
nmos(out,gnd,in);
endmodule
Simulation output:
12.B.NAND GATE:
LOGIC DIAGRAM:
TRUTH TABLE:
A B Y=(AB)’
0 0 1
0 1 1
1 0 1
1 1 0
Simulation output:
SOURCE CODE:
Simulation output:
A B Y=(A+B)’
0 0 1
0 1 0
1 0 0
1 1 0
SOURCE CODE:
Simulation output:
A B Y=(A+B)’
0 0 0
0 1 1
1 0 1
1 1 1
SOURCE CODE:
module or1(a, b, out);
input a;
input b;
output out;
wire c,z;
supply1 pwr;
supply0 gnd;
pmos(c,pwr,b);
pmos(z,c,a);
pmos(out,pwr,z);
nmos(z,gnd,a);
nmos(z,gnd,b);
nmos(out,gnd,z);
endmodule
Simulation output:
RESULT:
Thus the OUTPUT’s of switch level design basic logic gates are verified
and simulated using the VERILOG code.