gem5 v24.0.0.0
Loading...
Searching...
No Matches
Router.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Inria
3 * Copyright (c) 2016 Georgia Institute of Technology
4 * Copyright (c) 2008 Princeton University
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met: redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer;
11 * redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution;
14 * neither the name of the copyright holders nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31
32#ifndef __MEM_RUBY_NETWORK_GARNET_0_ROUTER_HH__
33#define __MEM_RUBY_NETWORK_GARNET_0_ROUTER_HH__
34
35#include <iostream>
36#include <memory>
37#include <vector>
38
48#include "params/GarnetRouter.hh"
49
50namespace gem5
51{
52
53namespace ruby
54{
55
56class FaultModel;
57
58namespace garnet
59{
60
61class NetworkLink;
62class CreditLink;
63class InputUnit;
64class OutputUnit;
65
66class Router : public BasicRouter, public Consumer
67{
68 public:
69 typedef GarnetRouterParams Params;
70 Router(const Params &p);
71
72 ~Router() = default;
73
74 void wakeup();
75 void print(std::ostream& out) const {};
76
77 void init();
78 void addInPort(PortDirection inport_dirn, NetworkLink *link,
79 CreditLink *credit_link);
80 void addOutPort(PortDirection outport_dirn, NetworkLink *link,
81 std::vector<NetDest>& routing_table_entry,
82 int link_weight, CreditLink *credit_link,
83 uint32_t consumerVcs);
84
86 uint32_t get_num_vcs() { return m_num_vcs; }
87 uint32_t get_num_vnets() { return m_virtual_networks; }
88 uint32_t get_vc_per_vnet() { return m_vc_per_vnet; }
89 int get_num_inports() { return m_input_unit.size(); }
90 int get_num_outports() { return m_output_unit.size(); }
91 int get_id() { return m_id; }
92
94 {
95 m_network_ptr = net_ptr;
96 }
97
99
100 InputUnit*
101 getInputUnit(unsigned port)
102 {
103 assert(port < m_input_unit.size());
104 return m_input_unit[port].get();
105 }
106
108 getOutputUnit(unsigned port)
109 {
110 assert(port < m_output_unit.size());
111 return m_output_unit[port].get();
112 }
113
114 int getBitWidth() { return m_bit_width; }
115
118
119 int route_compute(RouteInfo route, int inport, PortDirection direction);
120 void grant_switch(int inport, flit *t_flit);
121 void schedule_wakeup(Cycles time);
122
123 std::string getPortDirectionName(PortDirection direction);
124 void printFaultVector(std::ostream& out);
125 void printAggregateFaultProbability(std::ostream& out);
126
127 void regStats();
128 void collateStats();
129 void resetStats();
130
131 // For Fault Model:
132 bool get_fault_vector(int temperature, float fault_vector[]) {
133 return m_network_ptr->fault_model->fault_vector(m_id, temperature,
134 fault_vector);
135 }
137 float *aggregate_fault_prob) {
138 return m_network_ptr->fault_model->fault_prob(m_id, temperature,
139 aggregate_fault_prob);
140 }
141
142 bool functionalRead(Packet *pkt, WriteMask &mask);
143 uint32_t functionalWrite(Packet *);
144
145 private:
148 uint32_t m_bit_width;
150
154
157
158 // Statistical variables required for power computations
161
164
166};
167
168} // namespace garnet
169} // namespace ruby
170} // namespace gem5
171
172#endif // __MEM_RUBY_NETWORK_GARNET_0_ROUTER_HH__
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
bool fault_prob(int routerID, int temperature, float *aggregate_fault_prob)
bool fault_vector(int routerID, int temperature, float fault_vector[])
bool get_fault_vector(int temperature, float fault_vector[])
Definition Router.hh:132
PortDirection getOutportDirection(int outport)
Definition Router.cc:150
void addInPort(PortDirection inport_dirn, NetworkLink *link, CreditLink *credit_link)
Definition Router.cc:100
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition Router.cc:63
OutputUnit * getOutputUnit(unsigned port)
Definition Router.hh:108
uint32_t functionalWrite(Packet *)
Definition Router.cc:298
statistics::Scalar m_buffer_reads
Definition Router.hh:159
bool get_aggregate_fault_probability(int temperature, float *aggregate_fault_prob)
Definition Router.hh:136
statistics::Scalar m_buffer_writes
Definition Router.hh:160
GarnetNetwork * m_network_ptr
Definition Router.hh:149
void printFaultVector(std::ostream &out)
Definition Router.cc:249
PortDirection getInportDirection(int inport)
Definition Router.cc:156
Router(const Params &p)
Definition Router.cc:51
std::vector< std::shared_ptr< InputUnit > > m_input_unit
Definition Router.hh:155
GarnetRouterParams Params
Definition Router.hh:69
statistics::Scalar m_sw_input_arbiter_activity
Definition Router.hh:162
SwitchAllocator switchAllocator
Definition Router.hh:152
bool functionalRead(Packet *pkt, WriteMask &mask)
Definition Router.cc:278
GarnetNetwork * get_net_ptr()
Definition Router.hh:98
void printAggregateFaultProbability(std::ostream &out)
Definition Router.cc:267
void resetStats()
Callback to reset stats.
Definition Router.cc:238
void init_net_ptr(GarnetNetwork *net_ptr)
Definition Router.hh:93
std::string getPortDirectionName(PortDirection direction)
Definition Router.cc:181
void grant_switch(int inport, flit *t_flit)
Definition Router.cc:168
void print(std::ostream &out) const
Definition Router.hh:75
statistics::Scalar m_crossbar_activity
Definition Router.hh:165
statistics::Scalar m_sw_output_arbiter_activity
Definition Router.hh:163
int route_compute(RouteInfo route, int inport, PortDirection direction)
Definition Router.cc:162
void addOutPort(PortDirection outport_dirn, NetworkLink *link, std::vector< NetDest > &routing_table_entry, int link_weight, CreditLink *credit_link, uint32_t consumerVcs)
Definition Router.cc:123
void schedule_wakeup(Cycles time)
Definition Router.cc:174
void regStats()
Callback to set stat parameters.
Definition Router.cc:191
uint32_t get_vc_per_vnet()
Definition Router.hh:88
InputUnit * getInputUnit(unsigned port)
Definition Router.hh:101
CrossbarSwitch crossbarSwitch
Definition Router.hh:153
std::vector< std::shared_ptr< OutputUnit > > m_output_unit
Definition Router.hh:156
This is a simple scalar statistic, like a counter.
STL vector class.
Definition stl.hh:37
Bitfield< 3, 0 > mask
Definition pcstate.hh:63
Bitfield< 0 > p
std::string PortDirection
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36

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