Line 21... |
Line 21... |
|
|
To Do:
|
To Do:
|
nothing
|
nothing
|
|
|
Author(s): Dinesh Annayya, dinesha@opencores.org
|
Author(s): Dinesh Annayya, dinesha@opencores.org
|
Version : 1.0 - 8th Jan 2012
|
Version : 0.0 - 8th Jan 2012
|
Initial version with 16/32 Bit SDRAM Support
|
Initial version with 16/32 Bit SDRAM Support
|
: 1.1 - 24th Jan 2012
|
: 0.1 - 24th Jan 2012
|
8 Bit SDRAM Support is added
|
8 Bit SDRAM Support is added
|
|
0.2 - 31st Jan 2012
|
|
sdram_dq and sdram_pad_clk are internally generated
|
|
|
|
|
Copyright (C) 2000 Authors and OPENCORES.ORG
|
Copyright (C) 2000 Authors and OPENCORES.ORG
|
|
|
This source file may be used and distributed without
|
This source file may be used and distributed without
|
Line 53... |
Line 55... |
from http://www.opencores.org/lgpl.shtml
|
from http://www.opencores.org/lgpl.shtml
|
|
|
*******************************************************************/
|
*******************************************************************/
|
|
|
|
|
`include "sdrc.def"
|
`include "sdrc_define.v"
|
module sdrc_top
|
module sdrc_top
|
(
|
(
|
sdr_width ,
|
sdr_width ,
|
cfg_colbits ,
|
cfg_colbits ,
|
|
|
Line 76... |
Line 78... |
wb_cti_i ,
|
wb_cti_i ,
|
|
|
|
|
/* Interface to SDRAMs */
|
/* Interface to SDRAMs */
|
sdram_clk ,
|
sdram_clk ,
|
sdram_pad_clk ,
|
|
sdram_resetn ,
|
sdram_resetn ,
|
sdr_cs_n ,
|
sdr_cs_n ,
|
sdr_cke ,
|
sdr_cke ,
|
sdr_ras_n ,
|
sdr_ras_n ,
|
sdr_cas_n ,
|
sdr_cas_n ,
|
sdr_we_n ,
|
sdr_we_n ,
|
sdr_dqm ,
|
sdr_dqm ,
|
sdr_ba ,
|
sdr_ba ,
|
sdr_addr ,
|
sdr_addr ,
|
pad_sdr_din ,
|
sdr_dq ,
|
sdr_dout ,
|
|
sdr_den_n ,
|
|
|
|
/* 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 121... |
Line 120... |
|
|
//-----------------------------------------------
|
//-----------------------------------------------
|
// Global Variable
|
// Global Variable
|
// ----------------------------------------------
|
// ----------------------------------------------
|
input sdram_clk ; // SDRAM Clock
|
input sdram_clk ; // SDRAM Clock
|
input sdram_pad_clk ; // SDRAM Clock from Pad, used for registering Read Data
|
|
input sdram_resetn ; // Reset Signal
|
input sdram_resetn ; // Reset Signal
|
input [1:0] sdr_width ; // 2'b00 - 32 Bit SDR, 2'b01 - 16 Bit SDR, 2'b1x - 8 Bit
|
input [1:0] sdr_width ; // 2'b00 - 32 Bit SDR, 2'b01 - 16 Bit SDR, 2'b1x - 8 Bit
|
input [1:0] cfg_colbits ; // 2'b00 - 8 Bit column address,
|
input [1:0] cfg_colbits ; // 2'b00 - 8 Bit column address,
|
// 2'b01 - 9 Bit, 10 - 10 bit, 11 - 11Bits
|
// 2'b01 - 9 Bit, 10 - 10 bit, 11 - 11Bits
|
|
|
Line 154... |
Line 152... |
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 [11:0] sdr_addr ; // SDRAM Address
|
output [11:0] sdr_addr ; // SDRAM Address
|
input [SDR_DW-1:0] pad_sdr_din ; // SDRA Data Input
|
inout [SDR_DW-1:0] sdr_dq ; // SDRA Data Input/output
|
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 190... |
Line 186... |
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 [dw-1:0] app_wr_data ; // sdr write data
|
wire [dw-1:0] app_wr_data ; // sdr write data
|
wire [dw-1:0] app_rd_data ; // sdr read data
|
wire [dw-1:0] app_rd_data ; // sdr read data
|
|
|
|
/****************************************
|
|
* These logic has to be implemented using Pads
|
|
* **************************************/
|
|
wire [SDR_DW-1:0] pad_sdr_din ; // SDRA Data Input
|
|
wire [SDR_DW-1:0] sdr_dout ; // SDRAM Data Output
|
|
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 pad_sdr_din = sdr_dq;
|
|
|
|
// sdram pad clock is routed back through pad
|
|
// SDRAM Clock from Pad, used for registering Read Data
|
|
wire #(1.0) sdram_pad_clk = sdram_clk;
|
|
|
|
/************** Ends Here **************************/
|
wb2sdrc u_wb2sdrc (
|
wb2sdrc 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 ) ,
|
|
|