|
1 | 1 | #ifndef VTR_NORTH_LAST_ROUTING_H |
2 | 2 | #define VTR_NORTH_LAST_ROUTING_H |
3 | 3 |
|
| 4 | +/** |
| 5 | + * @file |
| 6 | + * @brief This file declares the NorthLastRouting class, which implements |
| 7 | + * the north-last routing algorithm. |
| 8 | + * |
| 9 | + * Overview |
| 10 | + * ======== |
| 11 | + * The NorthLastRouting class performs packet routing between routers in the |
| 12 | + * NoC using north-last routing algorithm. In this algorithm, once the north |
| 13 | + * direction is taken, no other direction can be taken. In other words, |
| 14 | + * a traffic flow is no longer allowed to turn when it started moving |
| 15 | + * towards the north. North-last algorithm generated deadlock free routes |
| 16 | + * in a mesh or torus topology. |
| 17 | + */ |
| 18 | + |
4 | 19 | #include "turn_model_routing.h" |
5 | 20 |
|
6 | 21 | class NorthLastRouting : public TurnModelRouting { |
7 | 22 | public: |
8 | 23 | ~NorthLastRouting() override; |
9 | 24 |
|
10 | 25 | private: |
| 26 | + /** |
| 27 | + * @brief Returns legal directions that the traffic flow can follow to |
| 28 | + * generate a minimal route using north-last algorithm. |
| 29 | + * |
| 30 | + * @param src_router_id A unique ID identifying the source NoC router. |
| 31 | + * @param curr_router_id A unique ID identifying the current NoC router. |
| 32 | + * @param dst_router_id A unique ID identifying the destination NoC router. |
| 33 | + * @param noc_model A model of the NoC. This is used to determine the position |
| 34 | + * of NoC routers. |
| 35 | + * |
| 36 | + * @return std::vector<TurnModelRouting::Direction> All legal directions that the |
| 37 | + * a traffic flow can follow based on north-last algorithm |
| 38 | + */ |
11 | 39 | const std::vector<TurnModelRouting::Direction>& get_legal_directions(NocRouterId src_router_id, |
12 | 40 | NocRouterId curr_router_id, |
13 | 41 | NocRouterId dst_router_id, |
14 | 42 | const NocStorage& noc_model) override; |
15 | 43 |
|
| 44 | + /** |
| 45 | + * @brief Selects a direction from legal directions. The traffic flow |
| 46 | + * travels in that direction. When there are both horizontal and |
| 47 | + * vertical directions available, this method selects one of the available |
| 48 | + * directions randomly. The chance of horizontal and vertical directions |
| 49 | + * are weighted by the horizontal and vertical distance between the |
| 50 | + * current NoC router and the destination router. |
| 51 | + * |
| 52 | + * @param legal_directions Legal directions that the traffic flow can follow. |
| 53 | + * Legal directions are usually a subset of all possible directions to ensure |
| 54 | + * deadlock freedom. |
| 55 | + * @param src_router_id A unique ID identifying the source NoC router. |
| 56 | + * @param dst_router_id A unique ID identifying the destination NoC router. |
| 57 | + * @param curr_router_id A unique ID identifying the current NoC router. |
| 58 | + * @param noc_model A model of the NoC. This might be used by the derived class |
| 59 | + * to determine the position of NoC routers. |
| 60 | + * |
| 61 | + * @return Direction The direction to travel next |
| 62 | + */ |
16 | 63 | TurnModelRouting::Direction select_next_direction(const std::vector<TurnModelRouting::Direction>& legal_directions, |
17 | 64 | NocRouterId src_router_id, |
18 | 65 | NocRouterId dst_router_id, |
|
0 commit comments