OpenCores
URL https://opencores.org/ocsvn/sdram_axi4/sdram_axi4/trunk

Subversion Repositories sdram_axi4

[/] [sdram_axi4/] [trunk/] [README.md] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ultra_embe
### SDRAM Controller (AXI4)
2
 
3
Github:   [https://github.com/ultraembedded/core_sdram_axi4](https://github.com/ultraembedded/core_sdram_axi4)
4
 
5
This IP core is that of a small, simple SDRAM controller used to interface a 32-bit AXI-4 bus to a 16-bit SDRAM chip.
6
 
7
Suitable for small FPGAs which do not have a hard SDRAM macro, or where using FPGA vendor IP is not desirable.
8
 
9
When accessing open rows, reads and writes can be pipelined to achieve full SDRAM bus utilization, however switching between reads & writes takes a few cycles.
10
 
11
The row management strategy is to leave active rows open until a row needs to be closed for a periodic auto refresh or until that bank needs to open another row due to a read or write request.
12
 
13
This IP supports supports 4 open active rows (one per bank).
14
 
15
##### Features
16
* AXI4-Slave supporting FIXED, INCR and WRAP bursts.
17
* Support for 16-bit SDRAM parts
18
 
19
##### Testing
20
Verified under simulation against a couple of SDRAM models and on various Xilinx FPGAs (Spartan 6, Artix 7), and against the following SDRAM parts;
21
* MT48LC16M16A2
22
* AS4C16M16S
23
 
24
##### Configuration
25
* Top: sdram_axi
26
* Clock: clk_i
27
* Reset: rst_i - Asynchronous, active high
28
* parameter SDRAM_MHZ - Clock speed (verified with 50MHz & 100MHz)
29
* parameter SDRAM_ADDR_W - Total SDRAM address width (cols+rows+banks)
30
* parameter SDRAM_COL_W - Number of column bits
31
* parameter SDRAM_READ_LATENCY - Read data latency (try 3 for 100MHz, 2 for 50MHz)
32
 
33
##### Example Instantiation
34
 
35
This example works well for Xilinx FPGAs;
36
```
37
module top
38
(
39
    input           clk_i,
40
    input           rst_i,
41
 
42
    output          sdram_clk_o,
43
    output          sdram_cke_o,
44
    output [1:0]    sdram_dqm_o,
45
    output          sdram_cas_o,
46
    output          sdram_ras_o,
47
    output          sdram_we_o,
48
    output          sdram_cs_o,
49
    output [1:0]    sdram_ba_o,
50
    output [12:0]   sdram_addr_o,
51
    inout  [15:0]   sdram_data_io
52
);
53
 
54
wire [ 15:0]        sdram_data_in_w;
55
wire [ 15:0]        sdram_data_out_w;
56
wire                sdram_data_out_en_w;
57
 
58
sdram_axi
59
u_sdram
60
(
61
     .clk_i(clk_i)
62
    ,.rst_i(rst_i)
63
 
64
    // AXI port
65
    ,.inport_awvalid_i(...)
66
    ,.inport_awaddr_i(...)
67
    ,.inport_awid_i(...)
68
    ,.inport_awlen_i(...)
69
    ,.inport_awburst_i(...)
70
    ,.inport_wvalid_i(...)
71
    ,.inport_wdata_i(...)
72
    ,.inport_wstrb_i(...)
73
    ,.inport_wlast_i(...)
74
    ,.inport_bready_i(...)
75
    ,.inport_arvalid_i(...)
76
    ,.inport_araddr_i(...)
77
    ,.inport_arid_i(...)
78
    ,.inport_arlen_i(...)
79
    ,.inport_arburst_i(...)
80
    ,.inport_rready_i(...)
81
    ,.inport_awready_o(...)
82
    ,.inport_wready_o(...)
83
    ,.inport_bvalid_o(...)
84
    ,.inport_bresp_o(...)
85
    ,.inport_bid_o(...)
86
    ,.inport_arready_o(...)
87
    ,.inport_rvalid_o(...)
88
    ,.inport_rdata_o(...)
89
    ,.inport_rresp_o(...)
90
    ,.inport_rid_o(...)
91
    ,.inport_rlast_o(...)
92
 
93
    // SDRAM Interface
94
    ,.sdram_clk_o()
95
    ,.sdram_cke_o(sdram_cke_o)
96
    ,.sdram_cs_o(sdram_cs_o)
97
    ,.sdram_ras_o(sdram_ras_o)
98
    ,.sdram_cas_o(sdram_cas_o)
99
    ,.sdram_we_o(sdram_we_o)
100
    ,.sdram_dqm_o(sdram_dqm_o)
101
    ,.sdram_addr_o(sdram_addr_o)
102
    ,.sdram_ba_o(sdram_ba_o)
103
    ,.sdram_data_input_i(sdram_data_in_w)
104
    ,.sdram_data_output_o(sdram_data_out_w)
105
    ,.sdram_data_out_en_o(sdram_data_out_en_w)
106
);
107
 
108
ODDR2
109
#(
110
    .DDR_ALIGNMENT("NONE"),
111
    .INIT(1'b0),
112
    .SRTYPE("SYNC")
113
)
114
u_clock_delay
115
(
116
    .Q(sdram_clk_o),
117
    .C0(clk_i),
118
    .C1(~clk_i),
119
    .CE(1'b1),
120
    .R(1'b0),
121
    .S(1'b0),
122
    .D0(1'b0),
123
    .D1(1'b1)
124
);
125
 
126
genvar i;
127
for (i=0; i < 16; i = i + 1)
128
begin
129
  IOBUF
130
  #(
131
    .DRIVE(12),
132
    .IOSTANDARD("LVTTL"),
133
    .SLEW("FAST")
134
  )
135
  u_data_buf
136
  (
137
    .O(sdram_data_in_w[i]),
138
    .IO(sdram_data_io[i]),
139
    .I(sdram_data_out_w[i]),
140
    .T(~sdram_data_out_en_w)
141
  );
142
end
143
 
144
endmodule
145
```

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.