首页 文章

在Quartus中使用非零索引存储器(Verilog)

提问于
浏览
0

我正在为一个基本的16位教育CPU编写一个内存系统,并且遇到了我的模块的Quartus Synthesis问题 . 具体来说,我已经将地址空间分解为几个不同的部分,其中一个(这是一个ROM)没有正确合成 . (注意:我正在合成DE2-115 Altera板,QuartusII 12.1,SystermVerilog代码)

因此,为了使内存映射VRAM(双端口的内存模块允许VGA输出,而CPU写入颜色)更加可用,我在地址空间中包含一个小ROM,包括代码(汇编函数)允许您将字符写入内存,即print_char函数 . 这个ROM位于特定地址的存储器中,所以为了简化SV,我实现了ROM(和所有的存储器模块),如下所示:

module printROM
  (input  rd_cond_code_t      re_L,
   input  wr_cond_code_t      we_L,
   input  logic [15:0]        memAddr,
   input  logic               clock,
   input  logic               reset_L,
   inout  wire [15:0]         memBus,
   output mem_status_t        memStatus);

   reg [15:0]                 rom[`VROM_ADDR_LO:`VROM_ADDR_HI];
   reg [15:0]                 dataOut;

   /* The ROM */
   always @(posedge clock) begin
      if (re_L == MEM_RD) begin
         dataOut <= rom[memAddr];
      end
   end

   /* Load the rom data */
   initial $readmemh("printROM.hex", rom);

   /* Drive the line */
   tridrive #(.WIDTH(16)) romOut(.data(dataOut),
                                 .bus(memBus),
                                 .en_L(re_L));
/* Manage asserting completion of a read or a write */
   always_ff @(posedge clock, negedge reset_L) begin
      if (~reset_L) begin
         memStatus <= MEM_NOT_DONE;
      end
      else begin
         if ((we_L == MEM_WR) | (re_L == MEM_RD)) begin
            memStatus <= MEM_DONE;
         end
         else begin
            memStatus <= MEM_NOT_DONE;
         end
      end
   end

endmodule // printROM

其中VROM_ADDR_LO和VROM_ADDR_HI是定义该ROM地址的两个宏,即'hEB00和'hEFFF . 因此,当CPU读取/写入该范围内的地址时,该模块能够正确地索引到ROM存储器中 . 这种技术在VCS仿真中工作正常 .

但是,当我开始合成这个模块时,Quartus正确地暗示了一个ROM但是在初始化它时遇到了问题 . 我收到此错误:

Error (113012): Address at line 11 exceeds the specified depth (1280) in the Memory Initialization File "psx18240.ram0_printROM_38938673.hdl.mif"

看起来Quartus正在将我提供的.hex文件转换为ROM代码(即printROM.hex)并使用CPU可见地址(即从'hEB00开始)生成.mif文件,即使rom的大小明显太大小 . Quartus不支持这种语法还是我做错了什么?

2 回答

相关问题