Line 24... |
Line 24... |
Address[10:0] - Column Address
|
Address[10:0] - Column Address
|
Address[12:11] - Bank Address
|
Address[12:11] - Bank Address
|
Address[24:13] - Row Address
|
Address[24:13] - Row Address
|
|
|
The SDRAMs are operated in 4 beat burst mode.
|
The SDRAMs are operated in 4 beat burst mode.
|
|
|
|
If Wrap = 0;
|
|
If the current burst cross the page boundary, then this block split the request into two coressponding change in address and request length
|
|
|
|
if the current burst cross the page boundar.
|
This module takes requests from the memory controller,
|
This module takes requests from the memory controller,
|
chops them to page boundaries if wrap=0,
|
chops them to page boundaries if wrap=0,
|
and passes the request to bank_ctl
|
and passes the request to bank_ctl
|
|
|
To Do:
|
To Do:
|
Line 71... |
Line 76... |
|
|
/* Request from app */
|
/* Request from app */
|
req, // Transfer Request
|
req, // Transfer Request
|
req_id, // ID for this transfer
|
req_id, // ID for this transfer
|
req_addr, // SDRAM Address
|
req_addr, // SDRAM Address
|
req_addr_mask,
|
|
req_len, // Burst Length (in 32 bit words)
|
req_len, // Burst Length (in 32 bit words)
|
req_wrap, // Wrap mode request (xfr_len = 4)
|
req_wrap, // Wrap mode request (xfr_len = 4)
|
req_wr_n, // 0 => Write request, 1 => read req
|
req_wr_n, // 0 => Write request, 1 => read req
|
req_ack, // Request has been accepted
|
req_ack, // Request has been accepted
|
sdr_core_busy_n, // SDRAM Core Busy Indication
|
sdr_core_busy_n, // SDRAM Core Busy Indication
|
Line 110... |
Line 114... |
input [1:0] cfg_colbits; // 2'b00 - 8 Bit column address, 2'b01 - 9 Bit, 10 - 10 bit, 11 - 11Bits
|
input [1:0] cfg_colbits; // 2'b00 - 8 Bit column address, 2'b01 - 9 Bit, 10 - 10 bit, 11 - 11Bits
|
|
|
/* Request from app */
|
/* Request from app */
|
input req;
|
input req;
|
input [`SDR_REQ_ID_W-1:0] req_id;
|
input [`SDR_REQ_ID_W-1:0] req_id;
|
input [APP_AW:0] req_addr;
|
input [APP_AW-1:0] req_addr;
|
input [APP_AW-2:0] req_addr_mask;
|
|
input [APP_RW-1:0] req_len;
|
input [APP_RW-1:0] req_len;
|
input req_wr_n, req_wrap;
|
input req_wr_n, req_wrap;
|
output req_ack, sdr_core_busy_n;
|
output req_ack, sdr_core_busy_n;
|
|
|
/* Req to bank_ctl */
|
/* Req to bank_ctl */
|
Line 149... |
Line 152... |
|
|
wire [1:0] r2b_ba;
|
wire [1:0] r2b_ba;
|
wire [11:0] r2b_raddr;
|
wire [11:0] r2b_raddr;
|
wire [11:0] r2b_caddr;
|
wire [11:0] r2b_caddr;
|
|
|
reg [APP_AW-1:0] curr_sdr_addr, sdr_addrs_mask;
|
reg [APP_AW-1:0] curr_sdr_addr ;
|
wire [APP_AW-1:0] next_sdr_addr, next_sdr_addr1;
|
wire [APP_AW-1:0] next_sdr_addr ;
|
|
|
|
|
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
// Generate the internal Adress and Burst length Based on sdram width
|
// Generate the internal Adress and Burst length Based on sdram width
|
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
Line 174... |
Line 177... |
req_len_int = {req_len,2'b0};
|
req_len_int = {req_len,2'b0};
|
end
|
end
|
end
|
end
|
|
|
//
|
//
|
// The maximum length for no page overflow is 200h/100h - caddr. Split a request
|
// Identify the page over flow.
|
// into 2 or more requests if it crosses a page boundary.
|
// Find the Maximum Burst length allowed from the selected column
|
// For non-queue accesses req_addr_mask is set to all 1 and the accesses
|
// address, If the requested burst length is more than the allowed Maximum
|
// proceed linearly.
|
// burst length, then we need to handle the bank cross over case and we
|
// All queues end on a 512 byte boundary (actually a 1K boundary). For Q
|
// need to split the reuest.
|
// accesses req_addr_mask is set to LSB of 1 and MSB of 0 to constrain the
|
|
// accesses within the space for a Q. When splitting and calculating the next
|
|
// address only the LSBs are incremented, the MSBs remain = req_addr.
|
|
//
|
//
|
assign max_r2b_len = (cfg_colbits == 2'b00) ? (12'h100 - r2b_caddr) :
|
assign max_r2b_len = (cfg_colbits == 2'b00) ? (12'h100 - r2b_caddr) :
|
(cfg_colbits == 2'b01) ? (12'h200 - r2b_caddr) :
|
(cfg_colbits == 2'b01) ? (12'h200 - r2b_caddr) :
|
(cfg_colbits == 2'b10) ? (12'h400 - r2b_caddr) : (12'h800 - r2b_caddr);
|
(cfg_colbits == 2'b10) ? (12'h400 - r2b_caddr) : (12'h800 - r2b_caddr);
|
|
|
|
|
|
// If the wrap = 0 and current application burst length is crossing the page boundary,
|
|
// then request will be split into two with corresponding change in request address and request length.
|
|
//
|
|
// If the wrap = 0 and current burst length is not crossing the page boundary,
|
|
// then request from application layer will be transparently passed on the bank control block.
|
|
|
|
//
|
|
// if the wrap = 1, then this block will not modify the request address and length.
|
|
// The wrapping functionality will be handle by the bank control module and
|
|
// column address will rewind back as follows XX -> FF ? 00 ? 1
|
|
//
|
assign page_ovflw = ({1'b0, lcl_req_len} > max_r2b_len) ? ~lcl_wrap : 1'b0;
|
assign page_ovflw = ({1'b0, lcl_req_len} > max_r2b_len) ? ~lcl_wrap : 1'b0;
|
|
|
assign r2b_len = (page_ovflw) ? max_r2b_len : lcl_req_len;
|
assign r2b_len = (page_ovflw) ? max_r2b_len : lcl_req_len;
|
|
|
assign next_req_len = lcl_req_len - r2b_len;
|
assign next_req_len = lcl_req_len - r2b_len;
|
|
|
assign next_sdr_addr1 = curr_sdr_addr + r2b_len;
|
assign next_sdr_addr = curr_sdr_addr + r2b_len;
|
|
|
// Wrap back based on the mask
|
|
assign next_sdr_addr = (sdr_addrs_mask & next_sdr_addr1) |
|
|
(~sdr_addrs_mask & curr_sdr_addr);
|
|
|
|
assign sdr_core_busy_n = req_idle & b2r_arb_ok & sdr_init_done;
|
assign sdr_core_busy_n = req_idle & b2r_arb_ok & sdr_init_done;
|
|
|
assign r2b_wrap = lcl_wrap;
|
assign r2b_wrap = lcl_wrap;
|
|
|
Line 224... |
Line 232... |
(req_ld) ? next_req_len : lcl_req_len;
|
(req_ld) ? next_req_len : lcl_req_len;
|
|
|
curr_sdr_addr <= (req_ack) ? req_addr_int :
|
curr_sdr_addr <= (req_ack) ? req_addr_int :
|
(req_ld) ? next_sdr_addr : curr_sdr_addr;
|
(req_ld) ? next_sdr_addr : curr_sdr_addr;
|
|
|
sdr_addrs_mask <= (req_ack) ?((sdr_width == 2'b00) ? req_addr_mask :
|
|
(sdr_width == 2'b01) ? {req_addr_mask,req_addr_mask[0]} :
|
|
{req_addr_mask,req_addr_mask[1:0]}) : sdr_addrs_mask;
|
|
|
|
end // always @ (posedge clk)
|
end // always @ (posedge clk)
|
|
|
always @ (*) begin
|
always @ (*) begin
|
|
|
case (req_st) // synopsys full_case parallel_case
|
case (req_st) // synopsys full_case parallel_case
|