2012-11-29 106 views
3

我有下面的代碼,我嘗試在verilog中實現低延遲的第一個字突破式fifo。Verilog中的低延遲FWFT Fifo

reg [width-1:0]  mem [depth-1:0]; 

    always @ (posedge clk) begin 
     if (wr_en) begin 
     mem[wr_pointer[address_width-1:0]] <= #1 din; 
     end 
    end 

    assign #1 dout = mem[rd_pointer[address_width-1:0]]; 

    always @ (posedge clk) begin 
     if (reset) begin 
     wr_pointer <= #1 0; 
     end else if (wr_en) begin 
     wr_pointer <= #1 wr_pointer + 1'b1; 
     end 
    end 

    always @ (posedge clk) begin 
     if (reset) begin 
     rd_pointer <= #1 0; 
     end else if (rd_en) begin 
     rd_pointer <= #1 rd_pointer + 1'b1; 
     end 
    end 

我合成,並收到以下消息:

INFO:Xst:3218 - HDL ADVISOR - The RAM <Mram_mem> will be implemented on LUTs 
either because you have described an asynchronous read or because of currently 
unsupported block RAM features. If you have described an asynchronous read, 
making it synchronous would allow you to take advantage of available block RAM 
resources, for optimized device usage and improved timings. Please refer to 
your documentation for coding guidelines. 

有人能解釋的消息給我?我不相信這需要異步讀取。我只修改時鐘邊緣的讀指針。是否還有其他事情我失蹤?

回答

5

以下行是你的異步讀取:

assign #1 dout = mem[rd_pointer[address_width-1:0]]; 

將其更改爲類似下面的代碼,使其同步。

reg [width-1:0] dout; 
always @ (posedge clk) begin 
    if (reset) begin 
     dout <= #1 0; 
    end else if (rd_en) begin 
     dout <= #1 mem[rd_pointer[address_width-1:0]] 
    end 
end 

異步讀取你已經意味着所有在內存中的話必須隨時可用,因爲內存地址可以在任何時候可能會更改(不只是在一個時鐘邊緣)。

由於異步讀取需要訪問所有存儲器字,FPGA不能使用片上RAM。片上RAM有一個讀總線,只能訪問存儲器中的一個字,並在時鐘邊沿改變。所以建立內存而不是一堆LUT。在這種情況下,您可以將內存視爲由2D觸發器陣列構建而成,現在它可以連接所有單詞。