我正在尝试 Build 一个缓冲区,以便为小型CPU设计保存16位,16位宽的指令 .
我需要一种从我的测试平台将指令加载到缓冲区的方法 . 所以我想使用一个std_logic_vectors数组来实现这一目标 . 但是,我收到语法错误,我不知道为什么(或者如果我允许在VHDL中执行此操作) .
语法错误位于我声明 instructions
的行
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity instruction_buffer is
port
(
reset : in std_logic;
instructions : in array(0 to 15) of std_logic_vector(15 downto 0);
instruction_address : in std_logic_vector(3 downto 0);
clk : in std_logic;
instruction_out : out std_logic_vector(15 downto 0)
);
end instruction_buffer;
我也试过这样做,但后来我的实体端口映射中出现语法错误,告诉我 std_logic_vector
是一个未知类型 . 我发誓,VHDL的语法错误没有C哈哈那么有意义
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
package instructionBuffer is
type instructionBuffer is array(0 to 15) of std_logic_vector (15 downto 0);
end package instructionBuffer;
entity instruction_buffer is
port
(
instruction_address : in std_logic_vector(3 downto 0);
clk : in std_logic;
instruction_out : out std_logic_vector(15 downto 0)
);
end instruction_buffer;
3 回答
无需拆分成两个文件,只需将所有代码放入一个文件即可 . 您还可以在包中使用泛型来实现可伸缩性:
我搞定了:
在一个文件中,我有以下内容:
然后在另一个我有:
很明显,这种语言是一个政府项目 . 这太过分了 .
多维数组