gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
49namespace gem5
50{
51
52namespace memory
53{
54class SimpleMemory;
55} // namespace memory
56
57namespace ruby
58{
59
60class Network;
61class AbstractController;
62
64{
65 public:
67 RubySystem(const Params &p);
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
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
108 void registerMachineID(const MachineID& mach_id, Network* network);
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
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;
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__
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
ClockedObjectParams Params
Parameters of ClockedObject.
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
EventQueue * eventq
A pointer to this object's event queue.
Definition eventq.hh:984
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
The simple memory is a basic single-ported memory controller with a configurable throughput and laten...
Definition simple_mem.hh:68
void enqueueRubyEvent(Tick tick)
static bool m_warmup_enabled
static bool getWarmupEnabled()
Definition RubySystem.hh:75
bool functionalWrite(Packet *ptr)
RubySystem & operator=(const RubySystem &obj)
static uint32_t getBlockSizeBytes()
Definition RubySystem.hh:72
void unserialize(CheckpointIn &cp) override
Unserialize an object.
const bool m_access_backing_store
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
static bool m_cooldown_enabled
std::vector< std::map< uint32_t, AbstractController * > > m_abstract_controls
void registerMachineID(const MachineID &mach_id, Network *network)
static bool m_randomization
static unsigned m_systems_to_warmup
std::unordered_map< RequestorID, unsigned > requestorToNetwork
static void writeCompressedTrace(uint8_t *raw_data, std::string file, uint64_t uncompressed_trace_size)
RubySystem(const Params &p)
Definition RubySystem.cc:79
void registerNetwork(Network *)
void startup() override
startup() is the final initialization call before simulation.
static uint32_t getBlockSizeBits()
Definition RubySystem.hh:73
std::unordered_map< MachineID, unsigned > machineToNetwork
memory::SimpleMemory * getPhysMem()
Definition RubySystem.hh:78
static void readCompressedTrace(std::string filename, uint8_t *&raw_data, uint64_t &uncompressed_trace_size)
void registerAbstractController(AbstractController *)
CacheRecorder * m_cache_recorder
static uint32_t m_block_size_bits
std::vector< std::unique_ptr< Network > > m_networks
void drainResume() override
Resume execution after a successful drain.
static uint32_t m_block_size_bytes
std::vector< AbstractController * > m_abs_cntrl_vec
void resetStats() override
Callback to reset stats.
memory::SimpleMemory * m_phys_mem
std::unordered_map< unsigned, std::vector< AbstractController * > > netCntrls
static uint32_t m_memory_size_bits
static int getRandomization()
Definition RubySystem.hh:71
Profiler * getProfiler()
Definition RubySystem.hh:84
void regStats() override
Callback to set stat parameters.
Definition RubySystem.hh:90
static uint32_t getMemorySizeBits()
Definition RubySystem.hh:74
bool functionalRead(Packet *ptr)
void makeCacheRecorder(uint8_t *uncompressed_trace, uint64_t cache_trace_size, uint64_t block_size_bytes)
void serialize(CheckpointOut &cp) const override
Serialize an object.
RubySystem(const RubySystem &obj)
void memWriteback() override
Write back dirty buffers to memory using functional writes.
static bool getCooldownEnabled()
Definition RubySystem.hh:76
STL vector class.
Definition stl.hh:37
ClockedObject declaration and implementation.
void schedule(Event &event, Tick when)
Definition eventq.hh:1012
bool empty() const
Returns true if no events are queued.
Definition eventq.hh:891
virtual void regStats()
Callback to set stat parameters.
Definition group.cc:68
Bitfield< 9 > e
Definition misc_types.hh:65
Bitfield< 0 > p
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
std::ostream CheckpointOut
Definition serialize.hh:66
uint64_t Tick
Tick count type.
Definition types.hh:58
Declaration of the Packet class.
Definition mem.h:38

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0