Documentos de Académico
Documentos de Profesional
Documentos de Cultura
MODELOS DE HARDWARE.
EL LENGUAJE VHDL
MODELOS DE HARDWARE.
Modelo de estructura
Modelo de concurrencia
Modelo de tiempo (simulacin)
Modelo de sntesis
evento
a
b
5 ns
S a
5 ns
b
S
S = a b
C = a b
C
5 ns 10 ns15 ns20 ns
real
Modelo hardware
PR
CLK
D CL Q
2ns
PR Q
CL
CLK
D
Q
5ns 10ns 15ns 20ns
EL LENGUAJE VHDL
MODELO DE ESTRUCTURA .
EL LENGUAJE VHDL
MODELO DE CONCURRENCIA .
IN: 1->0
EL LENGUAJE VHDL
MODELO DE CONCURRENCIA .
Entorno concurrente
process
begin
end;
secuencial secuencial
process
begin
end;
end;
EL LENGUAJE VHDL
MODELO DE TIEMPO .
El lenguaje VHDL utiliza un modelo temporal para simular hardware de una manera
realista (concurrencia, retardos, etc).
El cdigo VHDL se comporta como el hardware que modela cuando se somete a una
serie de estmulos sobre el tiempo de simulacin (Banco de pruebas).
Banco de pruebas
Estmulos
Modelo VHDL
Instrucciones
Los ESTMULOS actualizan los valores de las SEALES de entrada del modelo,
ocasionando EVENTOS en ellas que disparan la ejecucin de procesos en el
modelo.
EL LENGUAJE VHDL
MODELO DE TIEMPO .
Estmulos
Instante actual
de simulacin T
1 fase
ACTUALIZA
SEALES
Siguiente instante
de simulacin T+T
2 fase
ACTIVA
PROCESOS
Se activan aquellos procesos sensibles a los eventos de las seales actualizadas en el paso
anterior. En la ejecucin de los procesos se planifican nuevos valores para stas u otras seales
que pueden provocar el disparo de nuevos procesos. Los procesos se ejecutan sin incrementarse
el tiempo fsico de simulacin. Se simula la concurrencia con un tiempo simulado, delta en la cola
de eventos.
EL LENGUAJE VHDL
MODELO DE TIEMPO .
Si no se especifica ningn retardo el lenguaje fija uno conocido como retardo delta
().
El retardo delta no se corresponde con ningn retardo real, permite ordenar eventos
que ocurren en el mismo tiempo fsico de simulacin.
EL LENGUAJE VHDL
MODELO DE TIEMPO .
MODELO
ESTIMULOS
a<=1;
a<=1;
waitfor
for44ns;
ns;
wait
a<=0;
a<=0;
waitfor
for44ns;
ns;
wait
a<=1;
a<=1;
wait;
wait;
entityinv
invisis
entity
port(a:
(a:ininbit;
bit;
port
outbit);
bit);
b:b:out
endinv;
inv;
end
architectureejem
ejemofofinv
invisis
architecture
begin
begin
process (a)
process (a)
begin
begin
b<=not
nota aafter
after1ns;
1ns;
b<=
endprocess;
process;
end
endejem;
ejem;
end
a=1
a=0
Tiempo
sim. (ns)
a=1
Eventos
a
a=1
a=0
b=0
b=1
b=0
8
9
EL LENGUAJE VHDL
a=1
Cola Eventos
b (valor, tiemp)
Valor
b
(0,1)
0 (inicio)
--
(1,5)
--
(0,9)
--
MODELO DE TIEMPO .
ESTIMULOS
MODELO
entitycirc
circisis
entity
port
(a,b
bit;
port (a,b : :ininbit;
sal: :out
outbit);
bit);
sal
end
circ;
end circ;
architectureejem
ejemofofcirc
circisis
architecture
signal
nodo:
bit;
signal nodo: bit;
begin
begin
nodo<=
<=a aand
andb;b;
nodo
sal
<=
not
nodo;
sal <= not nodo;
end
ejem;
end ejem;
<=1;
a a<=1;
b<=1;
b<=1;
waitfor
for55ns;
ns;
wait
a
<=0;
a <=0;
waitfor
for55ns;
ns;
wait
<=1;
a a<=1;
b<=0;
b<=0;
waitfor
for55ns;
ns;
wait
a
<=0;
a <=0;
wait;
wait;
t. sim
(ns)
Eventos
a
a=1
Nodo
b=1
Cola Eventos
(valor, t)
Nodo
Sal
5+
5+
a=1
b=0
EL LENGUAJE VHDL
Nodo Sal
0
--
--
(0,2)
--
(0,5+ )
nodo
--
sal
(1,5+2 )
--
5+2
10
Valor
N=0
sal
(1, )
2
a=0
nodo
(1,)
N=1
0ns
10ns
20ns
(0,10+ )
MODELO DE TIEMPO .
ESTIMULOS
<=1;
a a<=1;
b<=1;
b<=1;
waitfor
for55ns;
ns;
wait
a
<=0;
a <=0;
waitfor
for55ns;
ns;
wait
<=1;
a a<=1;
b<=0;
b<=0;
waitfor
for55ns;
ns;
wait
a
<=0;
a <=0;
wait;
wait;
MODELO
entitycirc
circisis
entity
port
(a,b
bit;
port (a,b : :ininbit;
sal: :out
outbit);
bit);
sal
end
circ;
end circ;
architectureejem
ejemofofcirc
circisis
architecture
signal
nodo:
bit;
signal nodo: bit;
begin
begin
nodo<=
<=a aand
andbbafter
after33ns;
ns;
nodo
sal
<=
not
nodo
after
2
ns;
sal <= not nodo after 2 ns;
endejem;
ejem;
end
a
b
nodo
3ns
sal
2ns
a
b
nodo
sal
0ns
EL LENGUAJE VHDL
10ns
20ns
10
MODELO DE TIEMPO .
MODELO
d1
q1
FF1
clk
Q
FF2
q2
entityejemplo
ejemploisis
entity
port
(d1,clk
bit;
port (d1,clk : :ininbit;
q2: :out
outbit);
bit);
q2
end
ejemplo
;
end ejemplo ;
architecturertlrtlofofejemplo
ejemploisis
architecture
signal
q1:
bit;
signal q1: bit;
begin
begin
FF1:process
process(clk)
(clk)
FF1:
begin
begin
clkeventand
andclk=1
clk=1then
then
ififclkevent
q1<=d1;
q1<=d1;
end
end if;if;
end
process
FF1;
end process FF1;
FF2:
process
(clk)
FF2: process (clk)
begin
begin
clkeventand
andclk=1
clk=1then
then
ififclkevent
q2<=q1;
q2<=q1;
endif;if;
end
endprocess
processFF2;
FF2;
end
endrtl;
rtl;
end
EL LENGUAJE VHDL
11
MODELO DE TIEMPO .
d1
ESTIMULOS
clk<=0;
<=0;
clk
d1<=0;
d1<=0;
waitfor
for22ns;
ns;
wait
d1
<=1;
d1 <=1;
waitfor
for33ns;
ns;
wait
clk<=1;
<=1;
clk
wait
for55ns;
ns;
wait for
clk<=0;
<=0;
clk
wait
for55ns;
ns;
wait for
clk<=1;
<=1;
clk
waitfor
for55ns;
ns;
wait
clk
<=0;
clk <=0;
d1<=
<=0;
0;
d1
wait
for
ns;
wait for 55ns;
clk<=1;
<=1;
clk
waitfor
for55ns;
ns;
wait
clk
<=0;
clk <=0;
wait;
wait;
q1
clk
FF1
clk
d1
2
D
q1
q2
FF2
q2
0
t. sim
(ns)
0
2
5
5+
5+
10
15
15+
20
25
25+
EL LENGUAJE VHDL
Eventos
d1
clk
Cola Eventos
(valor, t)
q1
q2
q1
d1=1
(1,5+ )
--
clk=1
(0,5+ )
q1=1
clk=0
clk=1
clk=0
clk=1
10
15
20
25
30
Valor
q1
q2
0
0
0
1
1
0
0
0
0
0
0
0
1
1
1
1
(1,10+)
--
(1,10+)
--
(0,25+)
(1,25+)
1
1
1
1
1
--
--
d=0
12
MODELO DE TIEMPO .
ESTIMULOS
r<=1;
r<=1;
s<=0;
s<=0;
waitfor
for55ns;
ns;
wait
r
<=0;
r <=0;
waitfor
for55ns;
ns;
wait
<=1;
s s<=1;
wait
for55ns;
ns;
wait for
r
<=1;
r <=1;
waitfor
for55ns;
ns;
wait
<=0;
r r<=0;
s<=0;
s<=0;
wait;
wait;
MODELO
entity rs
rs is
is
entity
port
(r,
in
bit;
port (r, ss :: in
bit;
q
:
inout
bit;
q
: inout bit;
qn :: inout
inout bit);
bit);
qn
end rs;
rs;
end
architecture RTL
RTL of
of rs
rs is
is
architecture
begin
begin
<= rr nor
nor qn;
qn;
qq <=
qn
<=
s
nor
q;
qn <= s nor q;
end
RTL;
end RTL;
error
EL LENGUAJE VHDL
13
MODELO DE TIEMPO .
library ieee;
ieee;
library
use
ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
ieee.numeric_std.all;
use
entity
num_unos is
is
entity num_unos
port
(a
:
in
std_logic_vector(7 downto
downto 0);
0);
port (a : in std_logic_vector(7
b
:
out
std_logic_vector(3
downto
0));
b : out std_logic_vector(3 downto 0));
end num_unos;
num_unos;
end
architecture behavioral
behavioral of
of num_unos
num_unos is
is
architecture
signal
n
:
unsigned(3
downto
0)
:=
"0000";
signal n : unsigned(3 downto 0) := "0000";
begin
begin
process (a)
(a)
process
begin
begin
<= "0000";
"0000";
nn
<=
for
i
in
a'range
loop
for i in a'range loop
if a(i)
a(i) == '1'
'1' then
then
if
n
<=
n+1;
n <= n+1;
end
if;
end if;
end
loop;
end loop;
<= std_logic_vector(n);
std_logic_vector(n);
bb
<=
end
process;
end process;
end
behavioral;
end behavioral;
EL LENGUAJE VHDL
14
MODELO DE TIEMPO .
EL LENGUAJE VHDL
codigo1
92
codigo2
92
codigo3
--
codigo4
-15
MODELO DE SNTESIS .
EL LENGUAJE VHDL
16