Line 89... |
Line 89... |
sdr_cas_n ,
|
sdr_cas_n ,
|
sdr_we_n ,
|
sdr_we_n ,
|
sdr_dqm ,
|
sdr_dqm ,
|
sdr_ba ,
|
sdr_ba ,
|
sdr_addr ,
|
sdr_addr ,
|
sdr_dq ,
|
pad_sdr_din ,
|
|
sdr_dout ,
|
|
sdr_den_n ,
|
|
sdram_pad_clk ,
|
|
|
/* Parameters */
|
/* Parameters */
|
sdr_init_done ,
|
sdr_init_done ,
|
cfg_req_depth , //how many req. buffer should hold
|
cfg_req_depth , //how many req. buffer should hold
|
cfg_sdr_en ,
|
cfg_sdr_en ,
|
Line 106... |
Line 109... |
cfg_sdr_twr_d ,
|
cfg_sdr_twr_d ,
|
cfg_sdr_rfsh ,
|
cfg_sdr_rfsh ,
|
cfg_sdr_rfmax
|
cfg_sdr_rfmax
|
);
|
);
|
|
|
parameter APP_AW = 26; // Application Address Width
|
parameter APP_AW = 32; // Application Address Width
|
parameter APP_DW = 32; // Application Data Width
|
parameter APP_DW = 32; // Application Data Width
|
parameter APP_BW = 4; // Application Byte Width
|
parameter APP_BW = 4; // Application Byte Width
|
parameter APP_RW = 9; // Application Request Width
|
parameter APP_RW = 9; // Application Request Width
|
|
|
parameter SDR_DW = 16; // SDR Data Width
|
parameter SDR_DW = 8; // SDR Data Width
|
parameter SDR_BW = 2; // SDR Byte Width
|
parameter SDR_BW = 1; // SDR Byte Width
|
|
|
parameter dw = 32; // data width
|
|
parameter tw = 8; // tag id width
|
parameter tw = 8; // tag id width
|
parameter bl = 9; // burst_lenght_width
|
parameter bl = 9; // burst_lenght_width
|
|
|
//-----------------------------------------------
|
//-----------------------------------------------
|
// Global Variable
|
// Global Variable
|
Line 137... |
Line 139... |
|
|
input wb_stb_i ;
|
input wb_stb_i ;
|
output wb_ack_o ;
|
output wb_ack_o ;
|
input [APP_AW-1:0] wb_addr_i ;
|
input [APP_AW-1:0] wb_addr_i ;
|
input wb_we_i ; // 1 - Write, 0 - Read
|
input wb_we_i ; // 1 - Write, 0 - Read
|
input [dw-1:0] wb_dat_i ;
|
input [APP_DW-1:0] wb_dat_i ;
|
input [dw/8-1:0] wb_sel_i ; // Byte enable
|
input [APP_DW/8-1:0] wb_sel_i ; // Byte enable
|
output [dw-1:0] wb_dat_o ;
|
output [APP_DW-1:0] wb_dat_o ;
|
input wb_cyc_i ;
|
input wb_cyc_i ;
|
input [2:0] wb_cti_i ;
|
input [2:0] wb_cti_i ;
|
|
|
//------------------------------------------------
|
//------------------------------------------------
|
// Interface to SDRAMs
|
// Interface to SDRAMs
|
Line 154... |
Line 156... |
output sdr_cas_n ; // SDRAM cas
|
output sdr_cas_n ; // SDRAM cas
|
output sdr_we_n ; // SDRAM write enable
|
output sdr_we_n ; // SDRAM write enable
|
output [SDR_BW-1:0] sdr_dqm ; // SDRAM Data Mask
|
output [SDR_BW-1:0] sdr_dqm ; // SDRAM Data Mask
|
output [1:0] sdr_ba ; // SDRAM Bank Enable
|
output [1:0] sdr_ba ; // SDRAM Bank Enable
|
output [12:0] sdr_addr ; // SDRAM Address
|
output [12:0] sdr_addr ; // SDRAM Address
|
inout [SDR_DW-1:0] sdr_dq ; // SDRA Data Input/output
|
input sdram_pad_clk ; // Sdram clock loop back from pad
|
|
input [SDR_DW-1:0] pad_sdr_din ; // SDRA Data Input
|
|
output [SDR_DW-1:0] sdr_dout ; // SDRAM Data Output
|
|
output [SDR_BW-1:0] sdr_den_n ; // SDRAM Data Output enable
|
|
|
//------------------------------------------------
|
//------------------------------------------------
|
// Configuration Parameter
|
// Configuration Parameter
|
//------------------------------------------------
|
//------------------------------------------------
|
output sdr_init_done ; // Indicate SDRAM Initialisation Done
|
output sdr_init_done ; // Indicate SDRAM Initialisation Done
|
Line 181... |
Line 186... |
wire [APP_AW-1:0] app_req_addr ; // SDRAM Request Address
|
wire [APP_AW-1:0] app_req_addr ; // SDRAM Request Address
|
wire [bl-1:0] app_req_len ;
|
wire [bl-1:0] app_req_len ;
|
wire app_req_wr_n ; // 0 - Write, 1 -> Read
|
wire app_req_wr_n ; // 0 - Write, 1 -> Read
|
wire app_req_ack ; // SDRAM request Accepted
|
wire app_req_ack ; // SDRAM request Accepted
|
wire app_busy_n ; // 0 -> sdr busy
|
wire app_busy_n ; // 0 -> sdr busy
|
wire [dw/8-1:0] app_wr_en_n ; // Active low sdr byte-wise write data valid
|
wire [APP_DW/8-1:0] app_wr_en_n ; // Active low sdr byte-wise write data valid
|
wire app_wr_next_req ; // Ready to accept the next write
|
wire app_wr_next_req ; // Ready to accept the next write
|
wire app_rd_valid ; // sdr read valid
|
wire app_rd_valid ; // sdr read valid
|
wire app_last_rd ; // Indicate last Read of Burst Transfer
|
wire app_last_rd ; // Indicate last Read of Burst Transfer
|
wire app_last_wr ; // Indicate last Write of Burst Transfer
|
wire app_last_wr ; // Indicate last Write of Burst Transfer
|
wire [dw-1:0] app_wr_data ; // sdr write data
|
wire [APP_DW-1:0] app_wr_data ; // sdr write data
|
wire [dw-1:0] app_rd_data ; // sdr read data
|
wire [APP_DW-1:0] app_rd_data ; // sdr read data
|
|
|
/****************************************
|
/****************************************
|
* These logic has to be implemented using Pads
|
* These logic has to be implemented using Pads
|
* **************************************/
|
* **************************************/
|
wire [SDR_DW-1:0] pad_sdr_din ; // SDRA Data Input
|
wire [SDR_DW-1:0] pad_sdr_din ; // SDRA Data Input
|
wire [SDR_DW-1:0] sdr_dout ; // SDRAM Data Output
|
wire [SDR_DW-1:0] sdr_dout ; // SDRAM Data Output
|
wire [SDR_BW-1:0] sdr_den_n ; // SDRAM Data Output enable
|
wire [SDR_BW-1:0] sdr_den_n ; // SDRAM Data Output enable
|
|
|
|
|
assign sdr_dq = (&sdr_den_n == 1'b0) ? sdr_dout : {SDR_DW{1'bz}};
|
//assign sdr_dq = (&sdr_den_n == 1'b0) ? sdr_dout : {SDR_DW{1'bz}};
|
assign pad_sdr_din = sdr_dq;
|
//assign pad_sdr_din = sdr_dq;
|
|
|
// sdram pad clock is routed back through pad
|
// sdram pad clock is routed back through pad
|
// SDRAM Clock from Pad, used for registering Read Data
|
// SDRAM Clock from Pad, used for registering Read Data
|
wire #(1.0) sdram_pad_clk = sdram_clk;
|
//wire #(1.0) sdram_pad_clk = sdram_clk;
|
|
|
/************** Ends Here **************************/
|
/************** Ends Here **************************/
|
wb2sdrc #(.dw(dw),.tw(tw),.bl(bl)) u_wb2sdrc (
|
wb2sdrc #(.dw(APP_DW),.tw(tw),.bl(bl),.APP_AW(APP_AW)) u_wb2sdrc (
|
// WB bus
|
// WB bus
|
.wb_rst_i (wb_rst_i ) ,
|
.wb_rst_i (wb_rst_i ) ,
|
.wb_clk_i (wb_clk_i ) ,
|
.wb_clk_i (wb_clk_i ) ,
|
|
|
.wb_stb_i (wb_stb_i ) ,
|
.wb_stb_i (wb_stb_i ) ,
|
Line 240... |
Line 245... |
.sdr_rd_data (app_rd_data )
|
.sdr_rd_data (app_rd_data )
|
|
|
);
|
);
|
|
|
|
|
sdrc_core #(.SDR_DW(SDR_DW) , .SDR_BW(SDR_BW)) u_sdrc_core (
|
sdrc_core #(.SDR_DW(SDR_DW) , .SDR_BW(SDR_BW),.APP_AW(APP_AW)) u_sdrc_core (
|
.clk (sdram_clk ) ,
|
.clk (sdram_clk ) ,
|
.pad_clk (sdram_pad_clk ) ,
|
.pad_clk (sdram_pad_clk ) ,
|
.reset_n (sdram_resetn ) ,
|
.reset_n (sdram_resetn ) ,
|
.sdr_width (cfg_sdr_width ) ,
|
.sdr_width (cfg_sdr_width ) ,
|
.cfg_colbits (cfg_colbits ) ,
|
.cfg_colbits (cfg_colbits ) ,
|