Estoy intentando simular un flip flop D usando Vivado 2018.2.2. Pero al ejecutar la simulación, aparece una ventana que indica la hora actual: 0 fs. El programa no se congela, simplemente no progresa. Aquí está el código:
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
ENTITY Dff IS
port (d, clk, rst: in std_logic;
q : out std_logic);
END ENTITY Dff;
ARCHITECTURE behav OF Dff IS
BEGIN
main : PROCESS
BEGIN
IF rst='1' THEN
q <= '0';
ELSIF rising_edge(clk) THEN
q <= d;
END IF;
END PROCESS main;
END ARCHITECTURE behav;
Y el banco de pruebas:
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
ENTITY Dff_tb IS
END Dff_tb;
ARCHITECTURE behav OF Dff_tb IS
CONSTANT T : time := 10 ns;
CONSTANT N : INTEGER := 3;
COMPONENT Dff
PORT(
d : IN std_logic;
clk : IN std_logic;
rst : IN std_logic;
q : OUT std_logic
);
END COMPONENT;
SIGNAL d : std_logic := '0';
SIGNAL clk : std_logic := '0';
SIGNAL rst : std_logic := '0';
SIGNAL q : std_logic;
SIGNAL sim_data : std_logic_vector (N downto 0) := "0011";
BEGIN
Dff_0 : Dff PORT MAP (d => d, clk => clk, rst=>rst, q => q);
clk_pr : PROCESS
BEGIN
clk <= '0';
WAIT FOR T/2;
clk <= '1';
WAIT FOR T/2;
END PROCESS clk_pr;
main_pr : PROCESS
VARIABLE i : INTEGER := 0;
BEGIN
rst <= '1';
wait for T*2;
rst <= '0';
d <= '0';
wait for T*2;
rst <= '0';
d <= '1';
wait;
END PROCESS main_pr;
END ARCHITECTURE behav;
Soy nuevo en VHDL, así que probablemente sea algo obvio. Cualquier ayuda es apreciada.
EDITAR: Tras un comentario, edité el código de mi banco de pruebas de esta manera:
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
ENTITY Dff_tb IS
END Dff_tb;
ARCHITECTURE behav OF Dff_tb IS
CONSTANT T : time := 10 ns;
CONSTANT N : INTEGER := 3;
COMPONENT Dff
PORT(
d : IN std_logic;
clk : IN std_logic;
rst : IN std_logic;
q : OUT std_logic
);
END COMPONENT;
SIGNAL d : std_logic := '0';
SIGNAL clk : std_logic := '0';
SIGNAL rst : std_logic := '0';
SIGNAL q : std_logic;
SIGNAL sim_data : std_logic_vector (N downto 0) := "0011";
SHARED VARIABLE sim_end : boolean := false;
BEGIN
Dff_0 : Dff PORT MAP (d => d, clk => clk, rst=>rst, q => q);
clk_pr : PROCESS
BEGIN
IF sim_end = false THEN
clk <= '0';
WAIT FOR T/2;
clk <= '1';
WAIT FOR T/2;
ELSE
WAIT;
END IF;
END PROCESS clk_pr;
main_pr : PROCESS
VARIABLE i : INTEGER := 0;
BEGIN
rst <= '1';
wait for T*2;
rst <= '0';
d <= '0';
wait for T*2;
rst <= '0';
d <= '1';
sim_end := true;
wait;
END PROCESS main_pr;
END ARCHITECTURE behav;
Pero el problema persiste.