2012-12-13 2 views
1

프로젝트가 끝나기가 거의 다되었지만 어느 시점에서 멈추었습니다. 문제를 해결할 수 없습니다.VHDL - 7 세그먼트 디스플레이에서 스크롤링

VHDL이 배열 색인을 힘들이지 않게 이동한다고 결정한 후, 나는 시프터 모듈을 변경하기로 결정했습니다. 이제 제대로 컴파일되고 RTL 회로도가 사실로 보이지만 불행히도 스캔 코드를 이동하는 데 혁신적이지 않은 방법을 사용했습니다.

최대 8 개의 스캔 코드를 저장할 수있는 64 비트 std_logic_vector를 정의한 다음이 벡터의 4 MSBmost 바이트를 구문 분석 한 다음 7 개의 세그먼트 컨트롤러로 보내고 7 개의 세그먼트를 사용할 입력을 멀티플렉싱합니다. 시계에 문제가 있다고 생각하지만 디스플레이에 아무것도 표시되지 않으면 기기의 일부가 오작동한다고 생각합니다. 내 키보드 컨트롤러가 잘 작동한다고 확신한다. 시프터도 괜찮아 보인다. (FPGA에서도이 코드를 시도했지만 시계를 늦추지 않고 입력 한 마지막 스캔 코드를 볼 수 있었다.) 어떤 방법이나 방법을 7 세그먼트 컨트롤러를 시도해 보지 못했지만, 너무 잘 보인다. 나는 문제가, 텍스트 :(

Top Module

스크롤되지 Shifter.vhd

무엇인지 모르는
library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
use IEEE.STD_LOGIC_UNSIGNED.ALL; 
use IEEE.numeric_std.all; 

entity my_shifter is 
     port(clk  : in std_logic; 
       Scan_Dav : in std_logic; 
       Data_in : in std_logic_vector (7 downto 0); 
       O1 : out std_logic_vector(7 downto 0); 
       O2 : out std_logic_vector(7 downto 0); 
       O3 : out std_logic_vector(7 downto 0); 
       O4 : out std_logic_vector(7 downto 0) 
       ); 
end my_shifter; 

architecture bhv of my_shifter is 

signal bytes : std_logic_vector(63 downto 0); 
begin 
    process (clk) begin 
     if rising_edge(clk) then 
       if Scan_Dav = '1' then 
        bytes <= bytes (bytes'high-8 downto 0) & Data_in; 
       end if; 
      end if; 
    end process; 
    O1 <= bytes(63 downto 56); 
    O2 <= bytes(55 downto 48); 
    O3 <= bytes(47 downto 40); 
    O4 <= bytes(39 downto 32); 
end bhv; 

clkdivide.vhd

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
use IEEE.STD_LOGIC_ARITH.ALL; 
use IEEE.STD_LOGIC_UNSIGNED.ALL; 

entity clkdivide is 
    Port (clkin: in std_logic; 
      clkout:out std_logic); 
end clkdivide; 

architecture Behavioral of clkdivide is 
    signal int_clock:std_logic; 
    begin 
     clkout<=int_clock; 
    process(clkin) 
     variable var:integer range 0 to 12500 :=0; 
     begin 
      if (clkin'event and clkin = '1') then 
       if var = 12500 then 
        int_clock <= not int_clock; 
        var:=0; 
       else 
        var:=var+1; 
       end if; 
      end if; 
    end process; 
end Behavioral; 

SevenSegmentControl.vhd :

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
use IEEE.STD_LOGIC_UNSIGNED.ALL; 
use IEEE.STD_LOGIC_ARITH.ALL; 

entity SevenSegmentController is 
    port (
     CLK: in std_logic; 
     DEC1, DEC2, DEC3, DEC4: in std_logic_vector(7 downto 0); 
     SEGMENTS: out std_logic_vector(6 downto 0); 
     ANODES: out std_logic_vector(3 downto 0) 
    ); 
end SevenSegmentController; 

architecture Behavioral of SevenSegmentController is 
    signal DecoderInput: std_logic_vector(7 downto 0); 
    signal CurrentDisplay: std_logic_vector(1 downto 0) := "00"; 
    signal Prescaler: std_logic_vector(15 downto 0) := (others => '0'); 
begin 

    Multiplex: process(CLK) 
    begin 
     if rising_edge(CLK) then 
      if Prescaler(15) = '0' then 
       Prescaler <= Prescaler + 1; 
      else 
       CurrentDisplay <= CurrentDisplay + 1; 
       Prescaler <= (others => '0'); 
      end if; 
     end if; 
    end process Multiplex; 

    SevenSegmentDecoder: entity work.SevenSegment_Decoder(Behavioral) 
     generic map (INVERT_OUTPUT => '1') 
     port map (number => DecoderInput, segment => SEGMENTS); 

    DecoderInput <= DEC1 when CurrentDisplay = "00" else 
         DEC2 when CurrentDisplay = "01" else 
         DEC3 when CurrentDisplay = "10" else 
         DEC4 when CurrentDisplay = "11"; 

    ANODES <= "0111" when CurrentDisplay = "00" else 
       "1011" when CurrentDisplay = "01" else 
       "1101" when CurrentDisplay = "10" else 
       "1110" when CurrentDisplay = "11";    

end Behavioral; 
+0

실제 디스플레이 나 시뮬레이션 된 디테일에서 숫자가 보이지 않습니까? 디스플레이를 개별적으로 테스트 했습니까? SevenSegment_Decoder 란 무엇입니까? – Philippe

+0

Seven Segment Decoder는 스캔 코드를 g_to_a (SEGMENTS)로 변환하는 구성 요소입니다. 실제로 실제 디스플레이 (BASYS2 FPGA)에 숫자가 표시되며 이동도되지만 함께 볼 수는 없지만 마지막으로 누른 키가 화면에 표시됩니다. 나는 결국 시계 문제가 있다고 생각하고있다 ... – John

답변

0

우리는 SevenSegment_Decoder의 인터페이스 프로토콜을 모른다.하지만 두 개의 입력 만 있지만 시계는 없다는 것은 재미있다. 디코더는 신호 해석시기를 어떻게 알 수 있습니까?

+0

7 세그먼트 디코더는 일반적으로 FPGA의 조합 (및 또는 어레이) 또는 ROM 또는 LUTS이며 시계는 필요 없다. –

+0

디코더가 오류의 원인이 아닙니다. 나는 몇몇 오류를 해결했다. 이제는 7 세그먼트 디스플레이에서 텍스트를 볼 수 있습니다. 예를 들어 P와 O를 누르면 내가 보는 텍스트는 "PPPOO .."입니다. 여기서 더 진행할 수있는 방법이 없습니다. 내가 생각하는 한 가지 생각은 shifter 모듈의 if 문입니다. 나는 그들이 내 사용법에 적합하지 않다고 생각하기 시작했다. 그러나 더 나은 해결책을 생각할 수 없었다. .. – John

+0

"잘못된"전환에 대해 알아 차리는 또 다른 중요한 점은 내가 거의 비슷하지만 클럭 최적화에 관한 것처럼 보인다는 것이다. 모든 시계가 해당 모듈에 적합해야합니다. 키보드 컨트롤은 보드 클럭 인 50 mHz를 사용하여 모듈 내부에서 1/8로 나눕니다.쉬프트는 clkdivide 출력이며, 7SegmentController는 2kHz를 사용합니다. 각 디스플레이 유닛을 구별하지 않아도됩니다. – John

0

는 당신이 ISE의 ​​아주 오래된 버전을 사용하지 않는 경우, ISE10보다 확실히 나이가

"나는 7 세그먼트 컨트롤러를 사용해 어떤 식 으로든/방법을 생각하지 않은"그것은 (ISIM을 상당히 괜찮은 시뮬레이터를 가지고) 내장되어 있습니다. (ISIM은 ISE10보다 뒤떨어졌지만 실제로 사용할 수 없었고 ISIM 10에서도 문제가있었습니다 ...)

간단한 테스트 벤치 및 단위 테스트를 작성하면 많은 시간을 절약 할 수 있습니다. 당신이 따라갈 때이 모듈을 테스트했습니다.

+0

ISE 12.4를 사용 중이고 testbenching에 대해서도 알고 있지만, 진행하면서이 모듈을 직접 테스트했습니다. Seven Segment Controller를 테스트 할 여유가 없었던 이유는 내가 다른 프로젝트에서도 사용했기 때문에 오작동하지 않는다고 확신합니다. – John