2014-10-25 5 views
0

초보자이며 첫 번째 VHDL 코드 카운터를 사용하여 7_segment 디스플레이를 적용하는 코드 2 코드를 컴파일 할 때 테스트 벤치 코드에서 6 개의 오류가 발생하는 동안 주 코드에는 오류가 없었습니다. 어떤 도움이 필요합니까?카운터 VHDL을 사용하여 7 세그먼트 디스플레이 적용

홈페이지 코드 :

LIBRARY ieee; 
USE ieee.std_logic_1164.all; 
USE ieee.std_logic_arith.all; 

ENTITY counter IS 
port (clk,rst: IN std_logic; 
    count: OUT std_logic_vector(6 downto 0)); 
END counter; 

ARCHITECTURE rtl OF counter IS 
signalcount_sig: integer range 0 to 7; 
BEGIN 
    PROCESS(clk,rst) 
    begin 
     if(rst='1')then 
      count_sig<=0; 
     elsif(rising_edge (clk))then 
      count_sig<= count_sig+1; 
     end if; 

     if (count_sig=0)  then count <= "1000000"; 
     elsif (count_sig=1) then count <= "1111001"; 
     elsif (count_sig=2) then count <= "0100100"; 
     elsif (count_sig=3) then count <= "0110000"; 
     elsif (count_sig=4) then count <= "0011001"; 
     elsif (count_sig=5) then count <= "0010010"; 
     elsif (count_sig=6) then count <= "0000010"; 
     elsif (count_sig=7) then count <= "1111000"; 
     end if; 
    end PROCESS; 
END rtl; 

테스트 벤치 코드 : 테스트 벤치 코드에서

LIBRARY ieee; 
USE ieee.std_logic_1164.all; 
USE ieee.std_logic_arith.all; 

ENTITY test_counter IS 
END test_counter; 

ARCHITECTURE beh OF test_counter IS 

    COMPONENT counter IS 
    port (clk, rst: in std_logic; 
count: out std_logic_vector(6 downto 0)); 
    END counter; 

    SIGNAL clk, rst: std_logic; 
    SIGNAL count: std_logic_vector(6 downto 0); 

    BEGIN 
     V1: counter PORT MAP 
     (clk<=clk , 
     rst<=rst , 
     count<=count); 

     clock : PROCESS 
     begin 
     wait for 5 ns; clk<= not clk; 
     end PROCESS clock; 

     reset : PROCESS 
     begin 
     rst<= '1'; 
     wait for 10 ns; rst<= '0'; 
     wait for 80 ns; 
     end PROCESS reset; 

    END beh; 

답변

0

이 구성 요소 선언의 끝이 아니다 END counter; 수 있지만하려면 다음

END component counter; 

또는 바로 :

구성 요소 인스턴스에 대한

<=하지만 =>를 사용하지 않는 신호 (정식) (실제) 포트 이름과 매핑, 그래서 코드 인스턴스화해야합니다 :

V1: counter PORT MAP 
    (clk => clk, 
    rst => rst, 
    count => count); 
관련 문제