gem5  v20.1.0.0
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 class NetworkLink;
51 class CreditLink;
52 class InputUnit;
53 class OutputUnit;
54 class FaultModel;
55 
56 class Router : public BasicRouter, public Consumer
57 {
58  public:
59  typedef GarnetRouterParams Params;
60  Router(const Params *p);
61 
62  ~Router() = default;
63 
64  void wakeup();
65  void print(std::ostream& out) const {};
66 
67  void init();
68  void addInPort(PortDirection inport_dirn, NetworkLink *link,
69  CreditLink *credit_link);
70  void addOutPort(PortDirection outport_dirn, NetworkLink *link,
71  std::vector<NetDest>& routing_table_entry,
72  int link_weight, CreditLink *credit_link,
73  uint32_t consumerVcs);
74 
76  uint32_t get_num_vcs() { return m_num_vcs; }
77  uint32_t get_num_vnets() { return m_virtual_networks; }
78  uint32_t get_vc_per_vnet() { return m_vc_per_vnet; }
79  int get_num_inports() { return m_input_unit.size(); }
80  int get_num_outports() { return m_output_unit.size(); }
81  int get_id() { return m_id; }
82 
83  void init_net_ptr(GarnetNetwork* net_ptr)
84  {
85  m_network_ptr = net_ptr;
86  }
87 
89 
90  InputUnit*
91  getInputUnit(unsigned port)
92  {
93  assert(port < m_input_unit.size());
94  return m_input_unit[port].get();
95  }
96 
97  OutputUnit*
98  getOutputUnit(unsigned port)
99  {
100  assert(port < m_output_unit.size());
101  return m_output_unit[port].get();
102  }
103 
104  int getBitWidth() { return m_bit_width; }
105 
106  PortDirection getOutportDirection(int outport);
107  PortDirection getInportDirection(int inport);
108 
109  int route_compute(RouteInfo route, int inport, PortDirection direction);
110  void grant_switch(int inport, flit *t_flit);
111  void schedule_wakeup(Cycles time);
112 
113  std::string getPortDirectionName(PortDirection direction);
114  void printFaultVector(std::ostream& out);
115  void printAggregateFaultProbability(std::ostream& out);
116 
117  void regStats();
118  void collateStats();
119  void resetStats();
120 
121  // For Fault Model:
122  bool get_fault_vector(int temperature, float fault_vector[]) {
123  return m_network_ptr->fault_model->fault_vector(m_id, temperature,
124  fault_vector);
125  }
126  bool get_aggregate_fault_probability(int temperature,
127  float *aggregate_fault_prob) {
128  return m_network_ptr->fault_model->fault_prob(m_id, temperature,
129  aggregate_fault_prob);
130  }
131 
132  uint32_t functionalWrite(Packet *);
133 
134  private:
137  uint32_t m_bit_width;
139 
143 
146 
147  // Statistical variables required for power computations
150 
153 
155 };
156 
157 #endif // __MEM_RUBY_NETWORK_GARNET_0_ROUTER_HH__
Router::getInputUnit
InputUnit * getInputUnit(unsigned port)
Definition: Router.hh:91
Router::m_virtual_networks
uint32_t m_virtual_networks
Definition: Router.hh:136
Router::m_sw_input_arbiter_activity
Stats::Scalar m_sw_input_arbiter_activity
Definition: Router.hh:151
Router::get_id
int get_id()
Definition: Router.hh:81
Router::wakeup
void wakeup()
Definition: Router.cc:65
Router::~Router
~Router()=default
FaultModel
Definition: FaultModel.hh:53
flit
Definition: flit.hh:41
Router::getOutputUnit
OutputUnit * getOutputUnit(unsigned port)
Definition: Router.hh:98
RouteInfo
Definition: CommonTypes.hh:47
Router::m_buffer_reads
Stats::Scalar m_buffer_reads
Definition: Router.hh:148
Router::printAggregateFaultProbability
void printAggregateFaultProbability(std::ostream &out)
Definition: Router.cc:260
Router::m_bit_width
uint32_t m_bit_width
Definition: Router.hh:137
Router::get_num_vnets
uint32_t get_num_vnets()
Definition: Router.hh:77
BasicRouter::m_id
uint32_t m_id
Definition: BasicRouter.hh:53
FaultModel::fault_vector
bool fault_vector(int routerID, int temperature, float fault_vector[])
Definition: FaultModel.cc:174
Router::m_crossbar_activity
Stats::Scalar m_crossbar_activity
Definition: Router.hh:154
std::vector< NetDest >
Router::get_vc_per_vnet
uint32_t get_vc_per_vnet()
Definition: Router.hh:78
GarnetNetwork.hh
Router::switchAllocator
SwitchAllocator switchAllocator
Definition: Router.hh:141
CommonTypes.hh
Router::crossbarSwitch
CrossbarSwitch crossbarSwitch
Definition: Router.hh:142
CrossbarSwitch
Definition: CrossbarSwitch.hh:44
Router::get_num_vcs
uint32_t get_num_vcs()
Definition: Router.hh:76
Router::Router
Router(const Params *p)
Definition: Router.cc:44
Router::printFaultVector
void printFaultVector(std::ostream &out)
Definition: Router.cc:242
Router::schedule_wakeup
void schedule_wakeup(Cycles time)
Definition: Router.cc:167
Router::addInPort
void addInPort(PortDirection inport_dirn, NetworkLink *link, CreditLink *credit_link)
Definition: Router.cc:93
Stats::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2533
Router::routingUnit
RoutingUnit routingUnit
Definition: Router.hh:140
BasicRouter::Params
BasicRouterParams Params
Definition: BasicRouter.hh:42
Router
Definition: Router.hh:56
Router::get_pipe_stages
Cycles get_pipe_stages()
Definition: Router.hh:75
Router::getBitWidth
int getBitWidth()
Definition: Router.hh:104
CrossbarSwitch.hh
Consumer
Definition: Consumer.hh:43
Router::grant_switch
void grant_switch(int inport, flit *t_flit)
Definition: Router.cc:161
BasicRouter
Definition: BasicRouter.hh:39
Router::route_compute
int route_compute(RouteInfo route, int inport, PortDirection direction)
Definition: Router.cc:155
Router::collateStats
void collateStats()
Definition: Router.cc:215
Router::get_num_outports
int get_num_outports()
Definition: Router.hh:80
flit.hh
Router::m_vc_per_vnet
uint32_t m_vc_per_vnet
Definition: Router.hh:136
SwitchAllocator.hh
RoutingUnit
Definition: RoutingUnit.hh:43
Router::getPortDirectionName
std::string getPortDirectionName(PortDirection direction)
Definition: Router.cc:174
Router::m_network_ptr
GarnetNetwork * m_network_ptr
Definition: Router.hh:138
Router::get_aggregate_fault_probability
bool get_aggregate_fault_probability(int temperature, float *aggregate_fault_prob)
Definition: Router.hh:126
Router::get_num_inports
int get_num_inports()
Definition: Router.hh:79
Router::Params
GarnetRouterParams Params
Definition: Router.hh:59
Router::resetStats
void resetStats()
Callback to reset stats.
Definition: Router.cc:231
Router::init
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: Router.cc:56
Consumer.hh
Router::functionalWrite
uint32_t functionalWrite(Packet *)
Definition: Router.cc:271
Router::getOutportDirection
PortDirection getOutportDirection(int outport)
Definition: Router.cc:143
OutputUnit
Definition: OutputUnit.hh:47
Router::get_fault_vector
bool get_fault_vector(int temperature, float fault_vector[])
Definition: Router.hh:122
BasicRouter.hh
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
SwitchAllocator
Definition: SwitchAllocator.hh:45
Router::print
void print(std::ostream &out) const
Definition: Router.hh:65
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
PortDirection
std::string PortDirection
Definition: Topology.hh:62
GarnetNetwork
Definition: GarnetNetwork.hh:50
Router::m_buffer_writes
Stats::Scalar m_buffer_writes
Definition: Router.hh:149
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:116
FaultModel::fault_prob
bool fault_prob(int routerID, int temperature, float *aggregate_fault_prob)
Definition: FaultModel.cc:209
Router::init_net_ptr
void init_net_ptr(GarnetNetwork *net_ptr)
Definition: Router.hh:83
Router::m_latency
Cycles m_latency
Definition: Router.hh:135
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
Router::regStats
void regStats()
Callback to set stat parameters.
Definition: Router.cc:184
Router::m_num_vcs
uint32_t m_num_vcs
Definition: Router.hh:136
Router::get_net_ptr
GarnetNetwork * get_net_ptr()
Definition: Router.hh:88
Router::getInportDirection
PortDirection getInportDirection(int inport)
Definition: Router.cc:149
Router::m_sw_output_arbiter_activity
Stats::Scalar m_sw_output_arbiter_activity
Definition: Router.hh:152
Router::m_input_unit
std::vector< std::shared_ptr< InputUnit > > m_input_unit
Definition: Router.hh:144
InputUnit
Definition: InputUnit.hh:46
NetDest.hh
RoutingUnit.hh
GarnetNetwork::fault_model
FaultModel * fault_model
Definition: GarnetNetwork.hh:74
Router::m_output_unit
std::vector< std::shared_ptr< OutputUnit > > m_output_unit
Definition: Router.hh:145

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