Logical circuit design
Inquiry Sitemap Link Tips
Memory connection

Memory access sample RTL

Read control with FIFO
  • Pipeline with input as address information and obtaining data output. Address length and data length are both 32bit.
  • Same depth FIFO x 2 are used. One is used as Signaling FIFO with no send/receive of data.
  • Control by FIFO is as follows
    • Difference between number of Address generation (Memory) and number of data readipipeline, is controlled by FIFO so as not to exceed a constant.
    • Control between read from Memory and Data FIFO isJoining by primitive type controlB
    • Signaling FIFO and data FIFO are same depth so, data of this depth only flows through data pipeline. Thus, there is no Wait in data read from memory.
  • Burst access is not supported.
Latency(CLK)0
    
    module rdMem(
            iData, iVld, iStall,
            oData, oVld, oStall,
            memAddr, memReq, memGnt,
            memData, memStrb, memAck,
            reset, clk);
    
            input   [31:0]  iData;          // Address
            input           iVld;
            output          iStall;
            output  [31:0]  iData;          // Read Data
            output          oVld;
            input           oStall;
            output  [31:0]  memAddr;
            output          memReq;
            input           memGnt;
            input   [31:0]  memData;
            output          memStrb;
            input           memAck;
            input           reset;
            input           clk;
    
            wire            vVld, vStall;
            wire            dVld;
    
            sig vFifo (                   // Virtual FIFO
                    .iVld           (iVld & memGnt),
                    .iStall         (vStall),
                    .oVld           (vVld),
                    .oStall         (!dVld | oStall),
                    .reset          (reset),
                    .clk            (clk)
                    );
    
            fifo dFifo (                   // Data FIFO
                    .iData          (memData),
                    .iVld           (memAck),
                    .iStall         (),     // NC
                    .oData          (oData),
                    .oVld           (dVld),
                    .oStall         (!vVld | oStall),
                    .reset          (reset),
                    .clk            (clk)
                    );
    
            assign iStall   = vStall | !memGnt;
    
            assign oVld     = vVld & dVld;
    
            assign memReq   = iVld & !vStall;
            assign memAddr  = oData;
            assign memStrb  = 1'b1;
    endmodule
    
            
iVld ¨ oVldTruncate
iStall © oStallTruncate
iVld ¨ memReqPropagate
oVld © memAckTruncate
Read Memory
Structure

Write control with FIFO
  • Pipeline with input as address information and obtaining data output. Address length and data length are both 32bit.
  • Same depth FIFO x 4 are used. Two are used as virtual FIFO with no send/receive of data.
  • Control by FIFO is as follows
    • If there is difference in the number of Address generation (Memory) and number of data write (pipeline) then the generation of address is permitted (VA FIFOj. Request is done after data is ready hence relative delay is reduced.
    • If there is difference in the number of Address generation (Memory) and number of data write (memory) then data generation is permittediVD FIFOj. Data is transmitted after request (Not required if the specification is for data to be transmitted beforehand)
  • Burst access not supported.
Latency(CLK)0
    
    module wrMem(
            iAdData, iAdVld, iAdStall,
            iDtData, iDtVld, iDtStall,
            memAddr, memReq, memGnt,
            memData, memStrb, memAck,
            reset, clk);
    
            input   [31:0]  iAdData;        // Address
            input           iAdVld;
            output          iAdStall;
            input   [31:0]  iDtData;        // Write Data
            input           iDtVld;
            output          iDtStall;
            output  [31:0]  memAddr;
            output          memReq;
            input           memGnt;
            output  [31:0]  memData;
            output          memStrb;
            input           memAck;
            input           reset;
            input           clk;
    
            wire            adVld;
            wire            dtVld, dtStall;
            wire            vaVld, vaStall;
            wire            vdVld, vdStall;
    
            fifo adFifo (                   // Address FIFO
                    .iData          (iAdData),
                    .iVld           (iAdVld),
                    .iStall         (iAdStall),
                    .oData          (memAddr),
                    .oVld           (adVld),
                    .oStall         (!memAdGnt | !vaVld | vdStall),
                    .reset          (reset),
                    .clk            (clk)
                    );
    
            fifo dtFifo (                   // Data FIFO
                    .iData          (iDtData),
                    .iVld           (iDtVld & !vaStall),
                    .iStall         (dtStall),
                    .oData          (memData),
                    .oVld           (dtVld),
                    .oStall         (!memDtAck | vdStall),
                    .reset          (reset),
                    .clk            (clk)
                    );
    
            sig vaFifo (                   // Virtual Address FIFO
                    .iVld           (iDtVld & !dtStall),
                    .iStall         (vaStall),
                    .oVld           (vaVld),
                    .oStall         (!memAdGnt | !adVld | vdStall),
                    .reset          (reset),
                    .clk            (clk)
                    );
    
            sig vdFifo (                   // Virtual Data FIFO
                    .iVld           (memGnt & adVld & vaVld),
                    .iStall         (vdStall),
                    .oVld           (vdVld),
                    .oStall         (!memAck | !dtVld),
                    .reset          (reset),
                    .clk            (clk)
                    );
    
            assign iDtStall = dtStall | vaStall;
    
            assign memReq   = adVld & vaVld & !vdStall;
            assign memStrb  = dtVld & vdVld;
    endmodule
    
            
iVld ¨ oVldTruncate
iStall © oStallTruncate
iVld ¨ memReqPropagate
oVld © memAckTruncate
Write Memory
Structure

Logical Circuit Design > Pipeline > Memory connection    Next PageiResource Sharingj   TOP of this page £

[1]
Minimum latency of memory access can be calculated from the structure, but the estimation of maximum latency is difficult. For example, if the rights of using the memory by competing parties are frozen by arbitration, then the maximum latency will be ‡

When memory access is commenced, and care is taken to reduce handshakes to control Stall as much as possible, then latency distribution probability can be examined by the frequency of access and distribution method.
[2]
In order to make the FIFO depth ‡ of a parallel pipeline, pointer only needs to be managed, and FIFO data can be replced in system memory. However there is demerit in excessive access to system memory also.
[3]
In case of Write, branching off same pipeline and processing pipeline divided into address and data and having fixed length, FIFO is not required to synchronize such cases.