digital design (using vhdl) ruwan gajaweera · digital design using vhdl developed in the early...

35
Digital Design using VHDL Digital Design (using VHDL) Ruwan Gajaweera [email protected] Office: D006 Ver 1.2 -2016

Upload: tranphuc

Post on 03-Aug-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

Digital Design using VHDL

Digital Design (using VHDL)

Ruwan Gajaweera [email protected]

Office: D006

Ver 1.2 -2016

Page 2: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

Digital Design using VHDL

Autumn 2016

Page 3: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

Digital Design using VHDL

Space Time Vs

FPGAs – all about

Page 4: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

Digital Design using VHDL

b i

S 0

S 1 M

AE y i

Page 5: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

Digital Design using VHDL

What is VHDL?

VHSIC

Hardware

Description

Language

VHSIC – Very High Speed Integrated Circuit

Page 6: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 7: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

Digital Design using VHDL

Electronic Design Process

PLD/FPGA

Page 8: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

Digital Design using VHDL

Electronic Design Process

In general VHDL is used with synthesis tools for ASIC and PLD

/FPGA design

PLD/FPGA

Page 9: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 10: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 11: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 12: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 13: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 14: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 15: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 16: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 17: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

Digital Design using VHDL

Levels of Abstraction in Digital Design

VHDL

description

Page 18: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 19: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 20: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 21: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

Digital Design using VHDL

Typical Synthesis Design Flow

Page 22: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 23: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 24: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 25: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 26: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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;

Page 27: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 28: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 29: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 30: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 31: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 32: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

Digital Design using VHDL

Libraries in VHDL

LIBRARY <name>;

USE <name>.<package_name>.all;

LIBRARY ieee;

USE ieee.std_logic_1164.all;

Page 33: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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

Page 34: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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.

Page 35: Digital Design (using VHDL) Ruwan Gajaweera · Digital Design using VHDL Developed in the early 1980’s Method of describing electronic systems for the American Department of Defense

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