Escolar Documentos
Profissional Documentos
Cultura Documentos
1. Flujo de diseo
2. Lenguaje de descripcin Hardware
3. Simulacin con VHDL
4. Estructura de un modelo VHDL
5. Elementos bsicos de VHDL
6. Mquina de estados nitos
7. Otros elementos de VHDL
8. Test-bench de simulacin
9. Introduccin a las FPGAs
toc
toc
1. Flujo de diseo
2. HDL
Qu es HDL?
Lenguaje especcamente creado para el diseo de circuitos:
Nivel de puerta (gate level).
Nivel de comportamiento (behavioural level).
2. HDL
VHDL
VHSIC (Gobierno de EE.UU. 1980).
IEEE VHDL87.
www.vhdl.org
Verilog
SystemVerilog
toc
2. HDL
VHDL
Descripcin de la estructura del circuito
Descomposicin en sub-circuitos
Interconexin de sub-circuitos
Comportamiento
Estructural
toc
2. HDL
D
S
A and B
D or C
toc
2. HDL
t = 5ns
t = 10ns
A = 0
A = 1
B = 1
B = 1
C = 0
C = 0
Descripcin 1
D = A and B;
S = D or C;
Descripcin 2
S = D or C;
D = A and B;
toc
Ejemplo I
C <= B;
B <= A;
Valores iniciales
A=U
B=U
A=0
C=U
A=1
0+ 0+2
B=0
C=0
toc
t(ns)
A
B
C
0
0
U
U
0 +
0
0
U
5+ 5+2
fempo (ns)
B=1 C=1
0 + 2
0
0
0
No hay
ms
cambios
5
1
0
0
5 +
1
1
0
5 + 2
1
1
1
No hay
ms
cambios
Ejemplo II
Valores iniciales
A=U
B=U
C=U
D=U
S=U
D <= A and B;
S <= D or C;
A=0
B=0
C=0
2
5
D=0
S=0
toc
B=1
A=1
10
10+
10+2
D=1 D=1
S=1
fempo (ns)
Ejemplo III
Valores iniciales
A=U
B=U
C=U
D=U
S=U
S <= D or C;
D <= A and B;
A=0
B=0
C=0
2
5
D=0
S=0
toc
B=1
A=1
10
10+
10+2
D=1 D=1
S=1
fempo (ns)
Descripcin de un sistema
digital:
A
B
entity F is
port (A: in bit;
B: in bit;
Y: out bit);
end F;
toc
Architecture
Dene internamente el circuito
Seales internas, funciones, procedimientos, constantes
entity nombre is
port (lista de puertos de entrada y salida);
end nombre;
lista de puertos de entrada-salida
nombre_puerto: fpo_de_puerto fpo_de_seal;
entradaA: in bit_vector(7 downto 0);
Mulfplexor 8 a 1:
entity multiplexor is
port (
);
end multiplexor;
de architecture.
Cada architecture va asociada a una enGty y se indica
en la primera sentencia.
A confnuacin, y antes de begin se denen:
Seales
Tipos
Componentes: otros circuitos ya denidos y compilados de
los cuales conocemos su interfaz en VHDL (su enGty).
toc
Dentro de la arquitectura:
Seales:
Representan elementos de memoria o conexiones.
Los puertos de una enfdad.
En la arquitectura antes del BEGIN, lo cual nos permite realizar
conexiones entre diferentes mdulos.
seal <= valor
Variables
Se uflizan como ndices (instrucciones de bucle o modelar
componentes).
Las variables NO representan conexiones o estados de memoria.
variable := valor
entity F is
port (A, B: in std_logic; Y out std_logic);
end F
architecture circuito of F is
signal D, E: std_logic_vector(1 downto 0);
seales
signal H: std_logic;
begin
()
end architecture circuito;
EN SIMULACIN
Slo se ejecutan las
sentencias que se
encuentran dentro del
process si alguna de las
seales de la lista de
sensibilidad ha
cambiado de valor
A=1
0+
B=0
t (ns)
A
B
C
0
0
U
U
process (A)
begin
B <= A;
C <= B;
end process;
5+
fempo (ns)
B=1
C=0
0 +
0
0
U
No hay ms
cambios
5
1
0
U
5 +
1
1
0
No hay ms
cambios
A=1
0+
B=0
t (ns)
A
B
C
0
0
process (A)
begin
C <= B;
B <= A;
end process;
5+
fempo (ns)
B=1
C=0
0 +
0
No hay ms
cambios
5
1
5 +
1
No hay ms
cambios
B=0
C=0
A=1
5
process (A)
begin
d := A;
e := d;
C <= d;
B <= e;
end process;
5+
B=1
C=1
fempo (ns)
if a = b then
c <= a or b;
elsif a<b then
c <= b;
else
c <= 0000;
end if;
t = 5 ns
t = 10 ns
t = 15 ns
a <= 0010
a <= 0010
a <= 0010
b <= 0010
b <= 0110
b <= 0001
Segn avance el curso se observarn las consecuencias malignas de la uflizacin de los process
t = 5 ns
t = 10 ns
t = 15 ns
a <= 0010
a <= 0010
a <= 0010
b <= 0010
b <= 0110
b <= 0001
Segn avance el curso se observarn las consecuencias malignas de la uflizacin de los process
t = 5 ns
t = 10 ns
t = 15 ns
a <= 0010
a <= 0010
a <= 0010
b <= 0010
b <= 0110
b <= 0001
Segn avance el curso se observarn las consecuencias malignas de la uflizacin de los process
case expression is
when choice_l => ... -- statements;
when choice_n => ... -- statements;
when others => ... -- statements;
end case;
case RGB is
when 111 => r <= 0;
when 100 => r <= 1;
when 110 => r <= 1;
when others => r <= 0;
end case;
Bucles
[label:] loop
sequence-of-statements
-- use exit statement to get out
end loop [label];
[label:] for var in range loop
sequence-of-statements
end loop [label];
Wait
Ejemplos:
Atributos
S'DELAYED(t) is the signal value of S at fme now - t .
S'STABLE is true if no event is occurring on signal S.
S'STABLE(t) is true if no even has occurred on signal S for t units of
fme.
S'QUIET is true if signal S is quiet. (no event this simulafon cycle)
S'QUIET(t) is true if signal S has been quiet for t units of fme.
S'TRANSACTION is a bit signal, the inverse of previous value each cycle
S is acfve.
S'EVENT is true if signal S has had an event this simulafon cycle.
S'ACTIVE is true if signal S is acfve during current simulafon cycle.
S'LAST_EVENT is the fme since the last event on signal S.
S'LAST_ACTIVE is the fme since signal S was last acfve.
S'LAST_VALUE is the previous value of signal S.
Sentencias secuenciales:
Deben aparecer
SIEMPRE dentro de un
process (clk, )
signalevent
signallast_event
signallast_value
Biestables, registros
toc
Tipos de datos
Tipos enteros y reales
INTEGER
NATURAL
REAL
Tipos ]sicos
TIME
RESISTENCIA
Tipos de datos
Tipos enumerados
BIT: {0, 1}
BOOLEAN : {TRUE, FALSE}
CHARACTER : {ascii}
STD_LOGIC : {U, X, 0, 1, Z, W, L, H, -}
Tipos de datos
Pueden denirse fpos adicionales:
Enumerados
Sub-fpos: subconjunto de fpos
nuevo_fpo ::= type idenfcador is denicin_fpo;
type_name
range
n_min TO n_max n_max DOWNTO n_min
toc
Operadores bsicos:
abs
*, /, mod, rem
+ , -
&
and, or, nand, nor
y<=(x1 and x2) or d(0);
y(1) <= x1 and not x2;
y: bit_vector(1 downto 0);
y <= x1&x2;
Moore
Mealy
toc
Lgica Combinacional
Registros
Flip-op
Salidas
end beh;
toc
E=1
E=0
S1
O = 0
E=1
E=0
S2
O = 0
E=1
E=0
S3
O = 0
E=0
E=1
S4
O = 1
toc
library IEEE;
use IEEE.std_logic_1164.all;
en1ty FSM is
port(reset, E, clk: in bit; O: out bit);
end FSM;
architecture ARCH of FSM is
type ESTADOS is (S1, S2, S3,S4);
signal ESTADO, SIG_ESTADO: ESTADOS;
begin
SINCRONO: process(clk,reset)
begin
if reset ='1' then
ESTADO<=S1;
elsif clk'event and clk='1' then
ESTADO<= SIG_ESTADO;
end if;
end process SINCRONO;
end ARCH;
COMB: process(ESTADO,E)
begin
case ESTADO is
when S1 =>
O <= '0';
if (E='0') then SIG_ESTADO<=S2;
else SIG_ESTADO<=S1;
end if;
when S2 =>
O <= '0';
if (E='0') then SIG_ESTADO<=S3;
else SIG_ESTADO<=S1;
end if;
when S3 =>
O <= '0';
if (E='0') then SIG_ESTADO<=S3;
else SIG_ESTADO<=S4;
end if;
when S4 =>
O <= '1';
if (E='0') then SIG_ESTADO<=S2;
else SIG_ESTADO<=S1;
end if;
end case;
end process COMB;
7. Otros elementos
toc
Descripcin estructural
architecture arch_name of entity_name is
component component_name
generic ();
port ();
end component;
signal declarations;
begin
component_i: component_name
generic map (parameter_value)
port map (io_name)
end arch_name;
7. Otros elementos
toc
Ejemplo
architecture structure of F is
component G
port (Ag, Bg: in bit; Yg: out bit);
end component;
component H
port (Ah, Bh: in bit; Yh: out bit);
end component;
component I
port (Ai, Bi: in bit;Yi: out bit);
end component;
signal YA, YB, Yout: bit;
begin
mod_G: G port map (A, B, YA);
mod_H: H port map (A, B, YB);
mod_I : I port map (YA; YB; Yi);
Y<=Yout;
end structure;
mod_G
Ag
G
Bg
Yg
mod_H
Ah
H Yh
Bh
YA
YB
mod_I
Ai
Bi
Yi
Yout
7. Otros elementos
toc
Ejemplo
architecture struct of f is
component g
port (ag, bg: in bit; yg: out bit);
end component;
A
component h
port (ah, bh: in bit; yh: out bit);
end component;
component i
port (ai, bi: in bit;yi: out bit);
end component;
B
signal ya, yb, yout: bit;
begin
mod_g: g port map (a, b, ya);
mod_h: h port map (a, b, yb);
mod_i : i port map (ya, yb, yout);
salida: y<=yout;
end architecture struct;
mod_G
Ag
Yg
G
Bg
mod_H
Ah
H Yh
Bh
YA
YB
mod_I
Ai
Bi
Yi
Yout
7. Otros elementos
toc
component comp
port( x: in bit; y: out bit);
end comp
signal a, b: bit_vector(0 to 7)
7. Otros elementos
toc
8. Test-bench de simulacin
toc
entity test-bench
end test-bench;
Diseo a vericar
entity F is
port (A, )
end F;
8. Test-bench de simulacin
toc
Estructura bsica
entity F is
port (A, B: in bit; Y out bit); Diseo a vericar
end F;
8. Test-bench de simulacin
toc
Estructura bsica
begin
uut: F port map(
A => A,
B => B,
Y => Y);
tb : process
begin
vi) Se denen los valores iniciales de las
A<=0;
entradas
B<=0;
wait for 100 ns;
B<= 1;
vi) Se denen los
wait for 100 ns; -- instante 200 ns
valores de las entradas
A<=1;
en los siguientes
wait for 100 ns; -- instante 300 ns
instantes de fempo
wait; -- espera para siempre
end process tb;
end;
8. Test-bench de simulacin
toc
A
B
t
tb : process
begin
A<=0;
B<=0;
wait for 100 ns;
B<= 1;
wait for 100 ns; -- instante 200 ns
A<=1;
wait for 200 ns; -- instante 400 ns
A<=0;
B<=0;
wait for 100 ns; -- instante 500 ns
A<=1;
wait for 200 ns; -- instante 700 ns
B<=1;
wait for 100 ns; -- instante 800 ns
wait;
end process tb;
8. Test-bench de simulacin
toc
Memorias
Mulfplicadores
Micro-controladores
CLB
Celda de interconexin
Celda I/O
Las estructuras de
interconexionado son
muy costosas
Implementacin de un Banco
de registros sobre FPGA
toc
Biestables
Se uflizan en el caso de que la celda deba implementar HW
secuencial
Se puede congurar si son disparados por anco o por nivel
Mulfplexores
Para interconectar las entradas con los mdulos o los
mdulos entre si se uflizan mulfplexores
toc
a b c d | salida
0 0 0 0 1
0 0 0 1 0
0 0 1 0 0
0 0 1 1 1
0 1 0 0 0
1 1 1 1 1
a
b
c
d
0
0
1
0
1
salida
toc
0
1
X
X
X
x
toc
salida
toc
Xilinx
hZp://www.xilinx.com/company/press/grounder.htm
hZp://www.xilinx.com/company/about/overview.html
toc
Arquitecturas de Xilinx
Spartan
Spartan III
Spartan VI
Virtex
Virtex II
Virtex IV
Virtex V
Virtex VI
Caracters1cas Generales:
Arquitecturas de grano no
Aunque en Virtex II y IV empieza a aparecer un diseo
heterogneo
Reconguracin no dinmica
toc
toc
toc
toc