Unit 2 - Introduction To VHDL
Unit 2 - Introduction To VHDL
Digital Electronics
• Bibliography: “Digital Design: Principles and Practices”, J.F. Wakerly. Prentice‐Hall, 4th ed., Chap. 5
• “Sistemas Electrónicos Digitales”, E. Mandado. Marcombo, 10ª Ed., Cap. 5 y 7.
Rev. 2021‐09‐21
1
Index
2.1. Hardware Description Languages (HDL)
2.1.1. Introduction to HDLs
2.1.2. Synthesis of HDLs
2.1.3. Characteristics of HDLs
2.2. Very‐high‐speed integrate circuit HDL (VHDL)
2.2.1. Top‐Down Design Methodology
Digital Electronics
HDL
Schematic
Capture
RT Synthesis
Digital Electronics
VHDL
Code Optimized Circuit
XOR MUX
FF
AND NOT
Optimization
Generic Logical Model Mapped Logical Circuit
Restrictions
Manufacturer
Library TEC Technology Mapping Tmax
• Between 1983 and 1984, Texas Instruments and Intermetrics developed the
first version, that was introduced to IEEE.
• On December 1984 it is accepted by the IEEE Standards Board, and its first
version was published in 1987 (VHDL‐87).
• In 1993 a second version was published, with some changes (VHDL‐93)
• In 2002 a third version was released (VHDL‐2002), a few years later VHDL‐
2008 and so forth.
• It is important to know with which version of the software tools are we
going to work. The language has not changed its basics since 1993, but
more resources have been added for experienced designers.
Specification
Specification
Document
System
Level
Digital Electronics
Descending
architecture
begin
Hardware
architecture
internal structure. It is related with an entity
entity
M1
Digital Electronics
M3
architecture M2
A1 A2 A3
configuration
Optional
Outputs
Inputs
entity <entity_name> is Entity
port (<port_name>: <mode> <type>;
Digital Electronics
….
);
end <entity_name>;
• Example: entrada1
entrada2
Digital Electronics
salida
entrada3
Incorrect Correct
The first character must be a letter 4Suma Suma4
The second character can not be an underscore S_4bits S4_bits
Two underscore together are not allowed Resta__4 Resta_4_bits
No other symbols are allowed Resta_4# Resta_4_num
integer
Objects Types
Digital Electronics
boolean
signal Numerical
bit
constant
Compound array
• Examples:
Digital Electronics
type std_logic is ( ʽUʼ, ʽXʼ, ʽ0ʼ, ʽ1ʼ, ʽZʼ, ʽWʼ, ʽLʼ, ʽHʼ, ʽ‐ʼ );
type std_logic is (
‘U’, -- uninitialized
‘X’, -- forcing unknown
‘0’, -- forcing zero
‘1’, -- forcing one
‘Z’, -- high impedance
‘W’, -- weak unknow
‘L’, -- weak zero
‘H’, -- weak one
‘-’ -- don´t care
);
ieee.std_logic_1164.
type std_logic_vector is
array (integer range <>) of std_logic;
• Examples
signal datos1: std_logic_vector (7 downto 0);
signal datos2: std_logic_vector (0 to 15);
• Format:
subtype <name_subtype> is <type_base> range <limits_range>
• Example
subtype DIGITO is integer range 0 to 9;
Relational Logical
= /= and or nand nor
< <= > => xor not
Digital Electronics
Arithmetics Others
** abs & (concatenation)
* / mod rem + ‐ (sign change)
+ ‐
• One architecture belongs to an specific entity, however one entity can have
many architectures associated.
Digital Electronics
• Declaration:
Architecture Entity
ESTRUCTURAL
Data Flow
Concurrent
Digital Electronics
Components
Assignations
Signals
PORTS
Styles of assignations
Variables
Behavioral
Sequence:
Process and
subprograms
Concurrent Sequential
• The concurrent
• The sequential sentences
sentences are executed
are executed one after
Digital Electronics
• The order of the sentences has no effect on the simulation nor on the
Digital Electronics
• Two sentences
• WITH ‐ SELECT
• WHEN ‐ ELSE
WITH – SELECT
All possible cases of the SEL signal
with <EXPRESION> select must be described
<S_D> <= <EXP1> when <CASO1>,
<EXP2> when <CASO2> | <CASO3>, <S_D> can be an output or one internal
<EXPn> when others; signal (neve an input)
Digital Electronics
WHEN ‐ ELSE
entrada1
entrada2
salida
entrada3
<ETIQ>: process[(<LISTA_SEÑALES>)]
<DECLARACIONES>
Digital Electronics
begin
Sequential
<SENTENCIAS_SECUENCIALES> Sentences
end process <ETIQ>;
Signal assignation and
variable control flow
if...then...else...
case...is...when...=>...
while...loop...
Declarative part for...loop...
loop...
Execution control
declaration of variables,
constants sensitivity list
wait on...for...until...
WAIT clause
P1: process(A, B)
begin If the wait clause is used, all the control paths must
X <= A; have a wait
Y <= B;
end process P1;
end if;
entrada1
entrada2
salida
entrada3
...
when others =>
<SEQUENTIAL_SENTENCES>]
end case;
entrada2
salida
entrada3
LOOP sentence
for <INDEX> in <RANGE> loop
• Example <SEQUENTIAL_SENTENCES>
end loop;
Digital Electronics
<ETIQ>: loop
<SEQUENTIAL_SENTENCES>
[exit <ETIQ> when <BOOLEAN_EXPR>]
[next <ETIQ> when <BOOLEAN_EXPR>]
end loop <ETIQ>;
component <N_COMP>
Digital Electronics
begin
sentences zone
<C_REF>: <N_COMP>
Instantiation and
port map(<PORT_LIST>);
components
interconnections
end <N_ARCH>;
entity sumador is
port(a,b,c: in bit; sum,cout:out bit);
end sumador;
component XOR2
port(p1,p2: in bit; pz:out bit);
end component;
signal s1: bit;
begin
process(a,b,c)
variable t1,t2,t3: bit;
begin
t1:= a and b;
t2:= a and c;
t3:= b and c;
cout <= t1 or t2 or t3;
end process;
end mix_descr;
• The libraries have information about design units, including entities and
architectures.
library IEEE;
• To use a package
Digital Electronics
use ieee.std_logic_1164.all