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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [rtl/] [wbddrsdram.v] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    wbddrsdram.v
4
//
5
// Project:     OpenArty, an entirely open SoC based upon the Arty platform
6
//
7
// Purpose:     
8
//
9
// Creator:     Dan Gisselquist, Ph.D.
10
//              Gisselquist Technology, LLC
11
//
12
////////////////////////////////////////////////////////////////////////////////
13
//
14
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
15
//
16
// This program is free software (firmware): you can redistribute it and/or
17
// modify it under the terms of  the GNU General Public License as published
18
// by the Free Software Foundation, either version 3 of the License, or (at
19
// your option) any later version.
20
//
21
// This program is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License along
27
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
28
// target there if the PDF file isn't present.)  If not, see
29
// <http://www.gnu.org/licenses/> for a copy.
30
//
31
// License:     GPL, v3, as defined and found on www.gnu.org,
32
//              http://www.gnu.org/licenses/gpl.html
33
//
34
//
35
////////////////////////////////////////////////////////////////////////////////
36
//
37
//
38
module  wbddrsdram(i_clk_200mhz,
39
                i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr, i_wb_data,
40
                        o_wb_ack, o_wb_stb, o_wb_data,
41
                o_ddr_reset_n, o_ddr_cke,
42
                o_ddr_cs_n, o_ddr_ras_n, o_ddr_cas_n, o_ddr_we_n,
43
                o_ddr_dqs,
44
                o_ddr_addr, o_ddr_ba, o_ddr_data, i_ddr_data);
45
        input   i_clk_200mhz;
46
        // Wishbone inputs
47
        input                   i_wb_cyc, i_wb_stb, i_wb_we;
48
        input           [25:0]   i_wb_addr;
49
        input           [31:0]   i_wb_data;
50
        // Wishbone outputs
51
        output  reg             o_wb_ack;
52
        output  reg             o_wb_stall;
53
        output  reg     [31:0]   o_wb_data;
54
        // DDR3 RAM Controller
55
        output  wire            o_ddr_reset_n;
56
        output  wire            o_ddr_reset_cke;
57
        // Control outputs
58
        output  reg             o_ddr_cs_n, o_ddr_ras_n, o_ddr_cas_n,o_ddr_we_n;
59
        // DQS outputs:set to 3'b010 when data is active, 3'b100 (i.e. 2'bzz) ow
60
        output  reg     [2:0]    o_ddr_dqs;
61
        // Address outputs
62
        output  reg     [13:0]   o_ddr_addr;
63
        output  reg     [2:0]    o_ddr_ba;
64
        // And the data inputs and outputs
65
        output  reg     [31:0]   o_ddr_data;
66
        input                   i_ddr_data;
67
 
68
//
69
// tWTR = 7.5
70
// tRRD = 7.5
71
// tREFI= 7.8
72
// tFAW = 45
73
// tRTP = 7.5
74
// tCKE = 5.625
75
// tRFC = 160
76
// tRP  = 13.5
77
// tRAS = 36
78
// tRCD = 13.5
79
//
80
// RESET:
81
//      1. Hold o_reset_n = 1'b0; for 200 us, or 40,000 clocks (65536 perhaps?)
82
//              Hold cke low during this time as well
83
//              The clock should be free running into the chip during this time
84
//              Leave command in NOOP state: {cs,ras,cas,we} = 4'h7;
85
//              ODT must be held low
86
//      2. Hold cke low for another 500us, or 100,000 clocks
87
//      3. Raise CKE, continue outputting a NOOP for
88
//              tXPR, tDLLk, and tZQInit
89
//      4. Load MRS2, wait tMRD
90
//      4. Load MRS3, wait tMRD
91
//      4. Load MRS1, wait tMOD
92
// Before using the SDRAM, we'll need to program at least 3 of the mode
93
//      registers, if not all 4. 
94
//   tMOD clocks are required to program the mode registers, during which
95
//      time the RAM must be idle.
96
//
97
// NOOP: CS low, RAS, CAS, and WE high
98
 
99
        // Need to set o_wb_dqs high one clock prior to any read.
100
        // As per spec, ODT = 0 during reads
101
        assign  o_ddr_odt = ~o_ddr_we_n;
102
endmodule

powered by: WebSVN 2.1.0

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