Vous êtes sur la page 1sur 77

A HANDS-ON-TRAINING EXPERIENCE

IN
VLSI DESIGN
26th 30th December 2011

USER GUIDE FOR XILINX


A Complete Process Flow for a Full Adder Using
VHDL and Dumping It into A Sparten 3E Board

A Hands-on-training Experience in VLSI Design

Getting Started with Xilinx software and writing a VHDL code for Full adder
checking its syntax, simulation and viewing RTL Schematic
Close the previous project if anything is open earlier

Silicon Institute Of Technology, Bhubaneswar

Page 2

A Hands-on-training Experience in VLSI Design

Open a new project

Silicon Institute Of Technology, Bhubaneswar

Page 3

A Hands-on-training Experience in VLSI Design

Give the project name and project location

Silicon Institute Of Technology, Bhubaneswar

Page 4

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 5

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 6

A Hands-on-training Experience in VLSI Design

The parameters (Family, Device, package and speed) are to be set here depending on the
parameters of the FPGA kit to which you want to burn the program. If you dont want to
burn any FPGA kit you can leave it as it is.

Press next button

Silicon Institute Of Technology, Bhubaneswar

Page 7

A Hands-on-training Experience in VLSI Design


Click on new source

Silicon Institute Of Technology, Bhubaneswar

Page 8

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 9

A Hands-on-training Experience in VLSI Design


Select VHDL module and give File name.

Press next

Silicon Institute Of Technology, Bhubaneswar

Page 10

A Hands-on-training Experience in VLSI Design


Give the port names. Specify whether it is a in or out port. Click on bus if a port is a
multi-bit one. Give the MSB & LSB. For Ex. If we take a 4 bit input, select on the bus &
give MSB =3 & LSB = 0

Press next

Silicon Institute Of Technology, Bhubaneswar

Page 11

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 12

A Hands-on-training Experience in VLSI Design

Check here about the pins you added are correct or not else back it and reassign the pins

Silicon Institute Of Technology, Bhubaneswar

Page 13

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 14

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 15

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 16

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 17

A Hands-on-training Experience in VLSI Design

After clicking finish button in the last step one fa.vhd file will be created. Open the
fa.vhd tab

Silicon Institute Of Technology, Bhubaneswar

Page 18

A Hands-on-training Experience in VLSI Design


Write the program in between the begin & end Behavioral block

Silicon Institute Of Technology, Bhubaneswar

Page 19

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 20

A Hands-on-training Experience in VLSI Design

Click on the plus sign near Synthesize XST (red circled)

Silicon Institute Of Technology, Bhubaneswar

Page 21

A Hands-on-training Experience in VLSI Design

Double click on check syntax

Silicon Institute Of Technology, Bhubaneswar

Page 22

A Hands-on-training Experience in VLSI Design

The syntax was checked successfully, if it fails then check for syntax

Silicon Institute Of Technology, Bhubaneswar

Page 23

A Hands-on-training Experience in VLSI Design

To see the RTL click on View RTL Schematics

Silicon Institute Of Technology, Bhubaneswar

Page 24

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 25

A Hands-on-training Experience in VLSI Design

Double click inside the module (green box) to see what are there inside it. Double click
outside the box to come to upper level

Silicon Institute Of Technology, Bhubaneswar

Page 26

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 27

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 28

A Hands-on-training Experience in VLSI Design

Now for simulation we have to add a test bench files as bellow


Open the source tab. Because in the previous step the Design tab was opened.

Silicon Institute Of Technology, Bhubaneswar

Page 29

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 30

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 31

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 32

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 33

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 34

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 35

A Hands-on-training Experience in VLSI Design

Select the combinational clock as bellow

Silicon Institute Of Technology, Bhubaneswar

Page 36

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 37

A Hands-on-training Experience in VLSI Design

Give the values of a, b and c which are to be added

Silicon Institute Of Technology, Bhubaneswar

Page 38

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 39

A Hands-on-training Experience in VLSI Design

Change to behavioral simulation

Silicon Institute Of Technology, Bhubaneswar

Page 40

A Hands-on-training Experience in VLSI Design

Click on the plus sign near fatest inside the red circle

Silicon Institute Of Technology, Bhubaneswar

Page 41

A Hands-on-training Experience in VLSI Design

Select the fatest.tbw file

Silicon Institute Of Technology, Bhubaneswar

Page 42

A Hands-on-training Experience in VLSI Design

Click on the process tab

Silicon Institute Of Technology, Bhubaneswar

Page 43

A Hands-on-training Experience in VLSI Design

Double click on Simulate Behavioral Model

Silicon Institute Of Technology, Bhubaneswar

Page 44

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 45

A Hands-on-training Experience in VLSI Design

See the output result and check it correctness

Silicon Institute Of Technology, Bhubaneswar

Page 46

A Hands-on-training Experience in VLSI Design

Steps to dump the code into a FPGA kit

Right-click on the fa.vhd file click on new source

Silicon Institute Of Technology, Bhubaneswar

Page 47

A Hands-on-training Experience in VLSI Design

Select Implementation Constraint File

Silicon Institute Of Technology, Bhubaneswar

Page 48

A Hands-on-training Experience in VLSI Design

Give the name of the Implementation Constraint File. This will come in the .ucf format

Silicon Institute Of Technology, Bhubaneswar

Page 49

A Hands-on-training Experience in VLSI Design

Finish it.

Silicon Institute Of Technology, Bhubaneswar

Page 50

A Hands-on-training Experience in VLSI Design

Change to Synthesis Implementation.

Silicon Institute Of Technology, Bhubaneswar

Page 51

A Hands-on-training Experience in VLSI Design

You should confirm that the .ucf file is coming under the .vhd file. If it has not come just
refresh it by pressing F5 key. Otherwise add the .ucf file once again.

Silicon Institute Of Technology, Bhubaneswar

Page 52

A Hands-on-training Experience in VLSI Design

Click on the .ucf file

Silicon Institute Of Technology, Bhubaneswar

Page 53

A Hands-on-training Experience in VLSI Design

Select the process tab

Silicon Institute Of Technology, Bhubaneswar

Page 54

A Hands-on-training Experience in VLSI Design

Open the user constraints. And double click on Edit constraint(Text)

Silicon Institute Of Technology, Bhubaneswar

Page 55

A Hands-on-training Experience in VLSI Design

You have to write the .ucf file in here.

Silicon Institute Of Technology, Bhubaneswar

Page 56

A Hands-on-training Experience in VLSI Design

The program written above indicates that the port a is mapped to P71 location of the kit.
(p71 location of the kit means the address of one input switch. This address you can get
from the manual given with the kit.) similarly the other ports are linked to the other
location of the kit.

Silicon Institute Of Technology, Bhubaneswar

Page 57

A Hands-on-training Experience in VLSI Design

Right click on the top module & changes its property to the property of the kit

Silicon Institute Of Technology, Bhubaneswar

Page 58

A Hands-on-training Experience in VLSI Design

The properties are given the manual.

Silicon Institute Of Technology, Bhubaneswar

Page 59

A Hands-on-training Experience in VLSI Design

Click on the .vhd file. Then double click on the implementation Design

Silicon Institute Of Technology, Bhubaneswar

Page 60

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 61

A Hands-on-training Experience in VLSI Design

Double click on Generate Programming File

Silicon Institute Of Technology, Bhubaneswar

Page 62

A Hands-on-training Experience in VLSI Design

Cancel the massage window

Silicon Institute Of Technology, Bhubaneswar

Page 63

A Hands-on-training Experience in VLSI Design

Connect the FPGA kit to the PC.


Double click on Configure device

Silicon Institute Of Technology, Bhubaneswar

Page 64

A Hands-on-training Experience in VLSI Design

Finish it.

Silicon Institute Of Technology, Bhubaneswar

Page 65

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 66

A Hands-on-training Experience in VLSI Design

Select the fa.bit file and press open button

Silicon Institute Of Technology, Bhubaneswar

Page 67

A Hands-on-training Experience in VLSI Design

Cancel it

Silicon Institute Of Technology, Bhubaneswar

Page 68

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 69

A Hands-on-training Experience in VLSI Design

Right click on the fa.bit file & program it

Silicon Institute Of Technology, Bhubaneswar

Page 70

A Hands-on-training Experience in VLSI Design

Press ok

Silicon Institute Of Technology, Bhubaneswar

Page 71

A Hands-on-training Experience in VLSI Design

Programming is going on

Silicon Institute Of Technology, Bhubaneswar

Page 72

A Hands-on-training Experience in VLSI Design

Programming is done successfully


Check the output now in the FPGA kit

Silicon Institute Of Technology, Bhubaneswar

Page 73

A Hands-on-training Experience in VLSI Design


1. Vhdl code for counter

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counter is
port(C, CLR : in std_logic;
Q : out std_logic_vector(3 downto 0));
end counter;
architecture Behavioral of counter is
signal tmp: std_logic_vector(3 downto 0);
begin
process (C, CLR)
begin
if (CLR='1') then
tmp <= "0000";
elsif (C'event and C='1') then
tmp <= tmp + 1;
end if;
end process;
Q <= tmp;
end Behavioral;
2. Vhdl Code For Prbs
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
--library UNISIM;
--use UNISIM.VComponents.all;
entity prbs is
Port ( CLK : in std_logic;
RSTn : in std_logic;
data_out : out std_logic_vector(15 downto 0));
end prbs;
architecture Behavioral of prbs is
component dff
Port ( CLK : in std_logic;
RSTn : in std_logic;

Silicon Institute Of Technology, Bhubaneswar

Page 74

A Hands-on-training Experience in VLSI Design


D : in std_logic;
Q : out std_logic);
end component;
signal data_reg : std_logic_vector(15 downto 0);
signal tap_data : std_logic;
begin
process(CLK)
begin
tap_data <= (data_reg(1) xor data_reg(2)) xor (data_reg(4) xor data_reg(15));
end process;
stage0: dff port map(CLK, RSTn, tap_data, data_reg(0));
g0:for i in 0 to 14 generate
stageN: dff port map(CLK, RSTn, data_reg(i), data_reg(i+1));
end generate;
data_out <= data_reg after 3 ns;
end Behavioral;
3. Vhdl Code For D-Flip Flop
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
--library UNISIM;
--use UNISIM.VComponents.all;
entity dff is
Port ( CLK : in std_logic;
RSTn : in std_logic;
D : in std_logic;
Q : out std_logic);
end dff;
architecture Behavioral of dff is
begin
process(CLK)
begin
if CLK'event and CLK='1' then
if RSTn='1' then
Q <= '1';
else
Q <= D;
end if;
end if;
end process;
end Behavioral;

Silicon Institute Of Technology, Bhubaneswar

Page 75

A Hands-on-training Experience in VLSI Design


4. Vhdl Code For Accumulaor
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity accu is
generic (accuWidth : natural := 4);
Port (clk : in STD_LOGIC;
rst : in STD_LOGIC;
accuEn : in STD_LOGIC;-- enable
accu_in : in STD_LOGIC_VECTOR (accuWidth-1 downto 0);
accu_out : out STD_LOGIC_VECTOR (accuWidth-1 downto 0));
end accu;
architecture Behavioral of accu is
begin
process (rst, clk)
-- note that we can have a bit vector for a variable
variable accu_v : STD_LOGIC_VECTOR (accuWidth-1 downto 0);
begin
-- async reset
if rst = '1' then
-- initialize the output and the variable to "0..."
accu_out <= (others=>'0');
accu_v := (others=>'0');
elsif clk'event and clk = '1' then
if accuEn = '1' then
accu_v := accu_v + accu_in;
end if;
end if;
accu_out <= accu_v;
end process;
end Behavioral;

Silicon Institute Of Technology, Bhubaneswar

Page 76

A Hands-on-training Experience in VLSI Design

Silicon Institute Of Technology, Bhubaneswar

Page 77

Vous aimerez peut-être aussi