Skip to content

Commit 7f071ac

Browse files
set per link and per router latency and bandwidth in noc setup
1 parent cf839c4 commit 7f071ac

File tree

9 files changed

+128
-121
lines changed

9 files changed

+128
-121
lines changed

libs/libarchfpga/src/read_xml_arch_file_noc_tag.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,5 +618,4 @@ static void process_noc_overrides(pugi::xml_node noc_overrides_tag,
618618
bad_tag(override_tag, loc_data, noc_overrides_tag, {"router", "link"});
619619
}
620620
}
621-
622621
}

vpr/src/base/setup_noc.cpp

Lines changed: 86 additions & 82 deletions
Large diffs are not rendered by default.

vpr/src/base/setup_noc.h

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,26 @@
1616
*
1717
* Router Creation
1818
* ---------------
19-
* Each router described in the archietcture file is created and
19+
* Each router described in the architecture file is created and
2020
* added to the NoC. Since the routers represents physical tiles on
2121
* the FPGA, when the router is created, it is also assigned to a
2222
* corresponding physical router tile.
2323
*
2424
* Link Creation
2525
* -------------
26-
* The user describes a "connection list", which rerpesents an intended
26+
* The user describes a "connection list", which represents an intended
2727
* connection between two routers in the NoC. Each link connects two
2828
* routers together. For each router, a number
2929
* of Links are created to connect it to another router in its "connection
3030
* list".
3131
*
3232
*/
3333

34-
#include <iostream>
35-
#include <string>
34+
#include <string_view>
3635
#include <vector>
3736

38-
#include "physical_types.h"
3937
#include "device_grid.h"
40-
#include "globals.h"
41-
#include "noc_storage.h"
42-
#include "vpr_error.h"
43-
44-
// a default condition that helps keep track of whether a physical router has been assigned to a logical router or not
45-
#define PHYSICAL_ROUTER_NOT_ASSIGNED -1
46-
47-
// a deafult index used for initiailization purposes. No router will have a negative index
48-
#define INVALID_PHYSICAL_ROUTER_INDEX -1
38+
#include "vpr_context.h"
4939

5040
// a data structure to store the position information of a noc router in the FPGA device
5141
struct t_noc_router_tile_position {
@@ -83,13 +73,14 @@ void setup_noc(const t_arch& arch);
8373
* stored in a list.
8474
*
8575
* @param device_grid The FPGA device description.
86-
* @param list_of_noc_router_tiles Stores the grid position information
87-
* for all NoC router tiles in the FPGA.
8876
* @param noc_router_tile_name The name used when describing the NoC router
8977
* tile in the FPGA architecture description
9078
* file.
79+
*
80+
* @return The grid position information for all NoC router tiles in the FPGA.
9181
*/
92-
void identify_and_store_noc_router_tile_positions(const DeviceGrid& device_grid, std::vector<t_noc_router_tile_position>& list_of_noc_router_tiles, std::string noc_router_tile_name);
82+
std::vector<t_noc_router_tile_position> identify_and_store_noc_router_tile_positions(const DeviceGrid& device_grid,
83+
std::string_view noc_router_tile_name);
9384

9485
/**
9586
* @brief Creates NoC routers and adds them to the NoC model based
@@ -104,7 +95,9 @@ void identify_and_store_noc_router_tile_positions(const DeviceGrid& device_grid,
10495
* @param list_of_noc_router_tiles Stores the grid position information
10596
* for all NoC router tiles in the FPGA.
10697
*/
107-
void generate_noc(const t_arch& arch, NocContext& noc_ctx, std::vector<t_noc_router_tile_position>& list_of_noc_router_tiles);
98+
void generate_noc(const t_arch& arch,
99+
NocContext& noc_ctx,
100+
const std::vector<t_noc_router_tile_position>& list_of_noc_router_tiles);
108101

109102
/**
110103
* @brief Go through the outers described by the user
@@ -121,7 +114,9 @@ void generate_noc(const t_arch& arch, NocContext& noc_ctx, std::vector<t_noc_rou
121114
* @param list_of_noc_router_tiles Stores the grid position information
122115
* for all NoC router tiles in the FPGA.
123116
*/
124-
void create_noc_routers(const t_noc_inf& noc_info, NocStorage* noc_model, std::vector<t_noc_router_tile_position>& list_of_noc_router_tiles);
117+
void create_noc_routers(const t_noc_inf& noc_info,
118+
NocStorage* noc_model,
119+
const std::vector<t_noc_router_tile_position>& list_of_noc_router_tiles);
125120

126121
/**
127122
* @brief Goes through the topology information as described in the FPGA
@@ -134,6 +129,6 @@ void create_noc_routers(const t_noc_inf& noc_info, NocStorage* noc_model, std::v
134129
* @param noc_model An internal model that describes the NoC. Contains a list of
135130
* routers and links that connect the routers together.
136131
*/
137-
void create_noc_links(const t_noc_inf* noc_info, NocStorage* noc_model);
132+
void create_noc_links(const t_noc_inf& noc_info, NocStorage* noc_model);
138133

139134
#endif

vpr/src/noc/noc_link.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#include "noc_link.h"
22

33
// constructor
4-
NocLink::NocLink(NocLinkId link_id, NocRouterId source, NocRouterId sink, double bw)
4+
NocLink::NocLink(NocLinkId link_id, NocRouterId source, NocRouterId sink,
5+
double bw, double lat)
56
: id(link_id)
67
, source_router(source)
78
, sink_router(sink)
89
, bandwidth_usage(0.0)
9-
, bandwidth(bw) { }
10+
, bandwidth(bw)
11+
, latency(lat) { }
1012

1113
// getters
1214
NocRouterId NocLink::get_source_router(void) const {

vpr/src/noc/noc_link.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ class NocLink {
5151

5252
double bandwidth_usage; /*!< Represents the bandwidth of the data being transmitted on the link. Units in bits-per-second(bps)*/
5353
double bandwidth; /*!< Represents the maximum bits per second that can be transmitted over the link without causing congestion*/
54+
double latency;
5455

5556
public:
56-
NocLink(NocLinkId link_id, NocRouterId source_router, NocRouterId sink_router, double bw);
57+
NocLink(NocLinkId link_id, NocRouterId source_router, NocRouterId sink_router,
58+
double bw, double lat);
5759

5860
// getters
5961

vpr/src/noc/noc_router.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#include "noc_router.h"
22

33
// constructor
4-
NocRouter::NocRouter(int id, int grid_position_x, int grid_position_y, int layer_position)
4+
NocRouter::NocRouter(int id,
5+
int grid_position_x, int grid_position_y, int layer_position,
6+
double latency)
57
: router_user_id(id)
68
, router_grid_position_x(grid_position_x)
79
, router_grid_position_y(grid_position_y)
8-
, router_layer_position(layer_position) {
10+
, router_layer_position(layer_position)
11+
, router_latency(latency){
912
// initialize variables
1013
router_block_ref = ClusterBlockId(0);
1114
}
@@ -43,5 +46,4 @@ ClusterBlockId NocRouter::get_router_block_ref(void) const {
4346
// setters
4447
void NocRouter::set_router_block_ref(ClusterBlockId router_block_ref_id) {
4548
router_block_ref = router_block_ref_id;
46-
return;
4749
}

vpr/src/noc/noc_router.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@ class NocRouter {
5353
* that the physical router is located*/
5454
int router_layer_position;
5555

56+
double router_latency;
57+
5658
/** A unique identifier that represents a router block in the
5759
* clustered netlist that is placed on the physical router*/
5860
ClusterBlockId router_block_ref;
5961

6062
public:
61-
NocRouter(int id, int grid_position_x, int grid_position_y, int layer_position);
63+
NocRouter(int id,
64+
int grid_position_x, int grid_position_y, int layer_position,
65+
double latency);
6266

6367
// getters
6468

vpr/src/noc/noc_storage.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@ NocRouterId NocStorage::get_router_at_grid_location(const t_pl_loc& hard_router_
8989

9090
// setters for the NoC
9191

92-
void NocStorage::add_router(int id, int grid_position_x, int grid_posistion_y, int layer_position) {
92+
void NocStorage::add_router(int id,
93+
int grid_position_x, int grid_posistion_y, int layer_position,
94+
double latency) {
9395
VTR_ASSERT_MSG(!built_noc, "NoC already built, cannot modify further.");
9496

95-
router_storage.emplace_back(id, grid_position_x, grid_posistion_y, layer_position);
97+
router_storage.emplace_back(id, grid_position_x, grid_posistion_y, layer_position, latency);
9698

9799
/* Get the corresponding NocRouterId for the newly added router and
98100
* add it to the conversion table.
@@ -107,23 +109,18 @@ void NocStorage::add_router(int id, int grid_position_x, int grid_posistion_y, i
107109
// get the key to identify the current router
108110
int router_key = generate_router_key_from_grid_location(grid_position_x, grid_posistion_y, layer_position);
109111
grid_location_to_router_id.insert(std::pair<int, NocRouterId>(router_key, converted_id));
110-
111-
return;
112112
}
113113

114-
void NocStorage::add_link(NocRouterId source, NocRouterId sink) {
114+
void NocStorage::add_link(NocRouterId source, NocRouterId sink, double bandwidth, double latency) {
115115
VTR_ASSERT_MSG(!built_noc, "NoC already built, cannot modify further.");
116116

117117
// the new link will be added to the back of the list,
118118
// so we can use the total number of links added so far as id
119119
NocLinkId added_link_id((int)link_storage.size());
120120

121-
double link_bandwidth = get_noc_link_bandwidth();
122-
link_storage.emplace_back(added_link_id, source, sink, link_bandwidth);
121+
link_storage.emplace_back(added_link_id, source, sink, bandwidth, latency);
123122

124123
router_link_list[source].push_back(added_link_id);
125-
126-
return;
127124
}
128125

129126
void NocStorage::set_noc_link_bandwidth(double link_bandwidth) {

vpr/src/noc/noc_storage.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,9 @@ class NocStorage {
322322
* @param grid_position_y The vertical position on the FPGA of the physical
323323
* tile that this router represents.
324324
*/
325-
void add_router(int id, int grid_position_x, int grid_position_y, int layer_poisition);
325+
void add_router(int id,
326+
int grid_position_x, int grid_position_y, int layer_poisition,
327+
double latency);
326328

327329
/**
328330
* @brief Creates a new link and adds it to the NoC. The newly created
@@ -336,7 +338,7 @@ class NocStorage {
336338
* @param sink A unique identifier for the router that the new link enters
337339
* into (incoming to the router)
338340
*/
339-
void add_link(NocRouterId source, NocRouterId sink);
341+
void add_link(NocRouterId source, NocRouterId sink, double bandwidth, double latency);
340342

341343
/**
342344
* @brief Set the maximum allowable bandwidth for a link

0 commit comments

Comments
 (0)