7 セグメント ディスプレイでテキストをスクロールしようとしています。テキストはキーボードから入力し、FPGA として BASYS2 を使用しています。キーボード インターフェイスと 7 セグメント コントローラーが完成しました。しかし、シフター モジュールに問題があります。スキャンコードを扱っているので、バイト配列を使用する必要があります。そのようなタイプをパッケージ、つまり「mypackage2」で宣言しました。ただし、私が理解している限り、シフターモジュールはそのタイプ、つまり「reg_array」を使用できません。何を変更する必要がありますか、またはここに欠けているものはありますか? 私は VHDL を初めて使用するので、いくつかの基本的なエラーを行った可能性があります。また、作成したパッケージは、ウィンドウの左側にあるプロジェクト階層に表示されません。どんな助けでも大歓迎です。ありがとうございました。
編集:次のように reg 配列を使用しないことに気付きました: Data_out : out reg_array(REGSIZE-1 downto 0)
、その幅は既に指定されているためです。そこで、コードを少し変更して、エラーの数を 3 に減らしました。
シフターモジュールは次のとおりです。
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;
パッケージは次のとおりです。
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.