Skip to content

Commit d4ac787

Browse files
comment turn model algorithm header files
1 parent 93f3443 commit d4ac787

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed

vpr/src/noc/negative_first_routing.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,64 @@
11
#ifndef VTR_NEGATIVE_FIRST_ROUTING_H
22
#define VTR_NEGATIVE_FIRST_ROUTING_H
33

4+
/**
5+
* @file
6+
* @brief This file declares the NegativeFirstRouting class, which implements
7+
* the negative-first routing algorithm.
8+
*
9+
* Overview
10+
* ========
11+
* The NegativeFirstRouting class performs packet routing between routers in the
12+
* NoC using negative-first routing algorithm. In this algorithm, moving towards
13+
* negative directions (west and south) has a higher priority. Once the traffic flow
14+
* moves towards north or east, it is no longer allowed to take a turn that aligns
15+
* the route towards south and west.
16+
*/
17+
418
#include "turn_model_routing.h"
519

620
class NegativeFirstRouting : public TurnModelRouting {
721
public:
822
~NegativeFirstRouting() override;
923

1024
private:
25+
/**
26+
* @brief Returns legal directions that the traffic flow can follow to
27+
* generate a minimal route using negative-first algorithm.
28+
*
29+
* @param src_router_id A unique ID identifying the source NoC router.
30+
* @param curr_router_id A unique ID identifying the current NoC router.
31+
* @param dst_router_id A unique ID identifying the destination NoC router.
32+
* @param noc_model A model of the NoC. This is used to determine the position
33+
* of NoC routers.
34+
*
35+
* @return std::vector<TurnModelRouting::Direction> All legal directions that the
36+
* a traffic flow can follow based on negative_first algorithm
37+
*/
1138
const std::vector<TurnModelRouting::Direction>& get_legal_directions(NocRouterId src_router_id,
1239
NocRouterId curr_router_id,
1340
NocRouterId dst_router_id,
1441
const NocStorage& noc_model) override;
1542

43+
/**
44+
* @brief Selects a direction from legal directions. The traffic flow
45+
* travels in the selected direction. When there are both horizontal and
46+
* vertical directions available, this method selects one of the available
47+
* directions randomly. The chance of horizontal and vertical directions
48+
* are weighted by the horizontal and vertical distance between the
49+
* current NoC router and the destination router.
50+
*
51+
* @param legal_directions Legal directions that the traffic flow can follow.
52+
* Legal directions are usually a subset of all possible directions to ensure
53+
* deadlock freedom.
54+
* @param src_router_id A unique ID identifying the source NoC router.
55+
* @param dst_router_id A unique ID identifying the destination NoC router.
56+
* @param curr_router_id A unique ID identifying the current NoC router.
57+
* @param noc_model A model of the NoC. This might be used by the derived class
58+
* to determine the position of NoC routers.
59+
*
60+
* @return Direction The direction to travel next
61+
*/
1662
TurnModelRouting::Direction select_next_direction(const std::vector<TurnModelRouting::Direction>& legal_directions,
1763
NocRouterId src_router_id,
1864
NocRouterId dst_router_id,

vpr/src/noc/north_last_routing.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,65 @@
11
#ifndef VTR_NORTH_LAST_ROUTING_H
22
#define VTR_NORTH_LAST_ROUTING_H
33

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+
419
#include "turn_model_routing.h"
520

621
class NorthLastRouting : public TurnModelRouting {
722
public:
823
~NorthLastRouting() override;
924

1025
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+
*/
1139
const std::vector<TurnModelRouting::Direction>& get_legal_directions(NocRouterId src_router_id,
1240
NocRouterId curr_router_id,
1341
NocRouterId dst_router_id,
1442
const NocStorage& noc_model) override;
1543

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+
*/
1663
TurnModelRouting::Direction select_next_direction(const std::vector<TurnModelRouting::Direction>& legal_directions,
1764
NocRouterId src_router_id,
1865
NocRouterId dst_router_id,

vpr/src/noc/west_first_routing.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,64 @@
11
#ifndef VTR_WEST_FIRST_ROUTING_H
22
#define VTR_WEST_FIRST_ROUTING_H
33

4+
/**
5+
* @file
6+
* @brief This file declares the WestFirstRouting class, which implements
7+
* the west-first routing algorithm.
8+
*
9+
* Overview
10+
* ========
11+
* The WestFirstRouting class performs packet routing between routers in the
12+
* NoC using west-first routing algorithm. In this algorithm, moving towards
13+
* west has a higher priority than other directions. When the traffic flow
14+
* moves in directions other than west, it is no longer allowed to move
15+
* in towards west.
16+
*/
17+
418
#include "turn_model_routing.h"
519

620
class WestFirstRouting : public TurnModelRouting {
721
public:
822
~WestFirstRouting() override;
923

1024
private:
25+
/**
26+
* @brief Returns legal directions that the traffic flow can follow to
27+
* generate a minimal route using west-first algorithm.
28+
*
29+
* @param src_router_id A unique ID identifying the source NoC router.
30+
* @param curr_router_id A unique ID identifying the current NoC router.
31+
* @param dst_router_id A unique ID identifying the destination NoC router.
32+
* @param noc_model A model of the NoC. This is used to determine the position
33+
* of NoC routers.
34+
*
35+
* @return std::vector<TurnModelRouting::Direction> All legal directions that the
36+
* a traffic flow can follow based on west-first algorithm
37+
*/
1138
const std::vector<TurnModelRouting::Direction>& get_legal_directions(NocRouterId src_router_id,
1239
NocRouterId curr_router_id,
1340
NocRouterId dst_router_id,
1441
const NocStorage& noc_model) override;
1542

43+
/**
44+
* @brief Selects a direction from legal directions. The traffic flow
45+
* travels in that direction. When there are both horizontal and
46+
* vertical directions available, this method selects one of the available
47+
* directions randomly. The chance of horizontal and vertical directions
48+
* are weighted by the horizontal and vertical distance between the
49+
* current NoC router and the destination router.
50+
*
51+
* @param legal_directions Legal directions that the traffic flow can follow.
52+
* Legal directions are usually a subset of all possible directions to ensure
53+
* deadlock freedom.
54+
* @param src_router_id A unique ID identifying the source NoC router.
55+
* @param dst_router_id A unique ID identifying the destination NoC router.
56+
* @param curr_router_id A unique ID identifying the current NoC router.
57+
* @param noc_model A model of the NoC. This might be used by the derived class
58+
* to determine the position of NoC routers.
59+
*
60+
* @return Direction The direction to travel next
61+
*/
1662
TurnModelRouting::Direction select_next_direction(const std::vector<TurnModelRouting::Direction>& legal_directions,
1763
NocRouterId src_router_id,
1864
NocRouterId dst_router_id,

0 commit comments

Comments
 (0)