gem5 v24.1.0.1
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"
47#include "params/RubySystem.hh"
48#include "sim/clocked_object.hh"
49
50namespace gem5
51{
52
53namespace memory
54{
55class SimpleMemory;
56} // namespace memory
57
58namespace ruby
59{
60
61class Network;
62class AbstractController;
63
65{
66 public:
68 RubySystem(const Params &p);
70
71 // config accessors
74 uint32_t getBlockSizeBits() { return m_block_size_bits; }
78
82
83 // Public Methods
86 {
87 assert(m_profiler != NULL);
88 return m_profiler;
89 }
90
91 void regStats() override {
93 }
95 void resetStats() override;
96
97 void memWriteback() override;
98 void serialize(CheckpointOut &cp) const override;
99 void unserialize(CheckpointIn &cp) override;
100 void drainResume() override;
101 void process();
102 void init() override;
103 void startup() override;
104 bool functionalRead(Packet *ptr);
105 bool functionalWrite(Packet *ptr);
106
109 AbstractController*, std::unique_ptr<ProtocolInfo>
110 );
111 void registerMachineID(const MachineID& mach_id, Network* network);
113
114 bool eventQueueEmpty() { return eventq->empty(); }
116 {
117 auto e = new EventFunctionWrapper(
118 [this]{ processRubyEvent(); }, "RubyEvent");
119 schedule(e, tick);
120 }
121
123
124 private:
125 // Private copy constructor and assignment operator
128
129 void makeCacheRecorder(uint8_t *uncompressed_trace,
130 uint64_t cache_trace_size,
131 uint64_t block_size_bytes);
132
133 static void readCompressedTrace(std::string filename,
134 uint8_t *&raw_data,
135 uint64_t &uncompressed_trace_size);
136 static void writeCompressedTrace(uint8_t *raw_data, std::string file,
137 uint64_t uncompressed_trace_size);
138
139 void processRubyEvent();
140
141 // Called from `functionalRead` depending on if the protocol needs
142 // partial functional reads.
145
146 private:
147 // configuration parameters
152
153 bool m_warmup_enabled = false;
154 bool m_cooldown_enabled = false;
157
158 //std::vector<Network *> m_networks;
162
163 std::unordered_map<MachineID, unsigned> machineToNetwork;
164 std::unordered_map<RequestorID, unsigned> requestorToNetwork;
165 std::unordered_map<unsigned, std::vector<AbstractController*>> netCntrls;
166
167 std::unique_ptr<ProtocolInfo> protocolInfo;
168
169 public:
173 std::map<MachineType, uint32_t> m_num_controllers;
174
175 // These are auto-generated by SLICC based on the built protocol.
176 int MachineType_base_count(const MachineType& obj);
177 int MachineType_base_number(const MachineType& obj);
178};
179
180} // namespace ruby
181} // namespace gem5
182
183#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:69
void enqueueRubyEvent(Tick tick)
bool functionalWrite(Packet *ptr)
RubySystem & operator=(const RubySystem &obj)
uint32_t getBlockSizeBits()
Definition RubySystem.hh:74
void unserialize(CheckpointIn &cp) override
Unserialize an object.
const bool m_access_backing_store
uint32_t getMemorySizeBits()
Definition RubySystem.hh:75
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
std::vector< std::map< uint32_t, AbstractController * > > m_abstract_controls
void registerMachineID(const MachineID &mach_id, Network *network)
std::unique_ptr< ProtocolInfo > protocolInfo
std::unordered_map< RequestorID, unsigned > requestorToNetwork
static void writeCompressedTrace(uint8_t *raw_data, std::string file, uint64_t uncompressed_trace_size)
void registerNetwork(Network *)
Definition RubySystem.cc:94
void startup() override
startup() is the final initialization call before simulation.
std::unordered_map< MachineID, unsigned > machineToNetwork
uint32_t getBlockSizeBytes()
Definition RubySystem.hh:73
memory::SimpleMemory * getPhysMem()
Definition RubySystem.hh:79
static void readCompressedTrace(std::string filename, uint8_t *&raw_data, uint64_t &uncompressed_trace_size)
bool simpleFunctionalRead(PacketPtr pkt)
CacheRecorder * m_cache_recorder
std::vector< std::unique_ptr< Network > > m_networks
void drainResume() override
Resume execution after a successful drain.
std::vector< AbstractController * > m_abs_cntrl_vec
void resetStats() override
Callback to reset stats.
bool partialFunctionalRead(PacketPtr pkt)
const ProtocolInfo & getProtocolInfo()
memory::SimpleMemory * m_phys_mem
std::unordered_map< unsigned, std::vector< AbstractController * > > netCntrls
Profiler * getProfiler()
Definition RubySystem.hh:85
void regStats() override
Callback to set stat parameters.
Definition RubySystem.hh:91
int MachineType_base_number(const MachineType &obj)
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.
int MachineType_base_count(const MachineType &obj)
void registerAbstractController(AbstractController *, std::unique_ptr< ProtocolInfo >)
RubySystem(const RubySystem &obj)
std::map< MachineType, uint32_t > m_num_controllers
void memWriteback() override
Write back dirty buffers to memory using functional writes.
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 Arm Limited 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 Mon Jan 13 2025 04:28:41 for gem5 by doxygen 1.9.8