2016-03-02 126 views
0

我正在此错误在的ModelSim 10.1c:Modelsim的超出范围的错误

致命:(VSIM-3421)值3079超出范围0到3078

在过程wr_addr致命错误在C:/ videoalgo/run_chkin/VEU /中位数/中位数/板/ SIM /../../../ window_gen/RTL/fifo.vhd线159

我有以下类型和信号定义。正如你看到的,声明的指数范围只有1029下降到0:

type memory_type is array (natural range <>) of std_logic_vector(29 downto 0); 
signal MEMORY : memory_type(1029 downto 0):= (others => (others => '0')); 
signal wr_port_address :std_logic_vector(10 downto 0) := (others => '0'); 
signal wr_port_address_binary : std_logic_vector(10 downto 0):=(others => '0'); 

而且在那里我遇到了错误的过程是:

if rising_edge(Wr_Clk) then 
    if A_rst = '1' then 
     wr_port_address_binary <= (others => '0'); 
    else 
     if (Wr_Ena = '1') and (fifo_full = '0') then 
      wr_port_address_binary <= wr_port_address_binary + 1; 
      -- the following is line 159 
      MEMORY(to_integer(unsigned(wr_port_address))) <= Wr_Data; 
     end if; 
    end if; 
end if; 
+0

我已格式化并改进了很多问题。如果我犯了错误,请检查。 –

+1

请发布[最小,完整和验证示例](http://stackoverflow.com/help/mcve):尽可能减少代码,以便错误仍然存​​在。并且请发布触发错误所需的最小测试台。 –

+0

您好Martin,格式是好的..它是项目的一部分,所以很难发布与此错误相关的测试平台。如果你可以在哪里寻找解决这个问题,这将是有帮助的.. – kaps

回答

0

什么样的流程驱动的wr_port_address?您无法使用[0,1029]范围之外的数字写入MEMORY

以文件名'fifo.vhd'作为提示,只要到达内存顶部,就应该重置wr_port_address信号。我假设wr_port_address_binarywr_port_address是一样的,除了一些奇怪的名称和/或类型改变(如果它不是你应该真的重命名它们)。

if rising_edge(Wr_Clk) then 
    if A_rst = '1' then 
     wr_port_address <= (others => '0'); 
    else 
     if (Wr_Ena = '1') and (fifo_full = '0') then 
      if wr_port_address < 1029 then 
       wr_port_address <= wr_port_address + 1; 
      else 
       wr_port_address <= (others => '0'); 
      end if; 
      -- the following is line 159 
      MEMORY(to_integer(unsigned(wr_port_address))) <= Wr_Data; 
     end if; 
    end if; 
end if;