在VHDL中使用向量

在VHDL中使用向量,vhdl,Vhdl,我试图模拟一个简单的寄存器和移位功能。下面是我使用的代码: entity shift is port ( CLK : in bit ); end shift ; architecture BEHAV of shift is signal REG: bit_vector(9 downto 0) ; signal WORD: bit:='1'; begin SYS :process (CLK) begin if CLK'event and CLK='1' then RE

我试图模拟一个简单的寄存器和移位功能。下面是我使用的代码:

entity shift is port (
CLK : in bit );
end shift ; 

architecture BEHAV of shift is 
signal  REG: bit_vector(9 downto 0) ;
signal  WORD: bit:='1'; 
begin
SYS :process (CLK)
begin 
    if CLK'event and CLK='1' then
    REG <= REG(9 downto 0) & WORD;  -- line cause the error
    end if;
end process SYS;
end BEHAV ;
知道我做错了什么吗?
提前谢谢

REG的大小是10位(
9到0
),您试图将
REG(9到0)&WORD放入其中。此表达式的总大小为10+1=11位。这不适合
REG
,它本身有10位长

您可能需要
REG
# ** Fatal: (vsim-3420) Array lengths do not match. Left is 10 (9 downto 0). Right is 11 (0 to 10).