移位寄存器为std_logic_vector
问题描述:
我看到了同样的问题here,我试图按照这个例子,但我在声明我的信号时遇到了错误。在具体的:移位寄存器为std_logic_vector
#Error: COMP96_0015: Pipeline.vhd : (52, 44): ';' expected.
这里是我的代码:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity Pipeline isgeneric (
VECTOR_WIDTH: natural := 128;
VECTOR_DEPTH: natural := 7
); port(
ImVal : in STD_LOGIC_VECTOR(9 downto 0);
RA : in STD_LOGIC_VECTOR(127 downto 0);
RB : in STD_LOGIC_VECTOR(127 downto 0);
RC : in STD_LOGIC_VECTOR(127 downto 0);
OpCode : in STD_LOGIC_VECTOR(10 downto 0);
RT : in STD_LOGIC_VECTOR(127 downto 0);
Clk: in STD_LOGIC;
Reset: in STD_LOGIC;
OutVal : out STD_LOGIC_VECTOR(127 downto 0)
);
end Pipeline;
architecture Behavioral of Pipeline is
type shift_reg_type1 is array (natural range<>) of std_logic_vector(127 downto 0);
type shift_reg_type2 is array (natural range<>) of std_logic_vector(10 downto 0);
type shift_reg_type3 is array (natural range<>) of std_logic_vector(9 downto 0);
signal shift_regA: shift_reg_type1(0 to 6)(127 downto 0);
signal shift_regB: shift_reg_type1(0 to 6)(127 downto 0);
signal shift_regC: shift_reg_type1(0 to 6)(127 downto 0);
signal shift_regT: shift_reg_type1(0 to 6)(127 downto 0);
signal OpCode_reg: shift_reg_type2(0 to 6)(10 downto 0);
signal ImVal_reg: shift_reg_type3(0 to 6)(9 downto 0);
begin
end Behavioral;
据抱怨我的信号声明,但我不明白为什么。
答
信号声明是错误的,因为错误消息说。此外,它需要一个分号,因为该语句是完整的,但你的代码有每个信号中的两个约束范围...
signal shift_regA: shift_reg_type1(0 to 6);
signal shift_regB: shift_reg_type1(0 to 6);
signal shift_regC: shift_reg_type1(0 to 6);
signal shift_regT: shift_reg_type1(0 to 6);
signal OpCode_reg: shift_reg_type2(0 to 6);
signal ImVal_reg: shift_reg_type3(0 to 6);
shift_reg_type1
已经约束到127..0。所以不能在第二维中再次约束shift_regA
。顺便说一句。没有第二维,因为它是1维元素的1维数组。
+0
我正在接受这个假设,但我想100%确定,因为这个例子有两个限制。我在一段时间内没有完成VHDL,所以需要刷新所有内容。 – Noobgineer
52是哪里? – Paebbels
第4行还有一个语法错误;-)。这也不是一个简单的例子。 –