7 세그먼트 디스플레이에서 텍스트를 스크롤하려고합니다. 텍스트는 키보드에서 입력되며 BASYS2를 FPGA로 사용하고 있습니다. 내 키보드 인터페이스는 7 개의 세그먼트 컨트롤러뿐만 아니라 완료되었습니다. 그러나 나는 shifter 모듈에 문제가 있습니다. 스캔 코드를 처리 할 때 바이트 배열을 사용해야합니다. 나는 그런 타입을 패키지로 선언했다. 그것은 "mypackage2"이다. 그러나, 내가 이해하는 한, shifter 모듈은 해당 유형, 즉 "reg_array"를 사용할 수 없습니다. 나는 무엇을 바꾸어야합니까, 아니면 제가 여기서 누락 된 것이 있습니까? VHDL을 처음 접했을 때 몇 가지 기본적인 오류가 있었을 것입니다. 또한 필자가 작성한 패키지는 창의 왼쪽에있는 프로젝트 계층 구조에 나타나지 않습니다. 어떤 도움을 주셔서 감사합니다. 고맙습니다.패키지의 VHDL 유형 선언
편집 : 다음과 같이 reg 배열을 사용하지 않아야합니다. Data_out : out reg_array(REGSIZE-1 downto 0)
너비가 이미 지정되었으므로주의했습니다. 패키지 여기
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use work.mypackage2.all;
entity shifter is
generic (REGSIZE : integer := 16); -- Text will be composed of 16 characters
port(clk : in std_logic;
Scan_Dav : in std_logic; -- this is '1' when there is a new scancode
Data_in : in std_logic_vector(7 downto 0); --scancode from keyboard
Data_out : out reg_array);
end shifter;
architecture bhv of shifter is
signal shift_reg : reg_array;
begin
process (clk, Scan_Dav) begin
if rising_edge(clk) then
if Scan_Dav = '1' then
shift_reg(REGSIZE-1 downto 1) <= shift_reg(REGSIZE-2 downto 0);
shift_reg(15) <= shift_reg(0);
end if;
end if;
Data_out <= shift_reg;
end process;
end bhv;
것 : 그래서 난 내 코드를 조금 변경 3. 다음
에 오류의 수를 감소 쉬프터 모듈의
library IEEE;
use IEEE.STD_LOGIC_1164.all;
package mypackage2 is
subtype reg is std_logic_vector(7 downto 0); -- a byte
type reg_array is array (0 to 15) of reg; -- array of bytes
end mypackage2;
package body mypackage2 is
end mypackage2;
그리고이 최신 오류가 있습니다 :
ERROR:HDLParsers:807 - "F:/Projeilk/Shifter.vhd" Line 22. shift_reg can not be used with range downto.
ERROR:HDLParsers:807 - "F:/Projeilk/Shifter.vhd" Line 22. shift_reg can not be used with range downto.
예, 방금 언급 한 문제를 발견하고 변경했습니다. 답변 주셔서 감사합니다. 나머지 오류는 어떻습니까? – John
'reg_array'에 대한 패키지 정의는'to'를 사용하지만 코드에서'downto'를 사용하고 있습니다. 혼합해서 사용할 수 없습니다. 일관성있게 변경하실 수 있습니다. 그리고'scan_dav'는 부울로 변환 될 수 없습니다. '(Scan_dav = '1') 시도해보십시오. –
도움을 주셔서 감사합니다. 내 최상위 모듈에 대한 질문이있을 수도 있습니다. – John