1 |
16 |
dgisselq |
////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//
|
3 |
|
|
// Filename: pddrsim.h
|
4 |
|
|
//
|
5 |
|
|
// Project: A wishbone controlled DDR3 SDRAM memory controller.
|
6 |
|
|
//
|
7 |
|
|
// Purpose: To expand a DDR3 SDRAM controllers influence across multiple
|
8 |
|
|
// clocks. Hence, if the DDR3 SDRAM controller runs at half
|
9 |
|
|
// the clock rate of the DDR3-SDRAM, this will expand it to the full
|
10 |
|
|
// clock rate.
|
11 |
|
|
//
|
12 |
|
|
// Creator: Dan Gisselquist, Ph.D.
|
13 |
|
|
// Gisselquist Technology, LLC
|
14 |
|
|
//
|
15 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
16 |
|
|
//
|
17 |
|
|
// Copyright (C) 2016, Gisselquist Technology, LLC
|
18 |
|
|
//
|
19 |
|
|
// This program is free software (firmware): you can redistribute it and/or
|
20 |
|
|
// modify it under the terms of the GNU General Public License as published
|
21 |
|
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
22 |
|
|
// your option) any later version.
|
23 |
|
|
//
|
24 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
25 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
26 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
27 |
|
|
// for more details.
|
28 |
|
|
//
|
29 |
|
|
// You should have received a copy of the GNU General Public License along
|
30 |
|
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
31 |
|
|
// target there if the PDF file isn't present.) If not, see
|
32 |
|
|
// <http://www.gnu.org/licenses/> for a copy.
|
33 |
|
|
//
|
34 |
|
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
35 |
|
|
// http://www.gnu.org/licenses/gpl.html
|
36 |
|
|
//
|
37 |
|
|
//
|
38 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
39 |
|
|
//
|
40 |
|
|
//
|
41 |
|
|
#ifndef PDDRSIM_H
|
42 |
|
|
#define PDDRSIM_H
|
43 |
|
|
|
44 |
|
|
#include "ddrsdramsim.h"
|
45 |
|
|
|
46 |
|
|
class PDDRSIM : protected DDRSDRAMSIM {
|
47 |
|
|
public:
|
48 |
|
|
PDDRSIM(int lglen) : DDRSDRAMSIM(lglen) {};
|
49 |
|
|
unsigned long operator()(int, int, int,
|
50 |
|
|
unsigned, unsigned, unsigned long);
|
51 |
|
|
unsigned long operator[](unsigned addr) {
|
52 |
|
|
unsigned hdata, ldata;
|
53 |
|
|
unsigned long odata;
|
54 |
|
|
hdata = mem(addr<<1);
|
55 |
|
|
ldata = mem((addr<<1)+1);
|
56 |
|
|
|
57 |
|
|
odata = (((unsigned long)hdata)<<32)|((unsigned long)ldata);
|
58 |
|
|
return odata; };
|
59 |
|
|
void set(unsigned addr, unsigned long data) {
|
60 |
|
|
unsigned hdata, ldata;
|
61 |
|
|
hdata = (unsigned long)(data>>32);
|
62 |
|
|
ldata = (unsigned long)(data);
|
63 |
|
|
|
64 |
|
|
mem((addr<<1) ) = hdata;
|
65 |
|
|
mem((addr<<1)+1) = ldata;
|
66 |
|
|
};
|
67 |
|
|
unsigned bank_state(int bankid) {
|
68 |
|
|
return (m_bank[bankid].m_state & 0x0ffff); };
|
69 |
|
|
};
|
70 |
|
|
|
71 |
|
|
#endif
|