Line 26... |
Line 26... |
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 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 boundary, then this block split the request
|
|
into two coressponding change in address and request length
|
|
|
if the current burst cross the page boundar.
|
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
|
Line 113... |
Line 114... |
parameter APP_RW = 9; // Application Request Width
|
parameter APP_RW = 9; // Application Request Width
|
|
|
parameter SDR_DW = 16; // SDR Data Width
|
parameter SDR_DW = 16; // SDR Data Width
|
parameter SDR_BW = 2; // SDR Byte Width
|
parameter SDR_BW = 2; // SDR Byte Width
|
|
|
parameter REQ_BW = 12; // Request Width
|
// 12 bit subtractor is not feasibile for FPGA, so changed to 8 bits
|
|
parameter REQ_BW = (`TARGET_DESIGN == `FPGA) ? 8 : 12; // Request Width
|
|
|
input clk ;
|
input clk ;
|
input reset_n ;
|
input reset_n ;
|
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 */
|
Line 159... |
Line 162... |
reg [`SDR_REQ_ID_W-1:0] r2b_req_id;
|
reg [`SDR_REQ_ID_W-1:0] r2b_req_id;
|
reg [REQ_BW-1:0] lcl_req_len;
|
reg [REQ_BW-1:0] lcl_req_len;
|
|
|
wire r2b_last, page_ovflw;
|
wire r2b_last, page_ovflw;
|
wire [REQ_BW-1:0] r2b_len, next_req_len;
|
wire [REQ_BW-1:0] r2b_len, next_req_len;
|
wire [REQ_BW:0] max_r2b_len;
|
wire [12:0] max_r2b_len;
|
|
reg [12:0] max_r2b_len_r;
|
|
|
reg [1:0] r2b_ba;
|
reg [1:0] r2b_ba;
|
reg [11:0] r2b_raddr;
|
reg [11:0] r2b_raddr;
|
reg [11:0] r2b_caddr;
|
reg [11:0] r2b_caddr;
|
|
|
Line 197... |
Line 201... |
// Find the Maximum Burst length allowed from the selected column
|
// Find the Maximum Burst length allowed from the selected column
|
// address, If the requested burst length is more than the allowed Maximum
|
// address, If the requested burst length is more than the allowed Maximum
|
// burst length, then we need to handle the bank cross over case and we
|
// burst length, then we need to handle the bank cross over case and we
|
// need to split the reuest.
|
// need to split the reuest.
|
//
|
//
|
assign max_r2b_len = (cfg_colbits == 2'b00) ? (12'h100 - r2b_caddr) :
|
assign max_r2b_len = (cfg_colbits == 2'b00) ? (12'h100 - {4'b0, req_addr_int[7:0]}) :
|
(cfg_colbits == 2'b01) ? (12'h200 - r2b_caddr) :
|
(cfg_colbits == 2'b01) ? (12'h200 - {3'b0, req_addr_int[8:0]}) :
|
(cfg_colbits == 2'b10) ? (12'h400 - r2b_caddr) : (12'h800 - r2b_caddr);
|
(cfg_colbits == 2'b10) ? (12'h400 - {2'b0, req_addr_int[9:0]}) : (12'h800 - {1'b0, req_addr_int[10:0]});
|
|
|
|
|
// If the wrap = 0 and current application burst length is crossing the page boundary,
|
// 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.
|
// then request will be split into two with corresponding change in request address and request length.
|
//
|
//
|
Line 215... |
Line 219... |
// The wrapping functionality will be handle by the bank control module and
|
// The wrapping functionality will be handle by the bank control module and
|
// column address will rewind back as follows XX -> FF ? 00 ? 1
|
// column address will rewind back as follows XX -> FF ? 00 ? 1
|
//
|
//
|
// Note: With Wrap = 0, each request from Application layer will be spilited into two request,
|
// Note: With Wrap = 0, each request from Application layer will be spilited into two request,
|
// if the current burst cross the page boundary.
|
// if the current burst cross the page boundary.
|
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_r) ? ~lcl_wrap : 1'b0;
|
|
|
assign r2b_len = (page_ovflw) ? max_r2b_len : lcl_req_len;
|
assign r2b_len = (page_ovflw) ? max_r2b_len_r : lcl_req_len;
|
|
|
assign next_req_len = lcl_req_len - r2b_len;
|
assign next_req_len = lcl_req_len - r2b_len;
|
|
|
assign next_sdr_addr = curr_sdr_addr + r2b_len;
|
assign next_sdr_addr = curr_sdr_addr + r2b_len;
|
|
|
Line 232... |
Line 236... |
//
|
//
|
//
|
//
|
//
|
//
|
always @ (posedge clk) begin
|
always @ (posedge clk) begin
|
|
|
|
max_r2b_len_r <= max_r2b_len;
|
r2b_start <= (req_ack) ? 1'b1 :
|
r2b_start <= (req_ack) ? 1'b1 :
|
(b2r_ack) ? 1'b0 : r2b_start;
|
(b2r_ack) ? 1'b0 : r2b_start;
|
|
|
r2b_write <= (req_ack) ? ~req_wr_n : r2b_write;
|
r2b_write <= (req_ack) ? ~req_wr_n : r2b_write;
|
|
|