首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Xilinx中使用Verilog描述硬件内存时,如何修复警告“HDLCompiler: 1007 - Element index 7 into memp is out out”?

在Xilinx中使用Verilog描述硬件内存时,如何修复警告“HDLCompiler: 1007 - Element index 7 into memp is out out”?
EN

Stack Overflow用户
提问于 2015-09-12 15:34:04
回答 1查看 576关注 0票数 0

我有以下关于双端口RAM内存的硬件描述:

代码语言:javascript
复制
module MemoryRAM #(parameter  RAM_ADDR_BITS = 4, RAM_WIDTH = 8)
(CLK, RAMEnableLSB, RAMEnableMSB, WriteMemory,LoadData, Address, OutputRAMMEM);


input  RAMEnableLSB, RAMEnableMSB ,WriteMemory;
input CLK;


reg [RAM_WIDTH-1:0] RAM1 [(2**RAM_ADDR_BITS)-1:0];
reg [RAM_WIDTH-1:0] OutputData1 = 0,OutputData0 = 0;


input [RAM_ADDR_BITS-1:0] Address;
input [2*RAM_WIDTH-1:0] LoadData;
output [2*RAM_WIDTH -1:0] OutputRAMMEM;



always @ (posedge CLK)
begin
    if(RAMEnableMSB) begin
        if (WriteMemory) 
        begin
            RAM1[Address+1] <= LoadData[2*RAM_WIDTH-1:1*RAM_WIDTH];    //     Bit MSB
            OutputData1 <= LoadData[2*RAM_WIDTH-1:1*RAM_WIDTH];
        end
        else 
        begin
            OutputData1 <= RAM1[Address+1];           //     Bit MSB
        end
     end
     else
        OutputData1 <= 0;
end


always @ (posedge CLK)
begin
    if(RAMEnableLSB) begin
        if (WriteMemory) 
        begin
            RAM1[Address] <= LoadData[1*RAM_WIDTH-1:0*RAM_WIDTH];  //     Bit LSB
            OutputData0 <= LoadData[1*RAM_WIDTH-1:0*RAM_WIDTH];
        end
        else 
        begin
            OutputData0 <= RAM1[Address];           //     Bit LSB
        end
    end else
        OutputData0 <= 0;
end


assign OutputRAMMEM = {OutputData1,OutputData0};
endmodule

当我在Xilinx ISE 14.7中合成时,一条消息告诉我合成是正确的。如果我还执行了一个行为模拟,结果就是预期的。

但是,如果我执行Post-Route模拟,会出现一条警告信息:

代码语言:javascript
复制
WARNING:HDLCompiler:1007 - "N:/O.61xd/rtf/verilog/src/unisims/ARAMB36_INTERNAL.v" Line 1050: Element index 7 into memp is out of bounds

模拟不起作用!。重要的一点是我使用的是ISim模拟器。如果我描述了单端口RAM的硬件,同样的警告也会出现。

有人能告诉我如何解决这个警告吗?

EN

回答 1

Stack Overflow用户

发布于 2015-09-13 12:33:32

不确定“索引7”,但我确实注意到MSB的地址可能超出范围。RAM1的最大索引是15。最大地址是(15+1)。

您可以向RAM1添加额外的索引,或者如果地址溢出,则将地址换回0。如果你扭曲它,那么MSB和LSB都可以访问每个条目。

二是扭曲地址。使用mod操作:

代码语言:javascript
复制
RAM1[(Address+1)%(2**RAM_ADDR_BITS)] <= LoadData[2*RAM_WIDTH-1:1*RAM_WIDTH];  

或者计算最高有效位地址并在索引RAM1时屏蔽其最高有效位位

代码语言:javascript
复制
wire [RAM_ADDR_BITS:0] AddressMSB = Address+1;
...
RAM1[AddressMSB[RAM_ADDR_BITS-1:0]] <= LoadData[2*RAM_WIDTH-1:1*RAM_WIDTH];  //  Bit MSB
...
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32536388

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档