gem5  v22.1.0.0
RoutingUnit.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 
30 
31 #ifndef __MEM_RUBY_NETWORK_GARNET_0_ROUTINGUNIT_HH__
32 #define __MEM_RUBY_NETWORK_GARNET_0_ROUTINGUNIT_HH__
33 
39 
40 namespace gem5
41 {
42 
43 namespace ruby
44 {
45 
46 namespace garnet
47 {
48 
49 class InputUnit;
50 class Router;
51 
53 {
54  public:
55  RoutingUnit(Router *router);
56  int outportCompute(RouteInfo route,
57  int inport,
58  PortDirection inport_dirn);
59 
60  // Topology-agnostic Routing Table based routing (default)
61  void addRoute(std::vector<NetDest>& routing_table_entry);
62  void addWeight(int link_weight);
63 
64  // get output port from routing table
65  int lookupRoutingTable(int vnet, NetDest net_dest);
66 
67  // Topology-specific direction based routing
68  void addInDirection(PortDirection inport_dirn, int inport);
69  void addOutDirection(PortDirection outport_dirn, int outport);
70 
71  // Routing for Mesh
72  int outportComputeXY(RouteInfo route,
73  int inport,
74  PortDirection inport_dirn);
75 
76  // Custom Routing Algorithm using Port Directions
78  int inport,
79  PortDirection inport_dirn);
80 
81  // Returns true if vnet is present in the vector
82  // of vnets or if the vector supports all vnets.
83  bool supportsVnet(int vnet, std::vector<int> sVnets);
84 
85 
86  private:
88 
89  // Routing Table
92 
93  // Inport and Outport direction to idx maps
94  std::map<PortDirection, int> m_inports_dirn2idx;
95  std::map<int, PortDirection> m_inports_idx2dirn;
96  std::map<int, PortDirection> m_outports_idx2dirn;
97  std::map<PortDirection, int> m_outports_dirn2idx;
98 };
99 
100 } // namespace garnet
101 } // namespace ruby
102 } // namespace gem5
103 
104 #endif // __MEM_RUBY_NETWORK_GARNET_0_ROUTINGUNIT_HH__
void addOutDirection(PortDirection outport_dirn, int outport)
Definition: RoutingUnit.cc:156
int outportComputeCustom(RouteInfo route, int inport, PortDirection inport_dirn)
Definition: RoutingUnit.cc:266
int lookupRoutingTable(int vnet, NetDest net_dest)
Definition: RoutingUnit.cc:97
void addInDirection(PortDirection inport_dirn, int inport)
Definition: RoutingUnit.cc:149
std::vector< int > m_weight_table
Definition: RoutingUnit.hh:91
std::vector< std::vector< NetDest > > m_routing_table
Definition: RoutingUnit.hh:90
std::map< int, PortDirection > m_inports_idx2dirn
Definition: RoutingUnit.hh:95
int outportComputeXY(RouteInfo route, int inport, PortDirection inport_dirn)
Definition: RoutingUnit.cc:208
void addRoute(std::vector< NetDest > &routing_table_entry)
Definition: RoutingUnit.cc:57
std::map< int, PortDirection > m_outports_idx2dirn
Definition: RoutingUnit.hh:96
bool supportsVnet(int vnet, std::vector< int > sVnets)
Definition: RoutingUnit.cc:74
std::map< PortDirection, int > m_outports_dirn2idx
Definition: RoutingUnit.hh:97
void addWeight(int link_weight)
Definition: RoutingUnit.cc:68
std::map< PortDirection, int > m_inports_dirn2idx
Definition: RoutingUnit.hh:94
int outportCompute(RouteInfo route, int inport, PortDirection inport_dirn)
Definition: RoutingUnit.cc:169
STL vector class.
Definition: stl.hh:37
std::string PortDirection
Definition: TypeDefines.hh:44
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....

Generated on Wed Dec 21 2022 10:22:38 for gem5 by doxygen 1.9.1