2016-03-06 194 views
0

我看到了同樣的問題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; 

據抱怨我的信號聲明,但我不明白爲什麼。

+2

52是哪裏? – Paebbels

+0

第4行還有一個語法錯誤;-)。這也不是一個簡單的例子。 –

回答

2

信號聲明是錯誤的,因爲錯誤消息說。此外,它需要一個分號,因爲該語句是完整的,但你的代碼有每個信號中的兩個約束範圍...

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