digital design (using vhdl) ruwan gajaweera · digital design using vhdl developed in the early...
TRANSCRIPT
Digital Design using VHDL
Digital Design (using VHDL)
Ruwan Gajaweera [email protected]
Office: D006
Ver 1.2 -2016
Digital Design using VHDL
Autumn 2016
Digital Design using VHDL
Space Time Vs
FPGAs – all about
Digital Design using VHDL
b i
S 0
S 1 M
AE y i
Digital Design using VHDL
What is VHDL?
VHSIC
Hardware
Description
Language
VHSIC – Very High Speed Integrated Circuit
Digital Design using VHDL
Developed in the early 1980’s
Method of describing electronic systems for
the American Department of Defense
Use for digital design only
Synthesis tools used to create and
optimise the implementation
Digital Design using VHDL
Electronic Design Process
PLD/FPGA
Digital Design using VHDL
Electronic Design Process
In general VHDL is used with synthesis tools for ASIC and PLD
/FPGA design
PLD/FPGA
Digital Design using VHDL
Limitations of VHDL
Digital only, not analogue…yet
Dependent upon synthesis tools
Slightly different syntax
Limited control on physical hardware layout
Digital Design using VHDL
Typical PLD/FPGA Design Flow
Requirements
Design
Specification
Schematic
entry/HDL
coding
Functional simulation
Verifies logic model
and data flow
Xilinx
Spartan 6
-CLBs
Interconnects
IO blocks
Synthesis (Mapping)
Translate design into
device
specific primitives
Optimised – time/space
driven
Post-synthesis netlist
Place & route
(fitting)
Map primitives to
areas inside the
device and route
Post-fit netlist
Digital Design using VHDL
Typical PLD/FPGA Design Flow
Requirements
Design
Specification
Schematic
entry/HDL
coding
Functional simulation
Verifies logic model
and data flow
Xilinx
Spartan 6
-CLBs
Interconnects
IO blocks
Synthesis (Mapping)
Translate design into
device
specific primitives
Optimised – time/space
driven
Post-synthesis netlist
Place & route
(fitting)
Map primitives to
areas inside the
device and route
Post-fit netlist
Digital Design using VHDL
Each level of abstraction defines how much detail
about the design is specified in its description
RTL – Register Transfer Level
Levels of Abstraction in Digital Design
VHDL
description
Digital Design using VHDL
Layout is the lowest level of abstraction
Specifies the actual layout of the design on silicon, and may also specify detailed timing information or more “analogue” effects
Levels of Abstraction in Digital Design
Digital Design using VHDL
Logic level deals with the interconnection of logic gates and registers
Layout information and “analogue” effects are ignored
Deals with function, architecture, and technology
Levels of Abstraction in Digital Design
Digital Design using VHDL
Register Transfer Level – design is described by register
stages and combination logic in-between
Still contains architectural information
Levels of Abstraction in Digital Design
Digital Design using VHDL
Behavioural level uses VHDL to describe function of a
design, without specifying the architecture of registers
Contains as much timing information as a designer
requires to represent the function
Levels of Abstraction in Digital Design
Digital Design using VHDL
Levels of Abstraction in Digital Design
VHDL
description
Digital Design using VHDL
Behavioral Code – describes the functionality and behavior of the function
Behavioral vs. Structural Modelling
Structural Code -
describes the actual gate
and register level of the
function
Digital Design using VHDL
Typical PLD/FPGA Design Flow
Requirements
Design
Specification
Schematic
entry/HDL
coding
Functional simulation
Verifies logic model
and data flow
Xilinx
Spartan 6
-CLBs
Interconnects
IO blocks
Synthesis (Mapping)
Translate design into
device
specific primitives
Optimised – time/space
driven
Post-synthesis netlist
Place & route
(fitting)
Map primitives to
areas inside the
device and route
Post-fit netlist
Digital Design using VHDL
Typical Simulation Flow
VHDL
Library
VHDL
Model
VHDL
Testbench
Simulation
Compiler
Simulation
Model
Simulation
Text outputs
Waveform
Test
Vectors Altera.com
Xilinx.com
QuestaSim
Digital Design using VHDL
Typical Synthesis Design Flow
Digital Design using VHDL
VHDL Language Concepts
Concurrency – VHDL is able to describe activities that happen in parallel
Sequential – VHDL has statements that execute one after the other in sequence, such as a traditional software language like ‘C’
Hierarchy – the ability to describe the structure. Also, the ability to mix descriptions of structure with descriptions of behavior
Time – VHDL allows time to be modeled
Digital Design using VHDL
VHDL design units
Entity – used to define the external view of a model (Symbol)
Architecture – used to define the function of the model (schematic)
Packages/Library – collection of information that can be referenced by VHDL models – type definitions and functions to go with them
function
Digital Design using VHDL
---------------
LIBRARY ieee;
USE ieee.std_logic_1164.all;
--------------
ENTITY dff IS
PORT (d, clk, rst: IN STD_LOGIC;
q: OUT STD_LOGIC);
END dff;
-------------
ARCHITECTURE behaviour OF dff IS
BEGIN
PROCESS (rst, clk)
BEGIN
IF (rst = ‘1’) THEN
q <= ‘0’;
ELSIF (clk’EVENT AND clk=‘1’) THEN q <= d;
END IF;
END PROCESS;
END behaviour;
---------------------
VHDL Example - see again later
Digital Design using VHDL
---------------
LIBRARY ieee; -- library declaration
USE ieee.std_logic_1164.all; -- std and work visible by default
--------------
ENTITY dff IS
PORT (d, clk, rst: IN STD_LOGIC; -- IN STD_LOGIC
q: OUT STD_LOGIC); -- OUT STD_LOGIC
END dff;
-------------
ARCHITECTURE behaviour OF dff IS
BEGIN
PROCESS (rst, clk) -- executed ever time a signal declared
BEGIN -- in its list changes. Here rst & clk
IF (rst = ‘1’) THEN -- rst goes to ‘1’ q <= ‘0’; -- output reset to ‘0’ ELSIF (clk’EVENT AND clk=‘1’) THEN -- no rst, and q <= d; -- clock change to 1 (rising edge )
END IF; -- output = d
END PROCESS;
END behaviour;
---------------------
VHDL Example - see again later
Digital Design using VHDL
Basic VHDL Structure
LIBRARY
declarations
ENTITY
ARCHITECTURE
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY entity_name IS
PORT (……)
END entity_name;
ARCHITECTURE arch_name OF entity_name IS
[declarations]
BEGIN
code …….
END arch_name;
Digital Design using VHDL
---------------
LIBRARY ieee; -- library declaration
USE ieee.std_logic_1164.all; -- std and work visible by default
--------------
ENTITY dff IS
PORT (d, clk, rst: IN STD_LOGIC; -- IN STD_LOGIC
q: OUT STD_LOGIC); -- OUT STD_LOGIC
END dff;
-------------
ARCHITECTURE behaviour OF dff IS
BEGIN
PROCESS (rst, clk) -- executed ever time a signal declared
BEGIN -- in its list changes. Here rst & clk
IF (rst = ‘1’) THEN -- rst goes to ‘1’ q <= ‘0’; -- output reset to ‘0’ ELSIF (clk’EVENT AND clk=‘1’) THEN -- no rst, and q <= d; -- clock change to 1 (rising edge)
END IF; -- output = d
END PROCESS;
END behaviour;
---------------------
LIBRARY
declarations
ENTITY
ARCHITECTURE
VHDL Example - see again later
Digital Design using VHDL
Libraries
Contains a package or a collection of packages
Resource Libraries
Standard Package
IEEE developed packages
Xilinx (FPGA) Component packages
Any library of design units that are referenced in a design
Working Library
Library into which the unit is being compiled
Digital Design using VHDL
All packages must be compiled
Implicit Libraries
work
STD
LIBRARY Clause
Defines the library name that can be reference
It’s a symbolic name to path/directory - defined by the compiler
USE Clause
Specifies the package and object in the library that you have specified in the library clause
Model Referencing of Libraries/Packages
Note: Items in these packages do not need to
be referenced, they are implied
Digital Design using VHDL
LIBRARY std;
Contains the following packages
Standard (Types: Bit, Boolean, Integer, Real, and
Time - and operator functions to support these
types)
Textio (File operations)
An implicit library (built-in)
Does not need to be referenced
Libraries
Digital Design using VHDL
LIBRARY IEEE;
Contains the following packages:
std_logic_1164 (std_logic types & related functions)
std_logic_arith (arithmetic functions)
std_logic_signed (signed arithmetic functions)
std_logic_unsigned (unsigned arithmetic functions)
numeric_std (unsigned arithmetic functions using
standard logic vectors defined as signed and
unsigned date types)
Libraries
Digital Design using VHDL
Libraries in VHDL
LIBRARY <name>;
USE <name>.<package_name>.all;
LIBRARY ieee;
USE ieee.std_logic_1164.all;
Digital Design using VHDL
LIBRARY ieee;
USE ieee.std_logic_1164.all;
----------------
ENTITY tri-state IS
PORT (ena :IN STD_LOGIC;
input :IN STD_LOGIC_VECTOR (7 DOWNTO 0);
output :OUT STD_LOGIC_VECTOR (7 DOWNTO 0));
END tri_state;
---------------
ARCHITECTURE tri_state OF tri_state IS
BEGIN
output <= input WHEN (ena = ‘0’) ELSE (OTHERS => ‘Z’); END tri_state;
Simple example - will see again later
Digital Design using VHDL
Libraries in VHDL
LIBRARY ieee; -- semi-colon indicates the end of a statement
USE ieee.std_logic_1164.all; -- ieee multi-level logic system
LIBRARY std; -- Resource library (data types, text I/O etc)
USE std.standard.all; -- for VHDL design environment
LIBRARY work; -- library is where we save our design
USE work.all; -- (.vhd file & compiler & simulator etc files)
-- NOTE: std and work visible by default.
Digital Design using VHDL
End of lecture 1
History of VHDL
Background to the design process and level of abstraction
Libraries
Simple examples of VHDL descriptions