Escolar Documentos
Profissional Documentos
Cultura Documentos
Design Suite
EDIG
Content
Simulacin: Test benches
Ejemplos
EDIG
VHDL: Testbenches
EDIG
Escritura
del cdigo
Simulacin
Sntesis
bitstream
Depuracin y
optimizacin
EDIG
Desarrollo
Descripcin del sistema en un lenguaje de
descripcin hardware (VHDL)
Verificacin
Sntesis lgica
Comprobacin mediante
simulaciones de que el
funcionamiento es el descrito
en la especificacin
Colocacin y rutado
Asignacin de los circuitos e interconexiones
a elementos concretos dentro de la FPGA
EDIG
Programacin
Test
Simulacin
Necesitamos comprobar que el circuito que
hemos diseado cumple las especificaciones
Ejemplo: la salida de una funcin lgica es correcta
para todas las combinaciones de entrada
Testbench
Un testbench es una entidad/arquitectura VHDL
con las siguientes caractersticas:
La entidad est vaca, no tiene puertos de entrada o
salida
Emplea una descripcin estructural y el diseo que se
va a comprobar se introduce con un component
instantiation
Normalmente se conoce al diseo que se va a comprobar
como DUT (design under test) o UUT (unit under test)
Uso de after
Una manera sencilla de generar estmulos
variables en el tiempo es emplear asignaciones de
seales con after.
y <= 1, 0 after 2ns, 1 after 4ns;
EDIG
EDIG
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY andtestbench IS
END andtestbench;
Conectamos estructuralmente la
entidad que queremos
probar/simular a las seales
internas que hemos definido
(Parte 4)
EDIG
S
B
S = AB + AB
EDIG
EDIG
--------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity OOR2 is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
S : out STD_LOGIC);
end OOR2;
architecture Behavioral of OOR2 is
begin
S <= A or B;
end Behavioral;
A
B
A
B
entity XXOR2
Port ( A
B
S
end XXOR2;
begin
U1 : NNOT1 port map (A,SN1);
U2 : NNOT1 port map (B,SN2);
U3 : AAND2 port map (SN1,B,SN3);
U4 : AAND2 port map (A,SN2,SN4);
U5 : OOR2 port map (SN3,SN4,S);
end Behavioral;
is
: in STD_LOGIC;
: in STD_LOGIC;
: out STD_LOGIC);
EDIG
SN1
SN3
S
B
SN4
SN2
EDIG
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY test_xor2 IS
END test_xor2;
ARCHITECTURE behavior OF test_xor2 IS
COMPONENT XXOR2
PORT(
A : IN std_logic;
B : IN std_logic;
S : OUT std_logic
);
END COMPONENT;
signal C,D : std_logic;
signal S : std_logic;
Resultado de la simulacin
VHDL : Ejemplo
Otra forma ms sencilla de introducir una tabla de
verdad
Queremos comprobar el funcionamiento
del mdulo AND2 anterior:
entity AND2 is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
S : out STD_LOGIC);
end AND2;
COMPONENT AND2
PORT(
A : IN std_logic;
B : IN std_logic;
S : OUT std_logic
);
END COMPONENT;
signal in_vector : std_logic_vector(1 downto 0) := "00";
signal S : std_logic;
END;
MAP (
in_vector(1),
in_vector(0),
S
"00",
"01" after 2ns,
"10" after 4ns,
"11" after 6ns;
Ejemplo minterms
Implemente la funcin
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
y = a, b, c (0,3)
entity truth_table is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
y : out STD_LOGIC);
end truth_table;
begin
temp <= a & b & c;
with temp select y <=
'1' when "000",
'1' when "011",
'0' when others;
end Behavioral;
EDIG
EDIG
Signal 1
a
b
g(a,b,c)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity funcion_g is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
y : out STD_LOGIC);
end funcion_g;
EDIG
begin
u1: funcion_f PORT MAP (
a => a,
b => b,
c => c,
y => signal1
);
u2: funcion_f PORT MAP (
a => signal1,
b => a,
c => b,
y => y
);
end structural;