View
256
Download
1
Category
Preview:
Citation preview
7/25/2019 VLSI LAB-1
1/43
AVANTHIS St.THERESSA INSTITUTE OF ENGG
&TECHNOLOGY::GARIVIDI
Vizianagaram Dist.(A.P)
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING
NAME: _________________________________________
ROLL NO: ______________________________________
BRANCH: ______________________________________
LABORATORY: _______________________________
7/25/2019 VLSI LAB-1
2/43
AVANTHIS St.THERESSA INSTITUTE OF ENGG
&TECHNOLOGY::GARIVIDI
Vizianagaram Dist.(A.P)
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING
THIS IS TO CERTIFY THAT THIS IS THE BONAFIDE RECORD OF THE WORK DONE IN
LABORATORY BY
MR./MS. BEARING REGD.
NO./ROLL NO OF COURSE DURING
Total Numbers of Total Numbers of
Experiments held Experiments done .
LAB-IN-CHARGE HEAD OF THE
DEPARTMENT
SIGNATURE OF EXTERNAL EXAMINER
7/25/2019 VLSI LAB-1
3/43
1. REALIZATION OF LOGIC GATES
AIM: To write a VHDL code logic gates and verify its functionality in both Software simulatorand Hardware kit.
HARDWARE REQUIREMENT: Xilinx Spartan 3E, adaptor, connecting cable, PC system.
SOFTWARE REQUIREMENT: Xilinx ISE 10.1, modelsim 6.5b.
AND GATE:
OR GATE:
7/25/2019 VLSI LAB-1
4/43
NAND GATE:
NOT GATE:
XOR GATE:
7/25/2019 VLSI LAB-1
5/43
XNOR GATE:
PROGRAM CODE:
library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity logicgates isport ( a: in std_logic;b: in std_logic;y: out std_logic_vector(7 downto 0));
End logicgates;
architecture Behavioral of logicgates isbegin
y(0)
7/25/2019 VLSI LAB-1
6/43
LOGIC APPROACH:
AND GATE:
The AND gate is an electronic circuit that gives a highoutput (1) only if all its inputs are
high. A dot (.) is used to show the AND operation i.e. A.B.
OR GATE:
The OR gate is an electronic circuit that gives a high output (1) if one or moreof its
inputs are high. A plus (+) is used to show the OR operation.
NAND GATE:
This is a NOT-AND gate which is equal to an AND gate followed by a NOT gate. The
outputs of all NAND gates are high if any of the inputs are low. The symbol is an AND gate with
a small circle on the output. The small circle represents inversion.
NOR GATE:
This is a NOT-OR gate which is equal to an OR gate followed by a NOT gate. The
outputs of all NOR gates are low if any of the inputs are high. The symbol is an OR gate with a
small circle on the output. The small circle represents inversion.
NOT GATE:
The NOT gate is an electronic circuit that produces an inverted version of the input at its
output. It is also known as an inverter. If the input variable is A, the inverted output is known as
NOT A. This is also shown as A', or A with a bar over the top, as shown at the outputs. The
diagrams below show two ways that the NAND logic gate can be configured to produce a NOT
gate. It can also be done using NOR logic gates in the same way.
EXOR GATE:
The 'Exclusive-OR' gate is a circuit which will give a high output if either, but not both,
of its two inputs are high. An encircled plus sign is used to show the Ex-OR operation.
7/25/2019 VLSI LAB-1
7/43
EXNOR GATE:
The 'Exclusive-NOR' gate circuit does the opposite to the EOR gate. It will give a low
output if either, but not both, of its two inputs are high. The symbol is an EXOR gate with a
small circle on the output. The small circle represents inversion.
RESULT ANALYSIS:
SOFTWARE: In the software analysis, we are going to force the input logic condition in the
simulation software (modelsim) and simulate the waveform for the given input. The functionality
of the gate is verified by observing the waveform obtained.
SIMULATION WAVEFORM:-
CONCLUSION:
Hence the VHDL code for the realization of logic gates has been verified and
the simulation waveform has been observed.
7/25/2019 VLSI LAB-1
8/43
2. PRIORITY ENCODER
AIM: To write a VHDL/Verilog HDL code for 8-3 Priority encoder and verify its functionalityin both Software simulator and Hardware kit.
HARDWARE REQUIREMENT: Xilinx Spartan 3E, adaptor, connecting cable, PC system.
SOFTWARE REQUIREMENT: Xilinx ISE 10.1, modelsim 6.5b.
CIRCUIT DIAGRAM:
TRUTH TABLE:
7/25/2019 VLSI LAB-1
9/43
VERILOG CODE:
module pencoder(DI,CLK,DO);
input [7:0] DI;
input CLK;
output reg [2:0] DO;
always@(posedge CLK)
begin
if(DI[7]==1'b1)
DO=3'b111;
else if (DI[7]==1'b0 && DI[6]==1'b1)
DO=3'b110;
else if(DI[7:6]==2'b00 && DI[5]==1'b1)
DO=3'b101;
else if(DI[7:5]==3'b000 && DI[4]==1'b1)
DO=3'b100;
else if(DI[7:4]==4'b0000 && DI[3]==1'b1)
DO=3'b011;
else if(DI[7:3]==5'b00000 && DI[2]==1'b1)
DO=3'b010;
else if(DI[7:2]==6'b000000 && DI[1]==1'b1)
DO=3'b001;
else if(DI[7:1]==7'b0000000 && DI[0]==1'b1)
DO=3'b000;end
endmodule
LOGIC APPROACH:-
A priority encoder is a circuit or algorithm that compresses multiple binary inputs into a
smaller number of outputs. The output of a priority encoder is the binary representation of the
original number starting from zero of the most significant input bit. They are often used to
control interrupt requests by acting on the highest priority request.
RESULT ANALYSIS:
SOFTWARE: In the software analysis, we are going to force the input logic condition in the
simulation software (modelsim) and simulate the waveform for the given input . The
functionality of the circuit is verified by observing the waveform obtained.
7/25/2019 VLSI LAB-1
10/43
SIMULATION WAVEFORMS:
CONCLUSION:
Hence the VHDLVerilog HDL code for the Priority encoder has been verified and the
simulation waveform has been observed.
7/25/2019 VLSI LAB-1
11/43
3. RANDOM COUNTER
AIM: To write a VHDL code for 4-bit Random counter and verify its functionality in both
Software simulator and Hardware kit.
HARDWARE REQUIREMENT: Xilinx Spartan 3E, adaptor, connecting cable, PC system.
SOFTWARE REQUIREMENT: Xilinx ISE 10.1 , modelsim 6.5b.
RANDOM COUNTER CIRCUIT DIAGRAMS AND TRUTH TABLES:
CIRCUIT DIAGRAM:
TRUTH TABLE:
Enable(en) Clock(clk) Clear(clr) Q(output)
0 x x 0000
0 1 1 0000
1 1 1 0001
1 1 1 0010
1 1 1 0011
1 1 1 0100
1 1 1 0101
1 1 1 0110
1 1 1 0111
1 1 1 10001 1 1 1001
1 1 1 1010
1 1 1 1011
1 1 1 1100
1 1 1 1101
1 1 1 1110
1 1 1 1111
7/25/2019 VLSI LAB-1
12/43
7/25/2019 VLSI LAB-1
13/43
q=~q;
end
end
endmodule
module random(o,clk);
output [3:0]o;
input clk;
xor (t0,o[3],o[2]);
assign t1=o[0];
assign t2=o[1];
assign t3=o[2];
tff u1(o[0],t0,clk);
tff1 u2(o[1],t1,clk);
tff1 u3(o[2],t2,clk);
tff1 u4(o[3],t3,clk);
endmodule
LOGIC APPROACH:
A Random counter counts from 0 to 2N
-1, where N is the number of bits/flip-flops in the
counter. Each flip-flop is used to represent one bit. The flip-flop in the lowest-order position is
complemented/toggled with every clock pulse and a flip-flop in any other position is
complemented on the next clock pulse provided all the bits in the lower-order positions are equal
to 1.
RESULT ANALYSIS:
SOFTWARE: In the software analysis, we are going to force the input logic condition in the
simulation software (modelsim) and simulate the waveform for the given input . The
functionality of the circuit is verified by observing the waveform obtained.
7/25/2019 VLSI LAB-1
14/43
SIMULATION WAVEFORMS:
CONCLUSION:
Hence the Verilog HDL code for the random counter has been verified and the simulation
waveform has been observed.
7/25/2019 VLSI LAB-1
15/43
4. SYNCHRONOUS RAM.
AIM: To write a VHDL code for 4-bit Synchronous RAM and verify its functionality in bothSoftware simulator and Hardware kit.
HARDWARE REQUIREMENT: Xilinx Spartan 3E, adaptor, connecting cable, PC system.
SOFTWARE REQUIREMENT: Xilinx ISE 11.1 , modelsim 6.5b.
CIRCUIT DIAGRAM:
TRUTH TABLE:
7/25/2019 VLSI LAB-1
16/43
VHDL PROGRAM:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity synram is
generic (DATA_WIDTH :integer := 8;
ADDR_WIDTH :integer := 8 );
Port ( clk : in STD_LOGIC;
address : in STD_LOGIC_VECTOR (7 downto 0);
data : inout STD_LOGIC_VECTOR (7 downto 0);
cs : in STD_LOGIC;
we : in STD_LOGIC;
oe : in STD_LOGIC);end synram;
architecture Behavioral of synram is
----------------Internal variables----------------
constant RAM_DEPTH :integer := 2**ADDR_WIDTH;
signal data_out :std_logic_vector (DATA_WIDTH-1 downto 0);
type RAM is array (integer range )of std_logic_vector
(DATA_WIDTH-1 downto 0);
signal mem : RAM (0 to RAM_DEPTH-1);
begin
-- Memory Write Block
-- Write Operation : When we = 1, cs = 1
MEM_WRITE:process (clk)
begin
if (rising_edge(clk)) then
if (cs = '1' and we = '1') then
mem(conv_integer(address))
7/25/2019 VLSI LAB-1
17/43
-- Memory Read Block
-- Read Operation : When we = 0, oe = 1, cs = 1
MEM_READ:process (clk) begin
if (rising_edge(clk)) then
if (cs = '1' and we = '0' and oe = '1') then
data_out
7/25/2019 VLSI LAB-1
18/43
SIMULATION WAVEFORMS:
CONCLUSION:
Hence the VHDL code for the synchronous RAM has been verified and the simulation
waveform has been observed.
7/25/2019 VLSI LAB-1
19/43
5. ALU
AIM: To write a VHDL code for 8-bit ALU and verify its functionality in both Software
simulator and Hardware kit.
HARDWARE REQUIREMENT: Xilinx Spartan 3E, adaptor, connecting cable, PC system.
SOFTWARE REQUIREMENT: Xilinx ISE 10.1 , modelsim 6.5b.
CIRCUIT DIAGRAM:
TRUTH TABLE:
7/25/2019 VLSI LAB-1
20/43
VHDL PROGRAM:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity alu is
Port ( S : in STD_LOGIC_VECTOR (2 downto 0);
A : in STD_LOGIC_VECTOR (7 downto 0);
B : in STD_LOGIC_VECTOR (7 downto 0);
F : out STD_LOGIC_VECTOR (7 downto 0));
end alu;
architecture Behavioral of alu is
beginPROCESS(S,A,B)
BEGIN
CASE S IS
WHEN "000"=> ---clear
F ---subtraction
F ---subtraction
F ---addition
F ---xor
F ---or
F ---and
F ---preset
F
7/25/2019 VLSI LAB-1
21/43
LOGIC APPROACH:
An Arithmetic and Logic Unit (ALU) is a combinational circuit that performs logic and
arithmetic micro-operations on a pair of n-bit operands (ex. A [3:0] and B [3:0]). The operations
performed by an ALU are controlled by a set of function-select inputs.
RESULT ANALYSIS:
SOFTWARE: In the software analysis, we are going to force the input logic condition in the
simulation software (modelsim) and simulate the waveform for the given input. The functionality
of the circuit is verified by observing the waveform obtained.
SIMULATION WAVEFORMS:
CONCLUSION:
Hence the VHDL for the ALU has been verified and the simulation waveforms have been
observed
7/25/2019 VLSI LAB-1
22/43
6. UART MODEL
AIM: To write a VHDL code for 8-bit UART model and verify its functionality in both Software
simulator and Hardware kit.
HARDWARE REQUIREMENT: Xilinx Spartan 3E, adaptor, connecting cable, PC system.
SOFTWARE REQUIREMENT: Xilinx ISE 10.1, modelsim 6.5b.
TRANSMITTER FSM:
7/25/2019 VLSI LAB-1
23/43
VHDL PROGRAM:
UART RX:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Ruart is
Port ( RST : in STD_LOGIC;
CLK : in STD_LOGIC;
Dout : out STD_LOGIC_VECTOR (7 downto 0);
Rx : in STD_LOGIC;
RxRDY: out std_logic);
end Ruart;
architecture Behavioral of Ruart is
TYPE state_type IS (Idle, Start_Rx, Shift_Rx,Stop_Rx);
signal RxFSM: state_type;
signal TopRx:std_logic;
signal Rx_Reg: std_logic_vector( 7 downto 0);
signal RxBitCnt: integer range 0 to 10:=0;
constant NDBits: integer :=8;
beginRx_FSM: process (RST, CLK)
begin
if RST='1' then
Rx_Reg '0');
Dout '0');
RxBitCnt
7/25/2019 VLSI LAB-1
24/43
RxRDY -- wait on first data bit
if TopRx='1' then
RxFSM
7/25/2019 VLSI LAB-1
25/43
UART TX:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity suart is
Port ( RST : in STD_LOGIC;
CLK : in STD_LOGIC;
Din : in STD_LOGIC_VECTOR (7 downto 0);
LoaD : in STD_LOGIC;
TxBusy: out std_logic;
TX : out STD_LOGIC);
end suart;
architecture Behavioral of suart is
TYPE state_type IS (Idle, Load_Tx, Shift_Tx,Stop_Tx);
signal TxFSM: state_type;
signal RegDin: std_logic_vector(7 downto 0);
signal TopTx:std_logic;
signal Tx_Reg: std_logic_vector( 9 downto 0);
signal TxBitCnt: integer range 0 to 10:=0;
constant NDBits: integer :=8;
beginTX
7/25/2019 VLSI LAB-1
26/43
TxFSM
7/25/2019 VLSI LAB-1
27/43
RESULT ANALYSIS:
SOFTWARE: In the software analysis, we are going to force the input logic condition in the
simulation software (modelsim) and simulate the waveform for the given input . The
functionality of the gate is verified by observing the waveform obtained.
SIMULATION WAVEFORMS :( FOR UART RX)
7/25/2019 VLSI LAB-1
28/43
SIMULATION WAVEFORM :( For UART TX)
CONCLUSION:
Hence the VHDL code for the UART has been verified and the simulation waveform has
been observed.
7/25/2019 VLSI LAB-1
29/43
7. FIRE DETECTION AND CONTROL SYSTEM
USING COMBINATIONAL LOGIC CIRCUITS.
AIM: To write a VHSIC/Verilog HDL code for fire detection and control system using
combinational logic circuits and verify its functionality in both Software simulator and Hardware
kit.
HARDWARE REQUIREMENT: Xilinx Spartan 3E, adaptor, connecting cable, PC system.
SOFTWARE REQUIREMENT: Xilinx ISE 10.1, modelsim 6.5b.
BLOCK DIAGRAM:
VHDL PROGRAM:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity fire is
Port ( clk : in STD_LOGIC;
rst : in STD_LOGIC;
sensor : in STD_LOGIC_VECTOR (5 downto 0);
alarm : out STD_LOGIC;
actuator : out STD_LOGIC;
display : out STD_LOGIC_VECTOR (7 downto 0));
7/25/2019 VLSI LAB-1
30/43
end fire;
architecture Behavioral of fire is
begin
process (clk, rst) begin
if (rising_edge(clk)) then
if (rst = '1') then
alarm
7/25/2019 VLSI LAB-1
31/43
SIMULATION WAVEFORM:
CONCLUSION:
Hence the VHDL code for the fire detection and control system using combinational
logic circuits has been verified and the simulation waveform has been observed
7/25/2019 VLSI LAB-1
32/43
8.TRAFFIC LIGHT CONTROLLER USING
SEQUENTIAL LOGIC CIRCUITS
AIM: To write a VHDL code for traffic light controller using sequential logic circuitsand verifyits functionality in both software simulator and hardware kit.
HARDWARE REQUIREMENT: Xilinx Spartan 3E, adaptor, connecting cable, PC system.
SOFTWARE REQUIREMENT: Xilinx ISE 10.1, modelsim 6.5b.
CIRCUIT DIAGRAM:
7/25/2019 VLSI LAB-1
33/43
VHDL PROGRAM:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity tfcontroller_code is
Port ( clk : in STD_LOGIC;
rst : in STD_LOGIC;
Green : out STD_LOGIC;
Red : out STD_LOGIC;
Yellow : out STD_LOGIC);
end tfcontroller_code;
architecture Behavioral of tfcontroller_code is
signal count:integer range 0 to 10 := 0;
signal state:integer range 0 to 2 := 0;
begin
process(clk, rst)
begin
if(rst = '1') then
state
7/25/2019 VLSI LAB-1
34/43
when 1 => --Green Light
if(count=5) then
count
7/25/2019 VLSI LAB-1
35/43
RESULT ANALYSIS:
SOFTWARE: In the software analysis, we are going to force the input logic condition in the
simulation software (modelsim) and simulate the waveform for the given input . The
functionality of the gate is verified by observing the waveform obtained.
SIMULATION WAVEFORM:
CONCLUSION:
Hence the VHDL code for the traffic light controller using sequential circuits has been
verified and the simulation waveform has been observed.
7/25/2019 VLSI LAB-1
36/43
9. PATTERN DETECTION USING MOORE
MACHINE
AIM: To write a VHDL code for Pattern detection using Moore machine in both Software
simulator and Hardware kit.
HARDWARE REQUIREMENT: Xilinx Spartan 3E, adaptor, connecting cable, PC system.
SOFTWARE REQUIREMENT: Xilinx ISE 10.1, modelsim 6.5b.
CIRCUIT DIAGRAM:
TRUTH TABLE:PRESENT STATE NEXT STATE OUTPUT (det_vld)
Seq=0 Seq=1A A B 0
B C B 0
C A D 0
D C A 1
7/25/2019 VLSI LAB-1
37/43
VHDL PROGRAM:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity pattern1 is
port(clk : in std_logic; --clock signal
reset : in std_logic;--reset signa
seq : in std_logic; --serial bit sequence//
det_vld : out std_logic--A '1' indicates the pattern -
--"1011" is detected in the sequence);
end pattern1;
architecture Behavioral of pattern1 is
type state_type is (A,B,C,D);--Defines the type for states in
--the state machine//
signal state : state_type := A;--Declare the signal with the
--corresponding state type//.
begin
process(clk)
begin
if( reset = '1' ) then
det_vld
7/25/2019 VLSI LAB-1
38/43
when C => if ( seq = '0' ) then
state
7/25/2019 VLSI LAB-1
39/43
SIMULATION WAVEFORM:
CONCLUSION:
Hence the VHDL code for the pattern detection using moore machine has been verified
and the simulation waveform has been observed.
7/25/2019 VLSI LAB-1
40/43
10. FINITE STATE MACHINE (FSM) BASED
LOGIC CIRCUIT.
AIM: To write a VHDL code for Finite state machine (FSM) based logic circuit in both Software
simulator and Hardware kit.
HARDWARE REQUIREMENT: Xilinx Spartan 3E, adaptor, connecting cable, PC system.
SOFTWARE REQUIREMENT: Xilinx ISE 10.1, modelsim 6.5b.
STATE DIAGRAM:
7/25/2019 VLSI LAB-1
41/43
TRUTH TABLE:
Present state Next state output
S0 S0 S1 0 0
S1 S2 S1 0 0
S2 S0 S3 0 0
S3 S2 S4 0 0
S4 S2 S1 0 1
VHDL PROGRAM:
library ieee ;
use ieee.std_logic_1164.all;
entity seq_design is
port(a:in std_logic;
clock:in std_logic;reset:in std_logic;
x:out std_logic);
end seq_design;
architecture FSM of seq_design is
type state_type is (S0, S1, S2, S3);
signal next_state, current_state: state_type;
begin-- cocurrent process#1: state registers
state_reg: process(clock, reset)
begin
if (reset='1') then
current_state
7/25/2019 VLSI LAB-1
42/43
elsif a ='1' then
next_state x
7/25/2019 VLSI LAB-1
43/43
RESULT ANALYSIS:
SOFTWARE: In the software analysis, we are going to force the input logic condition in the
simulation software (modelsim) and simulate the waveform for the given input . The
functionality of the gate is verified by observing the waveform obtained.
SIMULATION WAVEFORM:
CONCLUSION:
Hence the VHDL code for the FSM based logic circuit has been verified and the
simulation waveform has been observed.
Recommended