gem5  v21.1.0.2
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_RUBYSYSTEM_HH__
36 #define __MEM_RUBY_SYSTEM_RUBYSYSTEM_HH__
37 
38 #include <unordered_map>
39 
40 #include "base/callback.hh"
41 #include "base/output.hh"
42 #include "mem/packet.hh"
46 #include "params/RubySystem.hh"
47 #include "sim/clocked_object.hh"
48 
49 namespace gem5
50 {
51 
52 namespace memory
53 {
54 class SimpleMemory;
55 } // namespace memory
56 
57 namespace ruby
58 {
59 
60 class Network;
61 class AbstractController;
62 
63 class RubySystem : public ClockedObject
64 {
65  public:
67  RubySystem(const Params &p);
68  ~RubySystem();
69 
70  // config accessors
71  static int getRandomization() { return m_randomization; }
72  static uint32_t getBlockSizeBytes() { return m_block_size_bytes; }
73  static uint32_t getBlockSizeBits() { return m_block_size_bits; }
74  static uint32_t getMemorySizeBits() { return m_memory_size_bits; }
75  static bool getWarmupEnabled() { return m_warmup_enabled; }
76  static bool getCooldownEnabled() { return m_cooldown_enabled; }
77 
81 
82  // Public Methods
83  Profiler*
85  {
86  assert(m_profiler != NULL);
87  return m_profiler;
88  }
89 
90  void regStats() override {
92  }
94  void resetStats() override;
95 
96  void memWriteback() override;
97  void serialize(CheckpointOut &cp) const override;
98  void unserialize(CheckpointIn &cp) override;
99  void drainResume() override;
100  void process();
101  void init() override;
102  void startup() override;
103  bool functionalRead(Packet *ptr);
104  bool functionalWrite(Packet *ptr);
105 
106  void registerNetwork(Network*);
108  void registerMachineID(const MachineID& mach_id, Network* network);
109  void registerRequestorIDs();
110 
111  bool eventQueueEmpty() { return eventq->empty(); }
113  {
114  auto e = new EventFunctionWrapper(
115  [this]{ processRubyEvent(); }, "RubyEvent");
116  schedule(e, tick);
117  }
118 
119  private:
120  // Private copy constructor and assignment operator
121  RubySystem(const RubySystem& obj);
122  RubySystem& operator=(const RubySystem& obj);
123 
124  void makeCacheRecorder(uint8_t *uncompressed_trace,
125  uint64_t cache_trace_size,
126  uint64_t block_size_bytes);
127 
128  static void readCompressedTrace(std::string filename,
129  uint8_t *&raw_data,
130  uint64_t &uncompressed_trace_size);
131  static void writeCompressedTrace(uint8_t *raw_data, std::string file,
132  uint64_t uncompressed_trace_size);
133 
134  void processRubyEvent();
135  private:
136  // configuration parameters
137  static bool m_randomization;
138  static uint32_t m_block_size_bytes;
139  static uint32_t m_block_size_bits;
140  static uint32_t m_memory_size_bits;
141 
142  static bool m_warmup_enabled;
143  static unsigned m_systems_to_warmup;
144  static bool m_cooldown_enabled;
147 
148  //std::vector<Network *> m_networks;
152 
153  std::unordered_map<MachineID, unsigned> machineToNetwork;
154  std::unordered_map<RequestorID, unsigned> requestorToNetwork;
155  std::unordered_map<unsigned, std::vector<AbstractController*>> netCntrls;
156 
157  public:
161 };
162 
163 } // namespace ruby
164 } // namespace gem5
165 
166 #endif //__MEM_RUBY_SYSTEM_RUBYSYSTEM_HH__
gem5::ruby::RubySystem::m_warmup_enabled
static bool m_warmup_enabled
Definition: RubySystem.hh:142
gem5::ruby::RubySystem::RubySystem
RubySystem(const Params &p)
Definition: RubySystem.cc:79
gem5::ruby::RubySystem::regStats
void regStats() override
Callback to set stat parameters.
Definition: RubySystem.hh:90
gem5::ruby::RubySystem::functionalRead
bool functionalRead(Packet *ptr)
Definition: RubySystem.cc:484
Profiler.hh
gem5::ruby::RubySystem::getProfiler
Profiler * getProfiler()
Definition: RubySystem.hh:84
memory
Definition: mem.h:38
gem5::ruby::RubySystem::eventQueueEmpty
bool eventQueueEmpty()
Definition: RubySystem.hh:111
gem5::ruby::RubySystem::startup
void startup() override
startup() is the final initialization call before simulation.
Definition: RubySystem.cc:413
gem5::ruby::RubySystem::PARAMS
PARAMS(RubySystem)
gem5::ruby::RubySystem::machineToNetwork
std::unordered_map< MachineID, unsigned > machineToNetwork
Definition: RubySystem.hh:153
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::ruby::Network
Definition: Network.hh:82
gem5::ruby::RubySystem::getMemorySizeBits
static uint32_t getMemorySizeBits()
Definition: RubySystem.hh:74
gem5::ruby::RubySystem::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: RubySystem.cc:407
gem5::ruby::RubySystem::processRubyEvent
void processRubyEvent()
Definition: RubySystem.cc:464
gem5::ruby::RubySystem::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: RubySystem.cc:311
gem5::ruby::RubySystem::netCntrls
std::unordered_map< unsigned, std::vector< AbstractController * > > netCntrls
Definition: RubySystem.hh:155
gem5::ruby::RubySystem::m_abstract_controls
std::vector< std::map< uint32_t, AbstractController * > > m_abstract_controls
Definition: RubySystem.hh:160
gem5::ArmISA::e
Bitfield< 9 > e
Definition: misc_types.hh:64
AbstractController.hh
gem5::ruby::RubySystem::getBlockSizeBytes
static uint32_t getBlockSizeBytes()
Definition: RubySystem.hh:72
gem5::EventManager::schedule
void schedule(Event &event, Tick when)
Definition: eventq.hh:1019
std::vector
STL vector class.
Definition: stl.hh:37
gem5::memory::SimpleMemory
The simple memory is a basic single-ported memory controller with a configurable throughput and laten...
Definition: simple_mem.hh:67
gem5::ruby::RubySystem::m_start_cycle
Cycles m_start_cycle
Definition: RubySystem.hh:151
gem5::ruby::RubySystem::resetStats
void resetStats() override
Callback to reset stats.
Definition: RubySystem.cc:474
gem5::ruby::RubySystem::getAccessBackingStore
bool getAccessBackingStore()
Definition: RubySystem.hh:80
gem5::ruby::AbstractController
Definition: AbstractController.hh:82
output.hh
gem5::ruby::RubySystem::m_phys_mem
memory::SimpleMemory * m_phys_mem
Definition: RubySystem.hh:145
packet.hh
gem5::ruby::RubySystem::writeCompressedTrace
static void writeCompressedTrace(uint8_t *raw_data, std::string file, uint64_t uncompressed_trace_size)
Definition: RubySystem.cc:282
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::ruby::RubySystem::registerAbstractController
void registerAbstractController(AbstractController *)
Definition: RubySystem.cc:107
gem5::ruby::RubySystem::process
void process()
gem5::ruby::RubySystem::m_access_backing_store
const bool m_access_backing_store
Definition: RubySystem.hh:146
gem5::ruby::RubySystem::m_networks
std::vector< std::unique_ptr< Network > > m_networks
Definition: RubySystem.hh:149
gem5::ruby::RubySystem::readCompressedTrace
static void readCompressedTrace(std::string filename, uint8_t *&raw_data, uint64_t &uncompressed_trace_size)
Definition: RubySystem.cc:349
gem5::ruby::RubySystem::operator=
RubySystem & operator=(const RubySystem &obj)
gem5::ruby::RubySystem::getStartCycle
Cycles getStartCycle()
Definition: RubySystem.hh:79
gem5::ruby::RubySystem::m_randomization
static bool m_randomization
Definition: RubySystem.hh:137
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::ruby::RubySystem::m_cache_recorder
CacheRecorder * m_cache_recorder
Definition: RubySystem.hh:159
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::ruby::RubySystem::m_abs_cntrl_vec
std::vector< AbstractController * > m_abs_cntrl_vec
Definition: RubySystem.hh:150
gem5::EventManager::eventq
EventQueue * eventq
A pointer to this object's event queue.
Definition: eventq.hh:991
gem5::ruby::RubySystem::getBlockSizeBits
static uint32_t getBlockSizeBits()
Definition: RubySystem.hh:73
gem5::ruby::RubySystem::m_profiler
Profiler * m_profiler
Definition: RubySystem.hh:158
gem5::ruby::RubySystem::getRandomization
static int getRandomization()
Definition: RubySystem.hh:71
gem5::EventQueue::empty
bool empty() const
Returns true if no events are queued.
Definition: eventq.hh:898
gem5::ruby::RubySystem::m_block_size_bytes
static uint32_t m_block_size_bytes
Definition: RubySystem.hh:138
gem5::ruby::RubySystem::memWriteback
void memWriteback() override
Write back dirty buffers to memory using functional writes.
Definition: RubySystem.cc:209
gem5::ruby::RubySystem::~RubySystem
~RubySystem()
Definition: RubySystem.cc:170
gem5::ruby::RubySystem::getCooldownEnabled
static bool getCooldownEnabled()
Definition: RubySystem.hh:76
gem5::ruby::RubySystem::registerRequestorIDs
void registerRequestorIDs()
Definition: RubySystem.cc:136
gem5::statistics::Group::regStats
virtual void regStats()
Callback to set stat parameters.
Definition: group.cc:69
gem5::ruby::RubySystem::makeCacheRecorder
void makeCacheRecorder(uint8_t *uncompressed_trace, uint64_t cache_trace_size, uint64_t block_size_bytes)
Definition: RubySystem.cc:176
gem5::ruby::RubySystem::registerMachineID
void registerMachineID(const MachineID &mach_id, Network *network)
Definition: RubySystem.cc:116
gem5::ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:234
gem5::ruby::RubySystem::requestorToNetwork
std::unordered_map< RequestorID, unsigned > requestorToNetwork
Definition: RubySystem.hh:154
gem5::ruby::RubySystem::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: RubySystem.cc:380
gem5::EventFunctionWrapper
Definition: eventq.hh:1115
gem5::ruby::RubySystem::drainResume
void drainResume() override
Resume execution after a successful drain.
Definition: RubySystem.cc:338
gem5::ruby::RubySystem
Definition: RubySystem.hh:63
gem5::ruby::RubySystem::m_memory_size_bits
static uint32_t m_memory_size_bits
Definition: RubySystem.hh:140
gem5::ruby::Profiler::collateStats
void collateStats()
Definition: Profiler.cc:371
gem5::ruby::RubySystem::m_systems_to_warmup
static unsigned m_systems_to_warmup
Definition: RubySystem.hh:143
gem5::ruby::RubySystem::getWarmupEnabled
static bool getWarmupEnabled()
Definition: RubySystem.hh:75
clocked_object.hh
gem5::Clocked::tick
Tick tick
Definition: clocked_object.hh:68
gem5::ruby::RubySystem::collateStats
void collateStats()
Definition: RubySystem.hh:93
gem5::ruby::RubySystem::enqueueRubyEvent
void enqueueRubyEvent(Tick tick)
Definition: RubySystem.hh:112
gem5::ruby::RubySystem::getPhysMem
memory::SimpleMemory * getPhysMem()
Definition: RubySystem.hh:78
gem5::ruby::RubySystem::functionalWrite
bool functionalWrite(Packet *ptr)
Definition: RubySystem.cc:701
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5::ClockedObject::Params
ClockedObjectParams Params
Parameters of ClockedObject.
Definition: clocked_object.hh:240
CacheRecorder.hh
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ruby::RubySystem::m_cooldown_enabled
static bool m_cooldown_enabled
Definition: RubySystem.hh:144
gem5::ruby::MachineID
Definition: MachineID.hh:56
gem5::ruby::Profiler
Definition: Profiler.hh:71
gem5::ruby::CacheRecorder
Definition: CacheRecorder.hh:73
callback.hh
gem5::ruby::RubySystem::registerNetwork
void registerNetwork(Network *)
Definition: RubySystem.cc:101
gem5::ruby::RubySystem::m_block_size_bits
static uint32_t m_block_size_bits
Definition: RubySystem.hh:139

Generated on Tue Sep 21 2021 12:25:42 for gem5 by doxygen 1.8.17