gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RubySystem.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /*
30  * Contains all of the various parts of the system we are simulating.
31  * Performs allocation, deallocation, and setup of all the major
32  * components of the system
33  */
34 
35 #ifndef __MEM_RUBY_SYSTEM_SYSTEM_HH__
36 #define __MEM_RUBY_SYSTEM_SYSTEM_HH__
37 
38 #include "base/callback.hh"
39 #include "base/output.hh"
40 #include "mem/packet.hh"
44 #include "params/RubySystem.hh"
45 #include "sim/clocked_object.hh"
46 
47 class Network;
48 class AbstractController;
49 
50 class RubySystem : public ClockedObject
51 {
52  public:
53  class RubyEvent : public Event
54  {
55  public:
56  RubyEvent(RubySystem* _ruby_system)
57  {
58  m_ruby_system = _ruby_system;
59  }
60  private:
61  void process();
62 
64  };
65 
66  friend class RubyEvent;
67 
68  typedef RubySystemParams Params;
69  RubySystem(const Params *p);
70  ~RubySystem();
71 
72  // config accessors
73  static int getRandomization() { return m_randomization; }
74  static uint32_t getBlockSizeBytes() { return m_block_size_bytes; }
75  static uint32_t getBlockSizeBits() { return m_block_size_bits; }
76  static uint32_t getMemorySizeBits() { return m_memory_size_bits; }
77  static bool getWarmupEnabled() { return m_warmup_enabled; }
78  static bool getCooldownEnabled() { return m_cooldown_enabled; }
79 
83 
84  // Public Methods
85  Profiler*
87  {
88  assert(m_profiler != NULL);
89  return m_profiler;
90  }
91 
92  void regStats() override {
95  }
97  void resetStats() override;
98 
99  void memWriteback() override;
100  void serialize(CheckpointOut &cp) const override;
101  void unserialize(CheckpointIn &cp) override;
102  void drainResume() override;
103  void process();
104  void startup() override;
105  bool functionalRead(Packet *ptr);
106  bool functionalWrite(Packet *ptr);
107 
108  void registerNetwork(Network*);
110 
111  bool eventQueueEmpty() { return eventq->empty(); }
113  {
114  RubyEvent* e = new RubyEvent(this);
115  schedule(e, tick);
116  }
117 
118  private:
119  // Private copy constructor and assignment operator
120  RubySystem(const RubySystem& obj);
121  RubySystem& operator=(const RubySystem& obj);
122 
123  void makeCacheRecorder(uint8_t *uncompressed_trace,
124  uint64_t cache_trace_size,
125  uint64_t block_size_bytes);
126 
127  static void readCompressedTrace(std::string filename,
128  uint8_t *&raw_data,
129  uint64_t &uncompressed_trace_size);
130  static void writeCompressedTrace(uint8_t *raw_data, std::string file,
131  uint64_t uncompressed_trace_size);
132 
133  private:
134  // configuration parameters
135  static bool m_randomization;
136  static uint32_t m_block_size_bytes;
137  static uint32_t m_block_size_bits;
138  static uint32_t m_memory_size_bits;
139 
140  static bool m_warmup_enabled;
141  static unsigned m_systems_to_warmup;
142  static bool m_cooldown_enabled;
145 
149 
150  public:
154 };
155 
157 {
158  private:
160 
161  public:
162  virtual ~RubyStatsCallback() {}
165 };
166 
167 #endif // __MEM_RUBY_SYSTEM_SYSTEM_HH__
EventQueue * eventq
A pointer to this object's event queue.
Definition: eventq.hh:714
Network * m_network
Definition: RubySystem.hh:146
static void readCompressedTrace(std::string filename, uint8_t *&raw_data, uint64_t &uncompressed_trace_size)
Definition: RubySystem.cc:274
static void writeCompressedTrace(uint8_t *raw_data, std::string file, uint64_t uncompressed_trace_size)
Definition: RubySystem.cc:207
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: RubySystem.cc:236
SimpleMemory * m_phys_mem
Definition: RubySystem.hh:143
Generic callback class.
Definition: callback.hh:41
RubySystem * m_ruby_system
Definition: RubySystem.hh:63
static bool m_randomization
Definition: RubySystem.hh:135
void collateStats()
Definition: Profiler.cc:347
SimpleMemory * getPhysMem()
Definition: RubySystem.hh:80
void makeCacheRecorder(uint8_t *uncompressed_trace, uint64_t cache_trace_size, uint64_t block_size_bytes)
Definition: RubySystem.cc:102
CacheRecorder * m_cache_recorder
Definition: RubySystem.hh:152
static uint32_t m_block_size_bytes
Definition: RubySystem.hh:136
RubySystem(const Params *p)
Definition: RubySystem.cc:59
static uint32_t getMemorySizeBits()
Definition: RubySystem.hh:76
bool functionalRead(Packet *ptr)
Definition: RubySystem.cc:399
static bool m_warmup_enabled
Definition: RubySystem.hh:140
Profiler * m_profiler
Definition: RubySystem.hh:151
bool functionalWrite(Packet *ptr)
Definition: RubySystem.cc:482
void drainResume() override
Resume execution after a successful drain.
Definition: RubySystem.cc:263
void enqueueRubyEvent(Tick tick)
Definition: RubySystem.hh:112
RubySystem * m_ruby_system
Definition: RubySystem.hh:159
static bool getWarmupEnabled()
Definition: RubySystem.hh:77
system
Definition: isa.cc:226
RubySystemParams Params
Definition: RubySystem.hh:68
Cycles getStartCycle()
Definition: RubySystem.hh:81
const bool m_access_backing_store
Definition: RubySystem.hh:144
void registerNetwork(Network *)
Definition: RubySystem.cc:81
The simple memory is a basic single-ported memory controller with a configurable throughput and laten...
Definition: simple_mem.hh:64
uint64_t Tick
Tick count type.
Definition: types.hh:63
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
std::vector< std::map< uint32_t, AbstractController * > > m_abstract_controls
Definition: RubySystem.hh:153
ClockedObject declaration and implementation.
friend class RubyEvent
Definition: RubySystem.hh:66
void startup() override
startup() is the final initialization call before simulation.
Definition: RubySystem.cc:332
void memWriteback() override
Write back dirty buffers to memory using functional writes.
Definition: RubySystem.cc:135
static bool getCooldownEnabled()
Definition: RubySystem.hh:78
void regStats(const std::string &name)
Definition: Profiler.cc:103
static uint32_t m_memory_size_bits
Definition: RubySystem.hh:138
void process()
virtual process function that is invoked when the callback queue is executed.
Definition: RubySystem.hh:164
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
bool eventQueueEmpty()
Definition: RubySystem.hh:111
void resetStats() override
Reset statistics associated with this object.
Definition: RubySystem.cc:393
static uint32_t m_block_size_bits
Definition: RubySystem.hh:137
std::vector< AbstractController * > m_abs_cntrl_vec
Definition: RubySystem.hh:147
Bitfield< 9 > e
Definition: miscregs.hh:1376
Cycles m_start_cycle
Definition: RubySystem.hh:148
RubySystem & operator=(const RubySystem &obj)
virtual const std::string name() const
Definition: sim_object.hh:117
RubyStatsCallback(RubySystem *system)
Definition: RubySystem.hh:163
Declaration of the Packet class.
std::ostream CheckpointOut
Definition: serialize.hh:67
Definition: eventq.hh:185
void process()
void schedule(Event &event, Tick when)
Definition: eventq.hh:728
void regStats() override
Register statistics for this object.
Definition: RubySystem.hh:92
static bool m_cooldown_enabled
Definition: RubySystem.hh:142
Bitfield< 0 > p
static unsigned m_systems_to_warmup
Definition: RubySystem.hh:141
virtual ~RubyStatsCallback()
Definition: RubySystem.hh:162
void collateStats()
Definition: RubySystem.hh:96
static uint32_t getBlockSizeBits()
Definition: RubySystem.hh:75
static uint32_t getBlockSizeBytes()
Definition: RubySystem.hh:74
void regStats() override
Register statistics for this object.
bool empty() const
Definition: eventq.hh:642
Profiler * getProfiler()
Definition: RubySystem.hh:86
void registerAbstractController(AbstractController *)
Definition: RubySystem.cc:87
RubyEvent(RubySystem *_ruby_system)
Definition: RubySystem.hh:56
static int getRandomization()
Definition: RubySystem.hh:73
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: RubySystem.cc:305
bool getAccessBackingStore()
Definition: RubySystem.hh:82

Generated on Fri Jun 9 2017 13:03:50 for gem5 by doxygen 1.8.6