Introduction To System Design, VHDL Basics
Introduction To System Design, VHDL Basics
Introduction to System
Design, VHDL Basics
TIE-50206 Logic Synthesis
Arto Perttula
Tampere University of Technology
Fall 2017
Contents
• 1. Introduction to System Design
– Abstraction
– Main phases
• 2. VHDL basics
– Entity – the interface
– Architecture – the behavior
– Continues next week
1. INTRODUCTION TO
SYSTEM DESIGN
Arto Perttula 26.10.2017 4
Examples of Different Views
• View: different perspectives of a system
1. Behavioral view:
– Describe functionalities and I/O behavior
– Treat system as a black box
2. Structural view:
– Describe the internal implementation
(components and interconnections)
– Essentially a block diagram (or schematic)
3. Physical view:
– Add more info to structural view: component size, component locations, routing wires
– E.g., layout of a print circuit board
outputs:
led0_out
audio_out
...
Function:
When user presses
button1, then...
When...
higher abstraction
Arto Perttula 26.10.2017 6
Complexity Management
• Q: How to manage complexity for a chip with 10 million transistors?
• A: Abstraction – a simplified model of a system
– Show the selected features
– Ignore many details
• E.g., timing of an inverter
ELT-
xxxx
DigiPer.
Dig Suunn
adder
divide Dig.Suunn.
FSM
this
SW CPU MEM
behavioral NOC System
I/O ACC design
Comb.
D Q using RTL
logic
abstraction
11
Register-Transfer Level (RTL) (2)
• RT (Register Transfer) is a bit misleading term
• Two meanings:
1. Loosely: represent the module level
2. Formally: a design methodology in which the system operation is described by how the data is manipulated
and moved among registers
T2 x2 foo(x1) bar(foo(x0))
a_r b_r c_r
...,x1,x0 D Q foo() D Q bar() D Q
12
Key for Success: Hierarchy
Syntax:
Corresponds to the entity
Parameters
Ports
Arto Perttula 14
Example
• A hierarchical two-digit decimal counter
– pulse=1 when q is 9
– p100=1 when both q_ten and q_one are 9
– However, if en goes 0 when q=9, something strange happens…
• Let’s concentrare on the structure…
Top-level block diagram, ”hundred_counter”
Single
counter
component
15
Example Implemented in VHDL
Top-level entity
1. INTRODUCTION TO
SYSTEM DESIGN
Arto Perttula 26.10.2017 17
System Development
• Developing a digital system is a refining and validating process
• Main tasks:
I. requirements
I-III. verification
capture, specification
1. INTRODUCTION TO
SYSTEM DESIGN
Arto Perttula 26.10.2017 25
EDA Software
• EDA (Electronic Design Automation) software can automate many tasks
• Mandatory for success together with re-use!
• Can software replace human hardware designer? (e.g., C-program to chip)
• Synthesis software
– Should be treated as a tool to perform transformation and local optimization
– Cannot alter the original architecture or convert a poor design into a good one
– See also the so called ”Mead & Conway revolution”
• EDA tools abstraction level in functional description has not increased
significantly since mid-90’s when RT-level gained popularity
– Increased abstraction always causes some penalty in performance, area etc.
when increasing abstraction, but significant improvement in time to design
Arto Perttula 26.10.2017 26
Design Flow
data file process
– Design partition
device simulation/
(Quartus)
C <= A AND B
Physical design 34
Interface
Ports Declarations
Functionality
• Provide communication channels (=pins) between the component and its environment
• Each port must have a name, direction and a type
– An entity may omit port declaration, e.g., in test bench
• Port directions:
1. IN: A value of a port can be read inside the component, but cannot be assigned. Multiple reads
of port are allowed.
2. OUT: Assignment can be made to a port, but data from a port cannot be read. Multiple
assignments are allowed.
3. INOUT: Bi-directional, assignments can be made and data can be read. Multiple assignments
are allowed. (not recommended inside a chip)
4. BUFFER: An out port with read capability. May have at most one assignment (not recommended)
Signals Declarations
Functionality
entity
VHDL declaration
source package
files declaration
architecture
architecture package configuration
architecture
body
body body declaration
body
arch declarations:
• Architectures contains usually either signals,
functions,
a) processes types
or arch body:
b) instantiations concurrent statements
component instantiations,
processes
(signal assignments,
if-for-case)
entity_name.vhd
Arto Perttula
Relation Between Circuit and VHDL
Realization Examples GENERIC VHDL STRUCTURE
A : IN
B : IN
Sel : IN
add C : OUT
A
Adder
B
0
Multiplier 1 C
mul signal add, mul
Components +, *
declaration
The interface of a
block ”even_detector”
Input a, 3 bits
Output even, 1 bit
p4
Functionality of the
block (gate level
representation).
The order of
assigments does
NOT matter here
(concurrent
statements).
Arto Perttula 26.10.2017 46
VHDL Summary
Language Purpose Other notes C++ counterpart
constructs in VHDL
ENTITY Defines interface. Includes generics and ports ”Public interface”, the actual implementation is Class definition
(their names, widths, and directions). hidden into architecture.
GENERIC Instance-specific constant value Excellent idea in HDL! Constant parameters, templates
PORT I/O pin of an entity. Defines direction and type. See also signal. Method of a class, inter-process
message
ARCHITECTURE Contains functionality. One entity may have many architectures in the Class implementation
library
SIGNAL, Communication channel between They are not the same! Variables only inside Variable
(VARIABLE) components/processes. processes
COMPONENT For instantiating a sub-block Needed for hierarchy. Class instance, object
PROCESS These capture most of the functionality. Processes are executed in parallel. Both seq. Thread
and comb.
IF,FOR,CASE, Control statements Bounds must be known for loops at compile- The same
ASSIGNMENT time
PACKAGE Contains shared definitions. Constants, functions, procedures, types Header file (file.h)
LIBRARY Holds analyzed (’compiled’) codes Standard ieee library is practically always used Compiled object codes (file.o)
• The behavior of the system over the clock prediods is defined by registers