2017-01-17 1 views
0

이 코드의 영향을 이해하는 데 어려움이있어 : 내 구성 요소 :민감도 목록의 변수를 변경하면 vhdl에서 프로세스가 트리거되는 시점은 언제입니까?

library IEEE; 
use IEEE.std_logic_1164.all; 

entity problem is 
    port(
    clk : in std_logic; 
    a : in std_logic); 
end problem; 

architecture impl of problem is 
    signal a_sig : std_logic; 

begin 
    clk_proc : process(clk) 
    begin 
    if rising_edge(clk) then 
     a_sig <= '0'; 
    end if; 
    end process; 

    a_proc : process(a) 
    begin 
    report "a received : " & std_logic'image(a); 
    a_sig <= a; 
    end process; 

    a_sig_proc : process(a_sig) 
    begin 
    report "a_sig set : " & std_logic'image(a_sig); 
    end process; 
end impl; 

이 내 testbench.vhd입니다 :

library IEEE; 
use IEEE.std_logic_1164.all; 

entity testbench is 
end testbench; 

architecture tb of testbench is 
    component problem is 
    port (clk : in std_logic; 
      a : in std_logic); 
    end component; 

    constant clk_period : time := 1 ms; 
    signal clk_sig : std_logic; 
    signal a_sig : std_logic; 
begin 
    dut : problem port map (clk_sig, a_sig); 

    process 
    begin 
    clk_sig <= '1'; 
    wait for clk_period/2; 
    clk_sig <= '0'; 
    wait for clk_period/2; 
    end process; 

    process 
    begin 
    wait for clk_period * 0.75; 
    a_sig <= '1'; 
    end process; 

end tb; 

다음과 같이 코드가 실행의 결과 :

는 는
$ ghdl -r testbench --vcd=testbench.vcd --stop-time=2ms 
problem.vhd:23:5:@0ms:(report note): a received : 'U' 
problem.vhd:29:5:@0ms:(report note): a_sig set : 'U' 
problem.vhd:23:5:@750us:(report note): a received : '1' 
problem.vhd:29:5:@1ms:(report note): a_sig set : 'X' 
./testbench:info: simulation stopped by --stop-time 

I는 'U'신호가 수신되는 에선 0ms 이해할 수 있으며, I는 '1'신호를 파악할 수는 수신 750 마이크로 초에 문제가 생겼어. 가장 먼저 혼란스럽게 생각하는 것은 왜 문제가 아닌지입니다 .a_sig_proc은 동일한 프로세스에서 a_sig가 설정되어 트리거됩니다. 그런 다음 problem.a_sig_proc이 트리거되면 a_sig의 값은 'X'입니다. 누군가가 이것을 설명하기 위해 나에게 자원을 넘겨 줄 수 있다면 큰 일 것입니다. :)

미리 감사드립니다!

답변

2

여러 프로세스 (clk_proc 및 a_proc)에서 a_sig 신호를 보내고 있습니다. 프로세스 중 하나에서 a_sig에 대한 할당을 제거해야합니다 (시뮬레이터가 어떤 배정이 우선 할지를 결정할 수 없기 때문에). "회전"이 아닌 동안 프로세스에서 a_sig로 'Z'(높은 임피던스)를 구동해야합니다. 좋은 설명이 있습니다 herehere

관련 문제