gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Router.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 Princeton University
3  * Copyright (c) 2016 Georgia Institute of Technology
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Authors: Niket Agarwal
30  * Tushar Krishna
31  */
32 
33 
34 #ifndef __MEM_RUBY_NETWORK_GARNET_ROUTER_HH__
35 #define __MEM_RUBY_NETWORK_GARNET_ROUTER_HH__
36 
37 #include <iostream>
38 #include <vector>
39 
46 #include "params/GarnetRouter.hh"
47 
48 class NetworkLink;
49 class CreditLink;
50 class InputUnit;
51 class OutputUnit;
52 class RoutingUnit;
53 class SwitchAllocator;
54 class CrossbarSwitch;
55 class FaultModel;
56 
57 class Router : public BasicRouter, public Consumer
58 {
59  public:
60  typedef GarnetRouterParams Params;
61  Router(const Params *p);
62 
63  ~Router();
64 
65  void wakeup();
66  void print(std::ostream& out) const {};
67 
68  void init();
69  void addInPort(PortDirection inport_dirn, NetworkLink *link,
70  CreditLink *credit_link);
71  void addOutPort(PortDirection outport_dirn, NetworkLink *link,
72  const NetDest& routing_table_entry,
73  int link_weight, CreditLink *credit_link);
74 
76  int get_num_vcs() { return m_num_vcs; }
78  int 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 
93 
94  int route_compute(RouteInfo route, int inport, PortDirection direction);
95  void grant_switch(int inport, flit *t_flit);
96  void schedule_wakeup(Cycles time);
97 
98  std::string getPortDirectionName(PortDirection direction);
99  void printFaultVector(std::ostream& out);
100  void printAggregateFaultProbability(std::ostream& out);
101 
102  void regStats();
103  void collateStats();
104  void resetStats();
105 
106  // For Fault Model:
107  bool get_fault_vector(int temperature, float fault_vector[]) {
108  return m_network_ptr->fault_model->fault_vector(m_id, temperature,
109  fault_vector);
110  }
111  bool get_aggregate_fault_probability(int temperature,
112  float *aggregate_fault_prob) {
113  return m_network_ptr->fault_model->fault_prob(m_id, temperature,
114  aggregate_fault_prob);
115  }
116 
117  uint32_t functionalWrite(Packet *);
118 
119  private:
123 
129 
130  // Statistical variables required for power computations
133 
136 
138 };
139 
140 #endif // __MEM_RUBY_NETWORK_GARNET_ROUTER_HH__
Stats::Scalar m_buffer_reads
Definition: Router.hh:131
BasicRouterParams Params
Definition: BasicRouter.hh:42
GarnetNetwork * m_network_ptr
Definition: Router.hh:122
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
RoutingUnit * m_routing_unit
Definition: Router.hh:126
uint32_t m_id
Definition: BasicRouter.hh:53
PortDirection getOutportDirection(int outport)
Definition: Router.cc:150
void init_net_ptr(GarnetNetwork *net_ptr)
Definition: Router.hh:83
int m_vc_per_vnet
Definition: Router.hh:121
std::vector< OutputUnit * > m_output_unit
Definition: Router.hh:125
int m_num_vcs
Definition: Router.hh:121
void grant_switch(int inport, flit *t_flit)
Definition: Router.cc:168
int route_compute(RouteInfo route, int inport, PortDirection direction)
Definition: Router.cc:162
Cycles m_latency
Definition: Router.hh:120
GarnetRouterParams Params
Definition: Router.hh:60
void resetStats()
Reset statistics associated with this object.
Definition: Router.cc:237
Stats::Scalar m_buffer_writes
Definition: Router.hh:132
bool get_aggregate_fault_probability(int temperature, float *aggregate_fault_prob)
Definition: Router.hh:111
std::string getPortDirectionName(PortDirection direction)
Definition: Router.cc:181
Stats::Scalar m_sw_output_arbiter_activity
Definition: Router.hh:135
~Router()
Definition: Router.cc:66
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2475
Stats::Scalar m_sw_input_arbiter_activity
Definition: Router.hh:134
void print(std::ostream &out) const
Definition: Router.hh:66
int get_id()
Definition: Router.hh:81
uint32_t functionalWrite(Packet *)
Definition: Router.cc:276
void collateStats()
Definition: Router.cc:222
void schedule_wakeup(Cycles time)
Definition: Router.cc:174
Definition: flit.hh:44
FaultModel * fault_model
void addInPort(PortDirection inport_dirn, NetworkLink *link, CreditLink *credit_link)
Definition: Router.cc:112
int get_num_outports()
Definition: Router.hh:80
SwitchAllocator * m_sw_alloc
Definition: Router.hh:127
Stats::Scalar m_crossbar_activity
Definition: Router.hh:137
bool fault_prob(int routerID, int temperature, float *aggregate_fault_prob)
Definition: FaultModel.cc:211
std::string PortDirection
Definition: Topology.hh:55
GarnetNetwork * get_net_ptr()
Definition: Router.hh:88
Router(const Params *p)
Definition: Router.cc:50
int m_virtual_networks
Definition: Router.hh:121
int get_vc_per_vnet()
Definition: Router.hh:78
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
int get_num_vnets()
Definition: Router.hh:77
Definition: Router.hh:57
void printFaultVector(std::ostream &out)
Definition: Router.cc:247
std::vector< InputUnit * > m_input_unit
Definition: Router.hh:124
bool get_fault_vector(int temperature, float fault_vector[])
Definition: Router.hh:107
void addOutPort(PortDirection outport_dirn, NetworkLink *link, const NetDest &routing_table_entry, int link_weight, CreditLink *credit_link)
Definition: Router.cc:129
int get_num_vcs()
Definition: Router.hh:76
int get_num_inports()
Definition: Router.hh:79
void printAggregateFaultProbability(std::ostream &out)
Definition: Router.cc:265
Cycles get_pipe_stages()
Definition: Router.hh:75
std::vector< InputUnit * > & get_inputUnit_ref()
Definition: Router.hh:89
bool fault_vector(int routerID, int temperature, float fault_vector[])
Definition: FaultModel.cc:176
std::vector< OutputUnit * > & get_outputUnit_ref()
Definition: Router.hh:90
Bitfield< 0 > p
void wakeup()
Definition: Router.cc:85
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: Router.cc:76
void regStats()
Register statistics for this object.
Definition: Router.cc:191
CrossbarSwitch * m_switch
Definition: Router.hh:128
PortDirection getInportDirection(int inport)
Definition: Router.cc:156

Generated on Fri Jun 9 2017 13:03:49 for gem5 by doxygen 1.8.6