gem5  v20.1.0.0
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 class Network;
50 class AbstractController;
51 
52 class RubySystem : public ClockedObject
53 {
54  public:
55  typedef RubySystemParams Params;
56  RubySystem(const Params *p);
57  ~RubySystem();
58  const Params *params() const { return (const Params *)_params; }
59 
60  // config accessors
61  static int getRandomization() { return m_randomization; }
62  static uint32_t getBlockSizeBytes() { return m_block_size_bytes; }
63  static uint32_t getBlockSizeBits() { return m_block_size_bits; }
64  static uint32_t getMemorySizeBits() { return m_memory_size_bits; }
65  static bool getWarmupEnabled() { return m_warmup_enabled; }
66  static bool getCooldownEnabled() { return m_cooldown_enabled; }
67 
71 
72  // Public Methods
73  Profiler*
75  {
76  assert(m_profiler != NULL);
77  return m_profiler;
78  }
79 
80  void regStats() override {
83  }
85  void resetStats() override;
86 
87  void memWriteback() override;
88  void serialize(CheckpointOut &cp) const override;
89  void unserialize(CheckpointIn &cp) override;
90  void drainResume() override;
91  void process();
92  void init() override;
93  void startup() override;
94  bool functionalRead(Packet *ptr);
95  bool functionalWrite(Packet *ptr);
96 
97  void registerNetwork(Network*);
99  void registerMachineID(const MachineID& mach_id, Network* network);
100  void registerRequestorIDs();
101 
102  bool eventQueueEmpty() { return eventq->empty(); }
104  {
105  auto e = new EventFunctionWrapper(
106  [this]{ processRubyEvent(); }, "RubyEvent");
107  schedule(e, tick);
108  }
109 
110  private:
111  // Private copy constructor and assignment operator
112  RubySystem(const RubySystem& obj);
113  RubySystem& operator=(const RubySystem& obj);
114 
115  void makeCacheRecorder(uint8_t *uncompressed_trace,
116  uint64_t cache_trace_size,
117  uint64_t block_size_bytes);
118 
119  static void readCompressedTrace(std::string filename,
120  uint8_t *&raw_data,
121  uint64_t &uncompressed_trace_size);
122  static void writeCompressedTrace(uint8_t *raw_data, std::string file,
123  uint64_t uncompressed_trace_size);
124 
125  void processRubyEvent();
126  private:
127  // configuration parameters
128  static bool m_randomization;
129  static uint32_t m_block_size_bytes;
130  static uint32_t m_block_size_bits;
131  static uint32_t m_memory_size_bits;
132 
133  static bool m_warmup_enabled;
134  static unsigned m_systems_to_warmup;
135  static bool m_cooldown_enabled;
138 
139  //std::vector<Network *> m_networks;
143 
144  std::unordered_map<MachineID, unsigned> machineToNetwork;
145  std::unordered_map<RequestorID, unsigned> requestorToNetwork;
146  std::unordered_map<unsigned, std::vector<AbstractController*>> netCntrls;
147 
148  public:
152 };
153 
154 #endif //__MEM_RUBY_SYSTEM_RUBYSYSTEM_HH__
Stats::Group::regStats
virtual void regStats()
Callback to set stat parameters.
Definition: group.cc:64
RubySystem::m_abstract_controls
std::vector< std::map< uint32_t, AbstractController * > > m_abstract_controls
Definition: RubySystem.hh:151
CacheRecorder
Definition: CacheRecorder.hh:66
RubySystem::functionalRead
bool functionalRead(Packet *ptr)
Definition: RubySystem.cc:477
Profiler.hh
RubySystem::getBlockSizeBytes
static uint32_t getBlockSizeBytes()
Definition: RubySystem.hh:62
RubySystem::registerAbstractController
void registerAbstractController(AbstractController *)
Definition: RubySystem.cc:102
Profiler::regStats
void regStats(const std::string &name)
Definition: Profiler.cc:104
RubySystem::m_phys_mem
SimpleMemory * m_phys_mem
Definition: RubySystem.hh:136
RubySystem::m_start_cycle
Cycles m_start_cycle
Definition: RubySystem.hh:142
RubySystem::getPhysMem
SimpleMemory * getPhysMem()
Definition: RubySystem.hh:68
RubySystem::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: RubySystem.cc:374
RubySystem::writeCompressedTrace
static void writeCompressedTrace(uint8_t *raw_data, std::string file, uint64_t uncompressed_trace_size)
Definition: RubySystem.cc:276
RubySystem::requestorToNetwork
std::unordered_map< RequestorID, unsigned > requestorToNetwork
Definition: RubySystem.hh:145
RubySystem::Params
RubySystemParams Params
Definition: RubySystem.hh:55
RubySystem::m_block_size_bytes
static uint32_t m_block_size_bytes
Definition: RubySystem.hh:129
Clocked::tick
Tick tick
Definition: clocked_object.hh:65
SimpleMemory
The simple memory is a basic single-ported memory controller with a configurable throughput and laten...
Definition: simple_mem.hh:61
RubySystem::resetStats
void resetStats() override
Callback to reset stats.
Definition: RubySystem.cc:468
RubySystem::drainResume
void drainResume() override
Resume execution after a successful drain.
Definition: RubySystem.cc:332
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
RubySystem::RubySystem
RubySystem(const Params *p)
Definition: RubySystem.cc:74
AbstractController.hh
RubySystem::registerMachineID
void registerMachineID(const MachineID &mach_id, Network *network)
Definition: RubySystem.cc:111
RubySystem::m_cooldown_enabled
static bool m_cooldown_enabled
Definition: RubySystem.hh:135
std::vector
STL vector class.
Definition: stl.hh:37
AbstractController
Definition: AbstractController.hh:74
RubySystem::netCntrls
std::unordered_map< unsigned, std::vector< AbstractController * > > netCntrls
Definition: RubySystem.hh:146
RubySystem::m_networks
std::vector< std::unique_ptr< Network > > m_networks
Definition: RubySystem.hh:140
RubySystem::registerRequestorIDs
void registerRequestorIDs()
Definition: RubySystem.cc:131
MachineID
Definition: MachineID.hh:38
output.hh
RubySystem::regStats
void regStats() override
Callback to set stat parameters.
Definition: RubySystem.hh:80
RubySystem::m_profiler
Profiler * m_profiler
Definition: RubySystem.hh:149
RubySystem::registerNetwork
void registerNetwork(Network *)
Definition: RubySystem.cc:96
ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:231
packet.hh
EventFunctionWrapper
Definition: eventq.hh:1101
RubySystem::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: RubySystem.cc:401
RubySystem::collateStats
void collateStats()
Definition: RubySystem.hh:84
RubySystem::m_access_backing_store
const bool m_access_backing_store
Definition: RubySystem.hh:137
RubySystem::~RubySystem
~RubySystem()
Definition: RubySystem.cc:165
cp
Definition: cprintf.cc:40
RubySystem::getProfiler
Profiler * getProfiler()
Definition: RubySystem.hh:74
EventManager::schedule
void schedule(Event &event, Tick when)
Definition: eventq.hh:1005
RubySystem::memWriteback
void memWriteback() override
Write back dirty buffers to memory using functional writes.
Definition: RubySystem.cc:204
Profiler
Definition: Profiler.hh:64
RubySystem::readCompressedTrace
static void readCompressedTrace(std::string filename, uint8_t *&raw_data, uint64_t &uncompressed_trace_size)
Definition: RubySystem.cc:343
RubySystem::m_abs_cntrl_vec
std::vector< AbstractController * > m_abs_cntrl_vec
Definition: RubySystem.hh:141
RubySystem
Definition: RubySystem.hh:52
RubySystem::eventQueueEmpty
bool eventQueueEmpty()
Definition: RubySystem.hh:102
RubySystem::getStartCycle
Cycles getStartCycle()
Definition: RubySystem.hh:69
EventQueue::empty
bool empty() const
Returns true if no events are queued.
Definition: eventq.hh:891
RubySystem::makeCacheRecorder
void makeCacheRecorder(uint8_t *uncompressed_trace, uint64_t cache_trace_size, uint64_t block_size_bytes)
Definition: RubySystem.cc:171
RubySystem::functionalWrite
bool functionalWrite(Packet *ptr)
Definition: RubySystem.cc:597
RubySystem::process
void process()
RubySystem::getAccessBackingStore
bool getAccessBackingStore()
Definition: RubySystem.hh:70
RubySystem::operator=
RubySystem & operator=(const RubySystem &obj)
RubySystem::machineToNetwork
std::unordered_map< MachineID, unsigned > machineToNetwork
Definition: RubySystem.hh:144
Network
Definition: Network.hh:76
RubySystem::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: RubySystem.cc:305
RubySystem::getCooldownEnabled
static bool getCooldownEnabled()
Definition: RubySystem.hh:66
RubySystem::getMemorySizeBits
static uint32_t getMemorySizeBits()
Definition: RubySystem.hh:64
RubySystem::m_memory_size_bits
static uint32_t m_memory_size_bits
Definition: RubySystem.hh:131
ArmISA::e
Bitfield< 9 > e
Definition: miscregs_types.hh:61
RubySystem::processRubyEvent
void processRubyEvent()
Definition: RubySystem.cc:458
SimObject::name
virtual const std::string name() const
Definition: sim_object.hh:133
RubySystem::params
const Params * params() const
Definition: RubySystem.hh:58
RubySystem::m_randomization
static bool m_randomization
Definition: RubySystem.hh:128
RubySystem::startup
void startup() override
startup() is the final initialization call before simulation.
Definition: RubySystem.cc:407
RubySystem::getWarmupEnabled
static bool getWarmupEnabled()
Definition: RubySystem.hh:65
RubySystem::m_warmup_enabled
static bool m_warmup_enabled
Definition: RubySystem.hh:133
SimObject::_params
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:110
clocked_object.hh
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
EventManager::eventq
EventQueue * eventq
A pointer to this object's event queue.
Definition: eventq.hh:977
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
RubySystem::m_systems_to_warmup
static unsigned m_systems_to_warmup
Definition: RubySystem.hh:134
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
RubySystem::getRandomization
static int getRandomization()
Definition: RubySystem.hh:61
RubySystem::enqueueRubyEvent
void enqueueRubyEvent(Tick tick)
Definition: RubySystem.hh:103
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
CacheRecorder.hh
CheckpointIn
Definition: serialize.hh:67
RubySystem::m_block_size_bits
static uint32_t m_block_size_bits
Definition: RubySystem.hh:130
Profiler::collateStats
void collateStats()
Definition: Profiler.cc:348
RubySystem::getBlockSizeBits
static uint32_t getBlockSizeBits()
Definition: RubySystem.hh:63
callback.hh
RubySystem::m_cache_recorder
CacheRecorder * m_cache_recorder
Definition: RubySystem.hh:150

Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17