2014-02-14 2 views
0

내 문제에 대한 이유 또는 대답은 다음과 같습니다 : 내 VHDL 코드가 작동 중이고 주파수 분배기를 10 개 만들려고합니다. 문제는 시뮬레이션 보고서가 나에게 정의되지 않은 출력 (값 없음)을 계속 제공한다는 것입니다.내 VHDL 코드에 대한 시뮬레이션을 할 수 없습니다

이것은 내 VHDL 코드입니다. 어떤 도움을 주셔서 너무 감사드립니다! 고맙습니다!

Library ieee; 
use ieee.std_logic_1164.all; 
use ieee.std_logic_arith.all; 
use ieee.std_logic_unsigned.all; 

entity Frequency_divider is 
port(clk: in std_logic; 
    Q:out std_logic); 
end Frequency_divider; 

architecture desc_freq_divider_10 of Frequency_divider is 


signal S: std_logic:='0'; 
begin 

process(clk,S) 
    variable cpt: integer:=0; 
    begin 

     if (rising_edge(clk)) then 
      cpt:=cpt+1; 
     end if; 

     if (cpt=5) then 
      S<=not(S); 
      cpt:=0; 
     end if; 

    end process;  
    Q<=S; 
end desc_freq_divider_10;  

답변

1

나는 외부 사용 조항을 제거있어 :

--use ieee.std_logic_arith.all; 
--use ieee.std_logic_unsigned.all; 

추가에게 테스트 벤치를 :

library ieee; 
use ieee.std_logic_1164.all; 

entity freq_test is 
end entity; 

architecture tb of freq_test is 
    signal CLK:  std_logic :='0'; 
    signal Q:  std_logic; 
begin 

CLOCK: 
    process 
    begin 
     if Now < 300 ns then 
      wait for 10 ns; 
      clk <= not clk; 
     else 
      wait; 
     end if; 
    end process; 
DUT: 
    entity work.frequency_divider 
     port map (clk,q); 
end architecture; 

는, 그것의 모든 분석 정교하고 시뮬레이션하고 일을 얻었다.

freq_test output divide by 10

그것은 코드가 작동하고 가능성이보다 툴 체인 사용 오류가 더 많이 가지고 있다고 말한다. 데이비드 신발과 가방 설명으로

1

시뮬레이션, 잘해야하지만, 합성 설계 프로세스가 감도 목록 만 clk을해야하고, 같은 if 성명에서 모든 업데이트가 있어야합니다

process(clk) 
    variable cpt : integer range 0 to 5 := 0; -- Must be constrained for synthesis 
begin 
    if (rising_edge(clk)) then 
    cpt := cpt+1; 
    if (cpt = 5) then 
     S <= not(S); 
     cpt := 0; 
    end if; 
    end if; 
end process; 

다른 디자인 래치 및 유사한 문제를 추측 할 가능성이 있습니다.

2014-02-17 편집 : 합성이 최소 크기를 알 수 없으므로 cpt 정수에 제한이 추가되어 너무 많은 플립 플롭을 만듭니다.

관련 문제