Основной вопрос в Test Bench'е - не пойму вообще как в нем что писать!
Собственно код:
Код
-- trigger1.vhd
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
LIBRARY IEEE;
USE IEEE.std_logic_unsigned.all;
entity dff is
port (data, clk : in std_logic;
q : out std_logic);
end dff;
architecture behav of dff is
begin
process (clk) begin
if (clk'event and clk='1') then
q <= data;
end if;
end process;
end behav;
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
LIBRARY IEEE;
USE IEEE.std_logic_unsigned.all;
entity dff is
port (data, clk : in std_logic;
q : out std_logic);
end dff;
architecture behav of dff is
begin
process (clk) begin
if (clk'event and clk='1') then
q <= data;
end if;
end process;
end behav;
Тэст:
Код
-- trigger1_tb.vhd
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
LIBRARY IEEE;
USE IEEE.std_logic_unsigned.all;
entity trigger1_tb is
end trigger1_tb;
architecture tb_arch of trigger1_tb is
component dff
port(data : in std_logic;
clk : in std_logic;
q : out std_logic);
end component;
shared variable END_SIM: boolean := false;
signal D : std_logic:='0';
signal C : std_logic:='0';
signal Q : std_logic:='0';
begin
UUT : dff
port map (data => D,
clk => C,
q => Q);
CLK_GEN: process begin
if not END_SIM then
C <= '0';
wait for 10 ns;
C <= '1';
wait for 10 ns;
else wait;
end if;
end process;
STIMULUS: process begin
D <= '1';
wait for 200 ns;
D <= '0';
wait for 200 ns;
END_SIM := TRUE;
wait;
end process;
end tb_arch;
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
LIBRARY IEEE;
USE IEEE.std_logic_unsigned.all;
entity trigger1_tb is
end trigger1_tb;
architecture tb_arch of trigger1_tb is
component dff
port(data : in std_logic;
clk : in std_logic;
q : out std_logic);
end component;
shared variable END_SIM: boolean := false;
signal D : std_logic:='0';
signal C : std_logic:='0';
signal Q : std_logic:='0';
begin
UUT : dff
port map (data => D,
clk => C,
q => Q);
CLK_GEN: process begin
if not END_SIM then
C <= '0';
wait for 10 ns;
C <= '1';
wait for 10 ns;
else wait;
end if;
end process;
STIMULUS: process begin
D <= '1';
wait for 200 ns;
D <= '0';
wait for 200 ns;
END_SIM := TRUE;
wait;
end process;
end tb_arch;
Помогите разобраться, плиз!
