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

Subversion Repositories wbddr3

[/] [wbddr3/] [trunk/] [bench/] [cpp/] [ddrsdramsim.h] - Blame information for rev 13

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

Line No. Rev Author Line
1 4 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    ddrsdramsim.h
4
//
5
// Project:     A wishbone controlled DDR3 SDRAM memory controller.
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
#ifndef DDRSDRAMSIM_H
39
#define DDRSDRAMSIM_H
40
 
41
#define DDR_MRSET       0
42
#define DDR_REFRESH     1
43
#define DDR_PRECHARGE   2
44
#define DDR_ACTIVATE    3
45
#define DDR_WRITE       4
46
#define DDR_READ        5
47
#define DDR_ZQS         6
48
#define DDR_NOOP        7
49
 
50
#define NBANKS          8
51 13 dgisselq
#define NTIMESLOTS      32
52 4 dgisselq
 
53
class   BANKINFO {
54
public:
55
        int             m_state;
56 12 dgisselq
        unsigned        m_row, m_wcounter;
57 4 dgisselq
        void    tick(int cmd, unsigned addr=0);
58
};
59
 
60
class   BUSTIMESLOT     {
61
public:
62 13 dgisselq
        int     m_used, m_read, m_data, m_rtt;
63 4 dgisselq
        unsigned        m_addr;
64
};
65
 
66
class   DDRSDRAMSIM     {
67 6 dgisselq
        int             m_reset_state, m_reset_counts, m_memlen, m_busloc,
68 13 dgisselq
                        m_clocks_since_refresh, m_nrefresh_issued,
69
                        m_last_dqs, m_last_rtt;
70 4 dgisselq
        unsigned        *m_mem;
71
        BANKINFO        m_bank[8];
72
        BUSTIMESLOT     *m_bus;
73
        int     cmd(int,int,int,int);
74
public:
75
        DDRSDRAMSIM(int lglen);
76
        unsigned operator()(int, int,
77
                        int, int, int, int,
78
                        int, int, int, int,
79
                        int, int, int);
80
        unsigned &operator[](unsigned addr) { return m_mem[addr]; };
81
};
82
 
83
#endif

powered by: WebSVN 2.1.0

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