memoryctrl.h revision 10152:52c552138ba1
1/*****************************************************************************
2 *                                McPAT
3 *                      SOFTWARE LICENSE AGREEMENT
4 *            Copyright 2012 Hewlett-Packard Development Company, L.P.
5 *                          All Rights Reserved
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met: redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer;
11 * redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution;
14 * neither the name of the copyright holders nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.”
29 *
30 ***************************************************************************/
31
32#ifndef MEMORYCTRL_H_
33#define MEMORYCTRL_H_
34
35#include "XML_Parse.h"
36#include "parameter.h"
37//#include "io.h"
38#include "array.h"
39//#include "Undifferentiated_Core_Area.h"
40#include <vector>
41
42#include "basic_components.h"
43
44class MCBackend : public Component {
45  public:
46    InputParameter l_ip;
47    uca_org_t local_result;
48        enum MemoryCtrl_type mc_type;
49    MCParam  mcp;
50    statsDef tdp_stats;
51    statsDef rtp_stats;
52    statsDef stats_t;
53    powerDef power_t;
54    MCBackend(InputParameter* interface_ip_, const MCParam & mcp_, enum MemoryCtrl_type mc_type_);
55    void compute();
56        void computeEnergy(bool is_tdp=true);
57    void displayEnergy(uint32_t indent = 0,int plevel = 100, bool is_tdp=true);
58    ~MCBackend(){};
59};
60
61class MCPHY : public Component {
62  public:
63    InputParameter l_ip;
64    uca_org_t local_result;
65        enum MemoryCtrl_type mc_type;
66    MCParam  mcp;
67    statsDef       tdp_stats;
68    statsDef       rtp_stats;
69    statsDef       stats_t;
70    powerDef       power_t;
71    MCPHY(InputParameter* interface_ip_, const MCParam & mcp_, enum MemoryCtrl_type mc_type_);
72    void compute();
73        void computeEnergy(bool is_tdp=true);
74    void displayEnergy(uint32_t indent = 0,int plevel = 100, bool is_tdp=true);
75    ~MCPHY(){};
76};
77
78class MCFrontEnd : public Component {
79  public:
80        ParseXML *XML;
81        InputParameter interface_ip;
82        enum MemoryCtrl_type mc_type;
83        MCParam  mcp;
84        selection_logic * MC_arb;
85        ArrayST  * frontendBuffer;
86        ArrayST  * readBuffer;
87        ArrayST  * writeBuffer;
88
89    MCFrontEnd(ParseXML *XML_interface,InputParameter* interface_ip_, const MCParam & mcp_, enum MemoryCtrl_type mc_type_);
90    void computeEnergy(bool is_tdp=true);
91    void displayEnergy(uint32_t indent = 0,int plevel = 100, bool is_tdp=true);
92    ~MCFrontEnd();
93};
94
95class MemoryController : public Component {
96  public:
97        ParseXML *XML;
98        InputParameter interface_ip;
99        enum MemoryCtrl_type mc_type;
100    MCParam  mcp;
101        MCFrontEnd * frontend;
102    MCBackend * transecEngine;
103    MCPHY	 * PHY;
104    Pipeline * pipeLogic;
105
106    //clock_network clockNetwork;
107    MemoryController(ParseXML *XML_interface,InputParameter* interface_ip_, enum MemoryCtrl_type mc_type_);
108    void set_mc_param();
109    void computeEnergy(bool is_tdp=true);
110    void displayEnergy(uint32_t indent = 0,int plevel = 100, bool is_tdp=true);
111    ~MemoryController();
112};
113#endif /* MEMORYCTRL_H_ */
114