EC3561 VLSI Lab Manual-3-75
EC3561 VLSI Lab Manual-3-75
1
Combinational and Sequential Circuits
2
8- Bit Adder and Multiplier
3
Universal Shift Register
4
Random Access Memory
5
Finite state machine
6
3-Bit Synchronous Up/Down Counter
7
4-Bit Asynchronous Up/Down Counter
8 CMOS Nand, Nor Gate and Flipflop
9
Synchronous Counter
10 Differential Amplifier
3
Expt No: 1
Date: COMBINATIONAL AND SEQUENTIAL CIRCUITS
Aim:
To Design and Simulate basic gates, half & full adder, half & full Subtractor, multiplexer,
decoder, comparator and flip-flops using Verilog HDL and also implement in FPGA Kit.
Apparatus required:
A logic gate is a physical model of a boolean function that is, it performs a logical operation on
one or more logic inputs and produces a single logic output. Logic gates are primarily
implemented electronically using diodes or transistors, but can also be constructed using
electromagnetic relays (relay logic), fluidic logic, pneumatic logic, optics, molecules, or even
mechanical elements.With amplification, logic gates can be cascaded in the same way that
Boolean functions can be composed, allowing the construction of a physical model of all of
Boolean logic, and therefore, all of the algorithms and mathematics that can be described with
Boolean logicSynthesis is the process of constructing a gate level netlist from a register-transfer
Level models of the circuit described in Verilog HDL ,VHDL or mixed language designs.
The netlist files contain both logical design data and constraints .
XILINX SYNTHESIS TOOL enable us to study
4
Procedure:
1. Start the Xilinx ISE by using start→ program file → Xilinx ISE (8.1i) → Project navigator
4. select the Device and other category and click next twice and finish
5. Click on the symbol of FPGA device and then right click → click on new source
6. Select the Verilog Module and give the file name → click next and define ports → click
next and finish
8. Run the Check syntax → process window → synthesize → double click check syntax and
remove errors, if present , with proper syntax & coding.
9. synthesis your design, from the source window select, Synthesis/Implementation from the
window Now double click the synthesis →XSt
10. After the HDL synthesiss phase of the synthesis process,you can display a schematic
representation of your synthesized source file.This schematic shows a representation of the
pre-optimized design in terms of generic symbols,such as adders,multipliers,counters,Ann
gates and OR gates → double click View RTL schematic
13. This Schematic Shows a representation of the design in terms of logic elements optimized to
the target device. For example,in terms of LUTs(Look Up Table),carry logic,I/O buffers and
other technology-specific components
15.Double click the LUT to inner View.This is gate lenel view of LUT ,if you want see Truth
Table and K-Map for your design just click the respective tabs
16.After finishing the synthesis,you can view number of Slices,LUT(Look Up Table),I/Os are
taken by your design in Device using Design Summary
5
AND Gate:
Program:
AND Gate:
input i1;
input i2;
output out;
and (out,i1,i2);
endmodule
Truth table:
AND Gate
------------------------------------------------
------------------------------------------------
0 0 0
0 1 0
1 0 0
1 1 1
-------------------------------------------------
6
Output Wave
OR Gate:
Program:
input i1;
input i2;
output out;
or(out,i1,i2);
endmodule
7
Truth table:
OR Gate
------------------------------------------------
------------------------------------------------
0 0 0
0 1 1
1 0 1
1 1 1
------------------------------------------------
Output Wave:
8
NAND Gate:
Program
input i1;
input i2;
output out;
nand(out,i1,i2);
endmodule
Truth table:
NAND Gate
------------------------------------------------
------------------------------------------------
0 0 1
0 1 1
1 0 1
1 1 0
------------------------------------------------
9
Output Wave:
NOR Gate:
Program:
input i1;
input i2;
output out;
nor(out,i1,i2);
endmodule
10
Truth table:
NOR Gate
------------------------------------------------
------------------------------------------------
0 0 1
0 1 0
1 0 0
1 1 0
------------------------------------------------
Output wave
XOR Gate:
11
Program:
input i1;
input i2;
output out;
xor(out,i1,i2);
endmodule
Truth table:
XOR Gate
------------------------------------------------
------------------------------------------------
0 0 0
0 1 1
1 0 1
1 1 0
-------------------------------------------------
Output Wave
12
XNOR Gate:
Program
input i1;
input i2;
output out;
xnor(out,i1,i2);
endmodule
Truth table:
XNOR Gate
------------------------------------------------
------------------------------------------------
0 0 1
0 1 0
1 0 0
1 1 1
------------------------------------------------
13
Output Wave:
Not Gate:
Program
input in;
output out;
not(out,in);
endmodule
14
Truth table:
NOT Gate
---------------------------
Input Output
---------------------------
0 1
1 0
---------------------------
Output Wave
Buffer:
15
Program:
input in;
output out;
buf(out,in);
endmodule
Truth table :
BUFFER
---------------------------
Input Output
---------------------------
0 0
1 1
---------------------------
Output Wave:
16
Half Adder:
Program :
output sum;
output c_out;
input i1;
input i2;
xor(sum,i1,i2);
and(c_out,i1,i2);
endmodule
Truth table:
Half Adder
------------------------------------------------------------------
------------------------------------------------------------------
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
------------------------------------------------------------------
17
Output Wave:
Full Adder:
Program:
input i1;
input i2;
input c_in;
output c_out;
output sum;
18
wire s1,c1,c2;
xor n1(s1,i1,i2);
and n2(c1,i1,i2);
xor n3(sum,s1,c_in);
and n4(c2,s1,c_in);
or n5(c_out,c1,c2);
endmodule
Truth Table:
Full Adder
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
-------------------------------------------------------------------------------------------------
19
Output Wave:
Halfsubtractor:
Program:
input i0;
input i1;
output bor;
output dif;
wire i0n;
not(i0n,i0);
xor(dif,i0,i1);
and(bor,i0n,i1);
endmodule
20
Truth Table:
Half Subtractor
------------------------------------------------------------------------
-------------------------------------------------------------------------
0 0 0 0
0 1 1 1
1 0 0 1
1 1 0 0
------------------------------------------------------------------------
Output Wave:
Full subtractor:
21
Program:
input b_in;
input i1;
input i0;
output b_out;
output dif;
endmodule
Truth Table:
Full Subtractor
------------------------------------------------------------------------------------------------
A B C Difference bout
------------------------------------------------------------------------------------------------
0 0 0 0 0
0 0 1 1 1
22
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
-------------------------------------------------------------------------------------------------
Output Wave:
4:1 MUX:
23
Truth table:
INPUT OUTPUT
S(0) S(1) Y
0 0 X(0)
0 1 X(1)
1 0 X(2)
1 1 X(3)
module mux(y,a,b,c,d,s0,s1);
input a,b,c,d,s0,s1;
output y;
reg y;
always @ (a or b or c or d or s0 or s1)
begin
case({s0,s1})
2’b00:y=a;
2’b01:y=b;
2’b10:y=c;
2’b11:y=d;
end case
end
endmoudle
24
Output:
Decoder:
25
Truth table:
INPUTS OUTPUTS
a0 a1 d0 d1 d2 d3
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
module dec(y0,y1,y2,y3,a,b);
input a,b;
output y0,y1,y2,y3;
reg y0,y1,y2,y3;
always @ (a or b)
begin
case({a,b})
2’b00:{y0,y1,y2,y3}=4’b1000;
2’b01:{y0,y1,y2,y3}=4’b0100;
2’b10:{y0,y1,y2,y3}=4’b0010;
2’b11:{y0,y1,y2,y3}=4’b0001;
26
end case
end
endmodule
Output:
2-bit Comparator:
module comp(agtb,altb,aeqb,a0,a1,b0,b1);
input a0,a1,b0,b1;
output agtb,altb,aeqb;
assign agtb=(a0&~b1&~b0)|(~a1&b1)|(a1&a0&~b0);
assign altb=(~a1&~a0&b0)|(~a0&b1&b0)|(~a1&b1);
assign aeqb=(a0~^b0)&(a1~^b1);
end module
27
Output:
D
Q
TRUTH TABLE:
Q(t) D Q(t+1)
0 0 0
0 1 1
1 0 0
1 1 1
PROGRAM:
28
input d; input clk;
output q;
output qbar;
reg q,qbar;
initial q=0;
begin
q=d;
qbar=~d;
end
endmodule
RTL - SCHEMATIC:
SIMULATED OUTPUT:
29
LOGIC DIAGRAM of T-FLIP FLOP :
T
Q
C
TRUTH TABLE:
Q(t) T Q(t+1)
0 0 0
0 1 1
1 0 1
1 1 0
PROGRAM:
output q;
input clk;
input t;
reg q;
initial q=0;
always@(posedge clk)
begin
q=q^t;
end
endmodule
30
RTL - SCHEMATIC:
SIMULATED OUTPUT:
RESULT:
Thus the program of Basic Gates, half & full adder, half & full Subtractor, Multiplexer,
Decoder, Comparator and Flip-flops were designed and simulated using Verilog HDL and also
implemented in FPGA kit.
31
Expt No: 2
Date: 8- BIT ADDER AND MULTIPLIER
Aim:
To Design and Simulate an 8-Bit Adder and Multiplier using Verilog HDL and also
implement in FPGA Kit.
Apparatus Required:
PC,
XILINX Software,
Spartan 3E kit.
8- BIT ADDER
Theory:
PROCEDURE:
1. Start the Xilinx ISE by using start→ program file → Xilinx ISE → Project navigator
4. select the Device and other category and click next twice and finish
5. Click on the symbol of FPGA device and then right click → click on new source
6. Select the Verilog Module and give the file name → click next and define ports → click
next and finish
32
7. Writing the behavioral verilog code in verilog Editor
8. Run the Check syntax → process window → synthesize → double click check syntax and
remove errors, if present, with proper syntax & coding.
9. synthesis your design, from the source window select, Synthesis/Implementation from the
window Now double click the synthesis →XSt
10. After the HDL synthesis phase of the synthesis process, you can display a schematic
representation of your synthesized source file. This schematic shows a representation of
the pre-optimized design in terms of generic symbols, such as adders, multipliers,
counters, Ann gates and OR gates → double click View RTL schematic.
11. Afterr Synthesis you assign the Pin Value for your design so, → double click the Assign
Package Pins
12. Enter the Pin value for your input and output signals. If you want see your Pin
assignment in FPGA zoom in Architecture View or Package View
13. You see the Pins in FPGA. Save file as XST Default click ok and close the window
15. Right click the Generate Programming file→select properties and then select the start-up
options→change the clock into JTAG clock, then click apply and ok.
17. Double click Configure Device→click finish →select the bit file and then click ok
RTL-Schematic:
33
Program:
Output:
8- Bit Multiplier
Theory:
A combinational multiplier is a good example of how simple logic functions (gates, half
adders and full adders) can be combined to construct a much more complex function. In
particular, it is possible to construct a 4x4 combinational multiplier from an array of AND gates,
half-adders and full-adders, taking what you have learned recently and extending it to a more
complex circuit. The purpose of this document is to introduce how a relatively complex
arithmetic function, such as binary multiplication, can be realized using simple logic building
blocks.Synthesis is the process of constructing a gate level netlist from a register-transfer Level
34
models of the circuit described in Verilog HDL ,VHDL or mixed language designs.The netlist
files contain both logical design data and constraints, XILINX Synthesis tool enable us to study,
Program:
module multi(y,a,b);
input [7:0]a;
input [7:0]b;
output [15:0]y;
assign y=a*b;
endmodule
OUTPUT:
RESULT:
Thus the Program of 8-Bit Adder and Multiplier were designed and simulated using
Verilog HDL and also implemented in FPGA Kit.
35
Expt No: 3
Date: UNIVERSAL SHIFT REGISTER
Aim:
To Design and Simulate a Universal Shift Register using Verilog HDL and also implement in
FPGA Kit.
Apparatus required:
PC,
XILINX Software,
Spartan 3E kit.
Theory
A Universal shift register is a register which has both the right shift and left shift with
parallel load capabilities. Universal shift registers are used as memory elements in computers. A
Unidirectional shift register is capable of shifting in only one direction. A bidirectional shift
register is capable of shifting in both the directions. The Universal shift register is a combination
design of bidirectional shift register and a unidirectional shift register with parallel load
provision. A n-bit universal shift register consists of n flip-flops and n 4×1 multiplexers. All the
n multiplexers share the same select lines(S1 and S0)to select the mode in which the shift register
operates. The select inputs select the suitable input for the flip-flops.
Basic connections
1. The first input (zeroth pin of multiplexer) is connected to the output pin of the
corresponding flip-flop.
2. The second input (first pin of multiplexer) is connected to the output of the very-previous
flip flop which facilitates the right shift
3. The third input (second pin of multiplexer) is connected to the output of the very-next flip-
flop which facilitates the left shift.
4. The fourth input (third pin of multiplexer) is connected to the individual bits of the input
data which facilitates parallel loading.
The working of the Universal shift register depends on the inputs given to the select lines.
The register operations performed for the various inputs of select lines are as follows:
36
S1 S0 REGISTER OPERATION
0 0 No changes
0 1 Shift right
1 0 Shift left
1 1 Parallel load
PROCEDURE:
1. Start the Xilinx ISE by using start→ program file → Xilinx ISE → Project navigator
4. select the Device and other category and click next twice and finish
5. Click on the symbol of FPGA device and then right click → click on new source
37
6. Select the Verilog Module and give the file name → click next and define ports → click
next and finish
8. Run the Check syntax → process window → synthesize → double click check syntax and
remove errors, if present, with proper syntax & coding.
9. synthesis your design, from the source window select, Synthesis/Implementation from the
window Now double click the synthesis →XSt
10. After the HDL synthesis phase of the synthesis process, you can display a schematic
representation of your synthesized source file. This schematic shows a representation of
the pre-optimized design in terms of generic symbols, such as adders, multipliers,
counters, Ann gates and OR gates → double click View RTL schematic.
11. Afterr Synthesis you assign the Pin Value for your design so, → double click the Assign
Package Pins
12. Enter the Pin value for your input and output signals. If you want see your Pin
assignment in FPGA zoom in Architecture View or Package View
13. You see the Pins in FPGA. Save file as XST Default click ok and close the window
15. Right click the Generate Programming file→select properties and then select the start-up
options→change the clock into JTAG clock, then click apply and ok.
17. Double click Configure Device→click finish →select the bit file and then click ok
PROGRAM:
module fffff(a,s,clk,p);
input [3:0]a;
input [1:0]s;
input clk;
output reg [3:0]p;
initial
p<=4'b0110;
always@(posedge clk)
begin
case (s)
38
2'b00:
begin
p[3]<=p[3];
p[2]<=p[2];
p[1]<=p[1];
p[0]<=p[0];
end
2'b01:
begin
p[3]<=p[0];
p[2]<=p[3];
p[1]<=p[2];
p[0]<=p[1];
end
2'b10:
begin
p[0]<=p[3];
p[1]<=p[0];
p[2]<=p[1];
p[3]<=p[2];
end
2'b11:
begin
p[0]<=a[0];
p[1]<=a[1];
p[2]<=a[2];
p[3]<=a[3];
end
endcase
end
endmodule
OUTPUT:
RESULT:
Thus the Program of 4-Bit Universal Shift Register was designed and simulated using
Verilog HDL and also implemented in FPGA Kit.
39
Expt No: 4
Date: RANDOM ACCESS MEMORY
AIM:
To Design and Simulate a Random Access Memory using Verilog HDL and also implement
in FPGA Kit.
APPARATUS REQUIRED:
PC,
XILINX Software,
Spartan 3E kit.
THEORY:
RAM (pronounced ramm) is an acronym for random access memory, a type of computer
memory that can be accessed randomly; that is, any byte of memory can be accessed without
touching the preceding bytes. RAM is found in servers, PCs, tablets, smartphones and other
devices, such as printers.There are two main types of RAM:
40
The Difference between Memory, RAM and Storage:
The difference between memory and storage, in part because both can be measured in megabytes
(MB), gigabytes (GB) and terabytes (TB).In common usage, the term RAM is synonymous
with main memory. This is where a computing system stores data that it is actively
using. Storage systems, such as hard drives, network storage devices or cloud storage, are where
a system saves data that it will need to access later.Computing systems can retrieve data from
RAM very quickly, but when a device powers down, all the data that was in memory goes away.
Many people have had the experience of losing a document they were working on after an
unexpected power outage or system crash. In these cases, the data was lost because it was stored
in system memory, which is volatile.By contrast, storage is slower, but it can retain data when
the device is powered down. So, for example, if a document has been saved to a hard drive prior
to a power outage or system crash, the user will still be able to retrieve it when the system is
back up and running.Storage is usually less expensive than RAM on a per-gigabyte basis. As a
result, most PCs and smartphones have many times more gigabytes of storage than gigabytes of
RAM.
PROCEDURE:
1. Start the Xilinx ISE by using start→ program file → Xilinx ISE → Project navigator
4. select the Device and other category and click next twice and finish
5. Click on the symbol of FPGA device and then right click → click on new source
41
6. Select the Verilog Module and give the file name → click next and define ports → click
next and finish
8. Run the Check syntax → process window → synthesize → double click check syntax and
remove errors, if present, with proper syntax & coding.
9. synthesis your design, from the source window select, Synthesis/Implementation from the
window Now double click the synthesis →XSt
10. After the HDL synthesis phase of the synthesis process, you can display a schematic
representation of your synthesized source file. This schematic shows a representation of
the pre-optimized design in terms of generic symbols, such as adders, multipliers,
counters, Ann gates and OR gates → double click View RTL schematic.
11. Afterr Synthesis you assign the Pin Value for your design so, → double click the Assign
Package Pins
12. Enter the Pin value for your input and output signals. If you want see your Pin
assignment in FPGA zoom in Architecture View or Package View
13. You see the Pins in FPGA. Save file as XST Default click ok and close the window
14. Double Click Implementation Design
15. Right click the Generate Programming file→select properties and then select the start-up
options→change the clock into JTAG clock, then click apply and ok.
16. Double click the Generate Programming file.
17. Double click Configure Device→click finish →select the bit file and then click ok
18. Right click Xilinx Device→click Program→ok.
CIRCUIT DIAGRAM:
42
PROGRAM:
module ramreadfirst(clk, en, we, addr, di, do);
input clk;
input we;
input en;
input [4:0] addr;
input [3:0] di;
output [3:0] do;
reg [3:0] RAM [31:0];
reg [3:0] do;
always @(posedge clk)
begin
if (en)
begin
if (we)
RAM[addr] <= di;
do <= RAM[addr];
end
end
endmodule
OUTPUT:
RESULT:
Thus the Program of Random Access Memory was designed and simulated using
Verilog HDL and also implemented in FPGA Kit.
43
Expt No: 5
Date: FINITE STATE MACHINE
Aim:
To Design and Simulate a Finite State Machine using Verilog HDL and also implement in
FPGA Kit.
Apparatus Required:
PC,
XILINX Software,
Spartan 3E kit.
Theory:
Finite State Machines (FSM) are sequential circuit used in many digital systems to control
the behavior of systems and dataflow paths. Examples of FSM include control units and
sequencers. This lab introduces the concept of two types of FSMs, Mealy and Moore, and the
modeling styles to develop such machines.
A finite-state machine (FSM) or simply a state machine is used to design both computer
programs and sequential logic circuits. It is conceived as an abstract machine that can be in one
of a finite number of user-defined states. The machine is in only one state at a time; the state it is
in at any given time is called the current state. It can change from one state to another when
initiated by a triggering event or condition; this is called a transition. A particular FSM is defined
by a list of its states, and the triggering condition for each transition. The behavior of state
machines can be observed in many devices in modern society performing a predetermined
sequence of actions depending on a sequence of events with which they are presented. Simple
examples are vending machines which dispense products when the proper combination of coins
are deposited, elevators which drop riders off at upper floors before going down, traffic lights
which change sequence when cars are waiting, and combination locks which require the input of
combination numbers in the proper order. The state machines are modeled using two basic types
of sequential networks- Mealy and Moore. In a Mealy machine, the output depends on both the
present (current) state and the present (current) inputs. In Moore machine, the output depends
only on the present state. A general model of a Mealy sequential machine consists of a
combinatorial network, which generates the outputs and the next state, and a state register which
holds the present state as shown below. The state register is normally modeled as D flip-flops.
The state register must be sensitive to a clock edge. The other block(s) can be modeled either
using the always procedural block or a mixture of the always procedural block and dataflow
modeling statements; the always procedural block will have to be sensitive to all inputs being
read into the block and must have all output defined for every branch in order to model it as a
combinatorial block. The two blocks Mealy machine can be viewed as,
44
Procedure:
1. Start the Xilinx ISE by using start→ program file → Xilinx ISE → Project navigator
4. select the Device and other category and click next twice and finish
5. Click on the symbol of FPGA device and then right click → click on new source
6. Select the Verilog Module and give the file name → click next and define ports → click
next and finish
8. Run the Check syntax → process window → synthesize → double click check syntax and
remove errors, if present, with proper syntax & coding.
9. synthesis your design, from the source window select, Synthesis/Implementation from the
window Now double click the synthesis →XSt
10. After the HDL synthesis phase of the synthesis process, you can display a schematic
representation of your synthesized source file. This schematic shows a representation of
the pre-optimized design in terms of generic symbols, such as adders, multipliers,
counters, Ann gates and OR gates → double click View RTL schematic.
11. Afterr Synthesis you assign the Pin Value for your design so, → double click the Assign
Package Pins
12. Enter the Pin value for your input and output signals. If you want see your Pin
assignment in FPGA zoom in Architecture View or Package View
13. You see the Pins in FPGA. Save file as XST Default click ok and close the window
15. Right click the Generate Programming file→select properties and then select the start-up
options→change the clock into JTAG clock, then click apply and ok.
17. Double click Configure Device→click finish →select the bit file and then click ok
45
PROGRAM:
46
endcase
end
end
always @(posedge clk, posedge rst)
begin
if( rst )
y <= 0;
else if( state == 2'b11 )
y <= 1;
else y <= 0;
end
endmodule
RESULT:
Thus the Program of Finite State Machine was designed and simulated using Verilog
HDL and also implemented in FPGA Kit.
47
Expt No: 6 3-BIT SYNCHRONOUS UP/DOWN COUNTER
Date:
Aim:
To design and simulate 3-Bit Synchronous Up/Down Counter Using HDL and also
implement in FPGA Kit.
Apparatus Required:
PC
Xilinx software
FPGA(Spartan 3E) Kit
Procedure:
1. Start the Xilinx ISE by using start→ program file → Xilinx ISE → Project navigator
4. select the Device and other category and click next twice and finish
5. Click on the symbol of FPGA device and then right click → click on new source
6. Select the Verilog Module and give the file name → click next and define ports → click
next and finish
8. Run the Check syntax → process window → synthesize → double click check syntax and
remove errors, if present, with proper syntax & coding.
9. synthesis your design, from the source window select, Synthesis/Implementation from the
window Now double click the synthesis →XSt
10. After the HDL synthesis phase of the synthesis process, you can display a schematic
representation of your synthesized source file. This schematic shows a representation of
the pre-optimized design in terms of generic symbols, such as adders, multipliers,
counters, Ann gates and OR gates → double click View RTL schematic.
11. Afterr Synthesis you assign the Pin Value for your design so, → double click the Assign
Package Pins
12. Enter the Pin value for your input and output signals. If you want see your Pin
assignment in FPGA zoom in Architecture View or Package View
13. You see the Pins in FPGA. Save file as XST Default click ok and close the window
48
14. Double Click Implementation Design
15. Right click the Generate Programming file→select properties and then select the start-up
options→change the clock into JTAG clock, then click apply and ok.
17. Double click Configure Device→click finish →select the bit file and then click ok
Excitation table of T FF
49
The circuit excitation table represents the present states of the counting sequence and the next
states after the clock pulse is applied and input T of the flip-flops. By seeing the transition
between the present state and the next state, we can find the input values of 3 Flip Flops using
the Flip Flops excitation table. The table is designed according to the required counting
sequence.
If there is a change in the output state of a flip flop (i.e. 0 to 1 or 1 to 0), then the corresponding
T value becomes 1 otherwise 0.
50
6. Find a simplified equation using k map –
Here we are finding the minimal Boolean expression for each Flip Flop input T using k map.
51
Explanation :
Here -ve edge triggered clock pulse is used for toggling purpose.
Characteristics table of T FF
Program:
module counter (q,clk,clr,up_down);
input clk, clr, up_down;
output[2:0]q;
reg[2:0]temp;
always@(posedge clk or posedge clr)
begin
if(clr)
temp=3’b000;
else
if(up_down)
temp=temp+1’b1;
else
temp=temp-1’b1;
end
assign q=temp;
endmodule
52
RESULT:
Thus the Program of 3-bit synchronous up/down counter was designed and simulated
using Verilog HDL and also implemented in FPGA Kit.
53
Expt No: 7 4-BIT ASYNCHRONOUS UP/DOWN COUNTER
Date:
Aim:
To design and simulate 4-Bit Asynchronous Up/Down Counter Using HDL and also
implement in FPGA Kit.
Apparatus Required:
PC
Xilinx software
FPGA(Spartan 3E) Kit
Procedure:
19. Start the Xilinx ISE by using start→ program file → Xilinx ISE → Project navigator
21. Enter the project name and location then click next
22. select the Device and other category and click next twice and finish
23. Click on the symbol of FPGA device and then right click → click on new source
24. Select the Verilog Module and give the file name → click next and define ports → click
next and finish
26. Run the Check syntax → process window → synthesize → double click check syntax and
remove errors, if present, with proper syntax & coding.
27. synthesis your design, from the source window select, Synthesis/Implementation from the
window Now double click the synthesis →XSt
28. After the HDL synthesis phase of the synthesis process, you can display a schematic
representation of your synthesized source file. This schematic shows a representation of
the pre-optimized design in terms of generic symbols, such as adders, multipliers,
counters, Ann gates and OR gates → double click View RTL schematic.
29. After Synthesis you assign the Pin Value for your design so, → double click the Assign
Package Pins
30. Enter the Pin value for your input and output signals. If you want see your Pin
assignment in FPGA zoom in Architecture View or Package View
31. You see the Pins in FPGA. Save file as XST Default click ok and close the window
54
32. Double Click Implementation Design
33. Right click the Generate Programming file→select properties and then select the start-up
options→change the clock into JTAG clock, then click apply and ok.
35. Double click Configure Device→click finish →select the bit file and then click ok
CIRCUIT DIAGRAM:
PROGRAM
module ddfsfd (
Clk,
reset,
UpOrDown, //high for UP counter and low for Down counter
Count
);
input Clk,reset,UpOrDown;
output [3 : 0] Count;
reg [3 : 0] Count = 0; //input ports and their sizes
always @ (posedge(Clk) or posedge(reset))
//output ports and their size
begin
if(reset == 1)
Count <= 0;
else
if(UpOrDown == 1) //Up mode selected
if(Count == 15)
55
Count <= 0;
else
Count <= Count + 1; //Incremend Counter
else //Down mode selected
if(Count == 0)
Count <= 15;
else
Count <= Count - 1; //Decrement counter
end
//Internal variables
endmodule
RESULT:
Thus the Program of 4-bit Asynchronous up/down counter was designed and simulated
using Verilog HDL and also implemented in FPGA Kit.
56
Expt No: 8
Date: CMOS NAND, NOR GATE AND FLIPFLOP
Aim:
To design and simulate CMOS inverter , 2-input NAND, NOR gate, Flipflop and also
automatic layout generation using microwind.
Apparatus Required:
PC
Microwind
Dsch 03
Mw 03
Procedure:
57
Simulation output:
Layout Generation:
58
Circuit Diagram for CMOS Nand gate:
59
NOR GATE OUTPUT:
D-FLIPFLOP:
SIMULATION OF D-FLIPFLOP:
60
LAYOUT OF D-FLIPFLOP:
RESULT:
Thus the CMOS 2-input NAND, NOR gate, Flip-flop was designed and simulated and
also automatic layout generation completed using micro wind.
61
Expt No: 9
Date: SYNCHRONOUS COUNTER
Aim:
To design and simulate 4-bit Synchronous Counter and also automatic layout generation
using microwind.
Apparatus Required:
PC
Microwind
Dsch 03
Mw 03
Procedure:
Circuit Diagram:
62
Simulation Output:
RESULT:
Thus the 4-bit Synchronous Counter was designed and simulated and also automatic
layout generation completed using microwind.
63
EXPT NO: 10
To design and simulate the differential amplifier circuits using Tanner EDA tool.
Apparatus Required:
(i) S-Edit
(ii) T-Edit
(iii) W-Edit
Theory:
Differential amplifier:
A differential amplifier is a type of electronic amplifier that multiplies the difference between
two inputs by some constant factor (the differential gain). Many electronic devices use differential
amplifiers internally. The output of an ideal differential amplifier is given by:
Vout = Ad(Vin1 – Vin2), Where Vin1 and Vin2 are the input voltages and Ad is the differential gain. In
practice, however, the gain is not quite equal, for the two inputs. This means that if V in1 and Vin2 are
equal, the output will not be zero, as it would be in the ideal case. A more realistic expression for the
output of a differential amplifier thus includes a second term. Vout = (Ad(Vin1 – Vin2) + Ac(Vin1 + Vin2))/2
Ac is called the common-mode gain of the amplifier. As differential amplifiers are often used
when it is desired to null out noise or bias-voltages that appear at both inputs, a low common-mode gain
is usually considered good. The common-mode rejection ratio, usually defined as the ratio between
differential-mode gain and common-mode gain, indicates the ability of the amplifier to accurately cancel
voltages that are common to both inputs. Common-mode rejection ratio (CMRR): CMRR= Ad / Ac
The input common-mode range (ICMR) is the range of common-mode voltages over which the
differential amplifier continues to sense and amplify the difference signal with the same gain.
Typically, ICMR is defined by the common-mode voltage range over which all MOSFETS remain in the
saturation region..
64
Procedure:
Circuit diagram:
Schematic diagram:
65
Common mode output:
66
Output:
RESULT:
Thus the Differential Amplifier was designed and simulated using Tanner EDA Tools.
67
Expt No: 11
Date: DESIGN AND SIMULATE THE ANALYSIS OF SOURCE FOLLOWERS
Aim:
To design and simulate the analysis of source followers using Tanner EDA Tool (S-Edit).
Apparatus required:
PC
Tanner EDA
T-spice
S-Edit
STEP8: observe the input & output waveform by given appropriate inputs.
Circuit Description:
Common-Source amplifier is one of the three basic single stage field effect transistor
topologies typically used as a voltage or trans-conductance amplifier. As a trans-conductance
amplifier, the input voltage is seen as modulating the current going to the load. As a voltage
amplifier, input voltage modulates the amount of current flowing through the FET, changing the
voltage across the output resistance according to Ohms law. Because of its high input-
impedance, relatively high gain, low noise, speed and simplicity, common source amplifiers find
different applications from sensor signal amplifications to RF noise amplification.
68
Specifications:
L = 250nm; Tox = 5.7e-9; Vth = 0.388582; Un = 304.684e-4;
Vs = 200mV (max voltage drop across degeneration resistor)
Gain = 10dB; Rin = 50K; Power Budget = 5mW; Kn = 0.1876e-3; Vdd = 2.5V
Fl = 1Khz; Fh = 3Ghz; NF = 3dB; ᵞ = 0.8
designed values:
R1= 149.04K; R2= 76.23K
W = 21.321um; Rd = 3188K
Cin = 3.184uF; Cout = 58.89nF
CIRCUIT DIAGRAM:
69
T-SPICE NETLIST:
SPICE export by: SEDIT 13.00
* Design: opi
* Cell: Cell0
* View: view0
* Exclude .model: no
* Exclude .end: no
* Wrap lines: no
70
********* Simulation Settings - Analysis section *********
.tran 10ns 1000ns
********* Simulation Settings - Additional SPICE commands *********
.end
OUTPUT WAVEFORM:
RESULT:
Thus the analysis of source followers was designed and simulated using Tanner EDA Tools.
71
EX.NO: 12
To design and simulate a single stage operational amplifiers using Tanner EDA tools.
.
Apparatus Required:
STEP8: observe the input & output waveform by given appropriate inputs.
Theory:
The single stage operational amplifier produces an output with a reduced voltage swing.
A two stage operational amplifier increases the voltage swing. The differential amplifier
constitutes the first stage of the two stage operational amplifier. The differential input signal
applied across the two terminals will be amplified according to the gain of the differential stage.
The current mirror topology performs the differential to single-ended conversion of the input
signal and also, the load helps with the common mode rejection ratio. The second stage is a
current sink load inverter (common source) which provides additional gain.
72
Specifications:
,, ,, ,, ,, , ,
, ,
Schematic:
T-SPICE Netlist:
* SPICE export by: S-Edit 15.00
* Design: OPAMP4_SINGLE
* Cell: Cell0
* View: view0
73
* Exclude .model: no
* Exclude .end: no
* Wrap lines: no
.include"C:\software\tanner\LibraryfilesforTannerEDAV15\Libraries\Libraries\Models\ptm_180nm.md"
VBiasVBias VSS 1
MNMOS_1 N_1 In- N_4 0 NMOS W=5u L=180n AS=4.5p PS=11.8u AD=4.5p PD=11.8u $ $x=2800
$y=3900 $w=400 $h=600
MNMOS_2 N_2 In+ N_4 0 NMOS W=5u L=180n AS=4.5p PS=11.8u AD=4.5p PD=11.8u $ $x=5200
$y=3900 $w=400 $h=600
MNMOS_3 N_4 VBiasVss 0 NMOS W=34u L=180n AS=30.6p PS=69.8u AD=30.6p PD=69.8u $
$x=4000 $y=2900 $w=400 $h=600
MPMOS_1 N_1 N_1VddVdd PMOS W=720n L=180n AS=648f PS=3.24u AD=648f PD=3.24u $
$x=2800 $y=5400 $w=400 $h=600
MPMOS_2 N_2 N_1 VddVdd PMOS W=720n L=180n AS=648f PS=3.24u AD=648f PD=3.24u $
$x=5200 $y=5400 $w=400 $h=600
*.op
74
********* Simulation Settings - Additional SPICE Commands *********
RESULT:
Thus the single stage operational amplifier was designed and simulated using tanner
EDA.
75