gem5  v21.1.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
50 namespace gem5
51 {
52 
53 namespace ruby
54 {
55 
56 class FaultModel;
57 
58 namespace garnet
59 {
60 
61 class NetworkLink;
62 class CreditLink;
63 class InputUnit;
64 class OutputUnit;
65 
66 class 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 
93  void init_net_ptr(GarnetNetwork* net_ptr)
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 
107  OutputUnit*
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 
116  PortDirection getOutportDirection(int outport);
117  PortDirection getInportDirection(int inport);
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  }
136  bool get_aggregate_fault_probability(int temperature,
137  float *aggregate_fault_prob) {
138  return m_network_ptr->fault_model->fault_prob(m_id, temperature,
139  aggregate_fault_prob);
140  }
141 
142  uint32_t functionalWrite(Packet *);
143 
144  private:
147  uint32_t m_bit_width;
149 
153 
156 
157  // Statistical variables required for power computations
160 
163 
165 };
166 
167 } // namespace garnet
168 } // namespace ruby
169 } // namespace gem5
170 
171 #endif // __MEM_RUBY_NETWORK_GARNET_0_ROUTER_HH__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1918
gem5::ruby::garnet::Router::crossbarSwitch
CrossbarSwitch crossbarSwitch
Definition: Router.hh:152
gem5::ruby::garnet::Router::m_network_ptr
GarnetNetwork * m_network_ptr
Definition: Router.hh:148
gem5::ruby::garnet::Router::getInputUnit
InputUnit * getInputUnit(unsigned port)
Definition: Router.hh:101
gem5::ruby::garnet::flit
Definition: flit.hh:50
gem5::ruby::garnet::OutputUnit
Definition: OutputUnit.hh:56
gem5::ruby::garnet::Router::addOutPort
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
gem5::ruby::garnet::Router::get_net_ptr
GarnetNetwork * get_net_ptr()
Definition: Router.hh:98
gem5::ruby::garnet::Router::get_fault_vector
bool get_fault_vector(int temperature, float fault_vector[])
Definition: Router.hh:132
gem5::ruby::garnet::Router::~Router
~Router()=default
gem5::ruby::garnet::Router::m_num_vcs
uint32_t m_num_vcs
Definition: Router.hh:146
gem5::ruby::garnet::GarnetNetwork::fault_model
FaultModel * fault_model
Definition: GarnetNetwork.hh:84
gem5::ruby::garnet::Router::addInPort
void addInPort(PortDirection inport_dirn, NetworkLink *link, CreditLink *credit_link)
Definition: Router.cc:100
gem5::ruby::PortDirection
std::string PortDirection
Definition: Topology.hh:68
gem5::ruby::garnet::Router::get_aggregate_fault_probability
bool get_aggregate_fault_probability(int temperature, float *aggregate_fault_prob)
Definition: Router.hh:136
gem5::ruby::FaultModel::fault_vector
bool fault_vector(int routerID, int temperature, float fault_vector[])
Definition: FaultModel.cc:177
gem5::ruby::garnet::Router::getBitWidth
int getBitWidth()
Definition: Router.hh:114
gem5::ruby::BasicRouter
Definition: BasicRouter.hh:45
gem5::ruby::garnet::Router::m_crossbar_activity
statistics::Scalar m_crossbar_activity
Definition: Router.hh:164
gem5::ruby::garnet::Router::print
void print(std::ostream &out) const
Definition: Router.hh:75
gem5::ruby::garnet::Router::m_sw_input_arbiter_activity
statistics::Scalar m_sw_input_arbiter_activity
Definition: Router.hh:161
gem5::ruby::garnet::Router::wakeup
void wakeup()
Definition: Router.cc:72
gem5::ruby::garnet::Router
Definition: Router.hh:66
gem5::ruby::garnet::RouteInfo
Definition: CommonTypes.hh:56
gem5::ruby::BasicRouter::m_id
uint32_t m_id
Definition: BasicRouter.hh:58
gem5::ruby::garnet::Router::resetStats
void resetStats()
Callback to reset stats.
Definition: Router.cc:238
gem5::ruby::garnet::Router::get_num_outports
int get_num_outports()
Definition: Router.hh:90
std::vector
STL vector class.
Definition: stl.hh:37
GarnetNetwork.hh
gem5::ruby::Consumer
Definition: Consumer.hh:61
gem5::ruby::garnet::Router::get_num_vnets
uint32_t get_num_vnets()
Definition: Router.hh:87
gem5::ruby::garnet::SwitchAllocator
Definition: SwitchAllocator.hh:54
CommonTypes.hh
gem5::ruby::garnet::Router::m_virtual_networks
uint32_t m_virtual_networks
Definition: Router.hh:146
gem5::ruby::garnet::Router::get_num_vcs
uint32_t get_num_vcs()
Definition: Router.hh:86
gem5::ruby::garnet::Router::m_buffer_writes
statistics::Scalar m_buffer_writes
Definition: Router.hh:159
gem5::ruby::garnet::CrossbarSwitch
Definition: CrossbarSwitch.hh:53
gem5::ruby::garnet::Router::route_compute
int route_compute(RouteInfo route, int inport, PortDirection direction)
Definition: Router.cc:162
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::ruby::FaultModel::fault_prob
bool fault_prob(int routerID, int temperature, float *aggregate_fault_prob)
Definition: FaultModel.cc:212
gem5::ruby::garnet::Router::init_net_ptr
void init_net_ptr(GarnetNetwork *net_ptr)
Definition: Router.hh:93
gem5::ruby::garnet::Router::m_latency
Cycles m_latency
Definition: Router.hh:145
gem5::ruby::garnet::Router::m_buffer_reads
statistics::Scalar m_buffer_reads
Definition: Router.hh:158
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::ruby::garnet::Router::regStats
void regStats()
Callback to set stat parameters.
Definition: Router.cc:191
gem5::ruby::garnet::Router::m_vc_per_vnet
uint32_t m_vc_per_vnet
Definition: Router.hh:146
gem5::ruby::garnet::Router::m_sw_output_arbiter_activity
statistics::Scalar m_sw_output_arbiter_activity
Definition: Router.hh:162
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::ruby::garnet::Router::getOutportDirection
PortDirection getOutportDirection(int outport)
Definition: Router.cc:150
CrossbarSwitch.hh
gem5::ruby::garnet::Router::grant_switch
void grant_switch(int inport, flit *t_flit)
Definition: Router.cc:168
gem5::ruby::garnet::Router::printFaultVector
void printFaultVector(std::ostream &out)
Definition: Router.cc:249
gem5::ruby::garnet::InputUnit
Definition: InputUnit.hh:55
flit.hh
SwitchAllocator.hh
gem5::ruby::garnet::Router::collateStats
void collateStats()
Definition: Router.cc:222
gem5::ruby::garnet::Router::Params
GarnetRouterParams Params
Definition: Router.hh:69
gem5::ruby::garnet::GarnetNetwork
Definition: GarnetNetwork.hh:60
gem5::ruby::garnet::Router::getInportDirection
PortDirection getInportDirection(int inport)
Definition: Router.cc:156
Consumer.hh
gem5::ruby::garnet::Router::init
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: Router.cc:63
gem5::ruby::garnet::Router::get_num_inports
int get_num_inports()
Definition: Router.hh:89
BasicRouter.hh
gem5::ruby::garnet::Router::get_vc_per_vnet
uint32_t get_vc_per_vnet()
Definition: Router.hh:88
gem5::ruby::garnet::Router::m_output_unit
std::vector< std::shared_ptr< OutputUnit > > m_output_unit
Definition: Router.hh:155
gem5::ruby::garnet::Router::m_input_unit
std::vector< std::shared_ptr< InputUnit > > m_input_unit
Definition: Router.hh:154
gem5::ruby::garnet::Router::routingUnit
RoutingUnit routingUnit
Definition: Router.hh:150
gem5::ruby::garnet::RoutingUnit
Definition: RoutingUnit.hh:52
gem5::ruby::garnet::Router::getPortDirectionName
std::string getPortDirectionName(PortDirection direction)
Definition: Router.cc:181
gem5::ruby::garnet::Router::schedule_wakeup
void schedule_wakeup(Cycles time)
Definition: Router.cc:174
gem5::ruby::garnet::Router::m_bit_width
uint32_t m_bit_width
Definition: Router.hh:147
gem5::ruby::garnet::Router::printAggregateFaultProbability
void printAggregateFaultProbability(std::ostream &out)
Definition: Router.cc:267
gem5::ruby::garnet::Router::get_id
int get_id()
Definition: Router.hh:91
gem5::ruby::garnet::Router::getOutputUnit
OutputUnit * getOutputUnit(unsigned port)
Definition: Router.hh:108
gem5::ruby::garnet::Router::Router
Router(const Params &p)
Definition: Router.cc:51
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ruby::garnet::Router::functionalWrite
uint32_t functionalWrite(Packet *)
Definition: Router.cc:278
gem5::ruby::garnet::Router::get_pipe_stages
Cycles get_pipe_stages()
Definition: Router.hh:85
NetDest.hh
RoutingUnit.hh
gem5::ruby::garnet::Router::switchAllocator
SwitchAllocator switchAllocator
Definition: Router.hh:151

Generated on Wed Jul 28 2021 12:10:28 for gem5 by doxygen 1.8.17