간단한 카운터 구현을 테스트 할 때 GHDL 시뮬레이션은 시뮬레이션을 종료하지 않습니다. 내 의도는 주 프로세스에 의해 변경된 공유 변수를 사용하여 두 프로세스를 동시에 중지하는 것입니다. 그러나 주요 프로세스는 시계 프로세스를 멈추지 않는 것입니다.wait 문을 사용한 VHDL 시뮬레이션 중지
내 카운터 구현은 다음과 같습니다
entity dff is
port(
direction, reset, clk, load : in std_logic;
din : in std_logic_vector(3 downto 0);
dout : out std_logic_vector(3 downto 0));
end dff;
architecture behav of dff is
signal temp : std_logic_vector(3 downto 0);
begin
process(clk, reset)
begin
if (reset='1') then
temp <= "0000";
elsif rising_edge(clk) then
if (load='1') then
temp <= din;
else
if (direction='0') then
temp <= std_logic_vector(unsigned(temp) + 1);
else
temp <= std_logic_vector(unsigned(temp) - 1);
end if;
end if;
end if;
dout <= temp;
end process;
end behav;
그리고 내 테스트 벤치 : 나는 더이처럼 클럭 생성기를 코딩 할
architecture behav of test_tb is
component dff port(
direction, reset, clk, load : in std_logic;
din : in std_logic_vector(3 downto 0);
dout : out std_logic_vector(3 downto 0));
end component;
signal direction, reset, clk, load : std_logic := '1';
signal din, dout : std_logic_vector(3 downto 0) := x"7";
shared variable simend : boolean := false;
begin
clkk : process
begin
if simend=false then
clk <= not clk after 50 ns;
else
wait;
end if;
end process clkk;
uut : dff port map(
direction, reset, clk, load, din, dout);
stim : process
begin
reset <= '0';
wait for 1 us;
load <= '0';
wait for 2 us;
direction <= '0';
wait for 2 us;
load <= '1';
wait for 1 us;
reset <= '1';
wait for 0.5 us;
simend := true;
wait;
end process stim;
end behav;
최근 ghdl 버전에서는 [--assert-level =] (http://ghdl.readthedocs.io/en/latest/Simulation_and_runtime.html?highlight=severity) 및 --ieee- asserts = 표준 패키지에서 경고를 차단하여 단언 문에서 SEVERITY_LEVEL HALT에 대해 말을 멈추게합니다. 또한 지연을 50 ns의 대기 시간에서 분리 할 수 있습니다. clk <= clk가 아님; simend = true이면 기다립니다. end if; 프로세스 문은 자연스럽게 반복됩니다. –
user1155120
클럭 킬러의 오버 헤드를 피하고 대신 @scary_jeff가 제안한대로 std.env.stop을 사용하는 것이 좋습니다. –