Skip to content

Commit 4aa07e7

Browse files
committed
[lib][arch] add template id to t_arch_switch
1 parent 0f5bbb4 commit 4aa07e7

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

libs/libarchfpga/src/physical_types.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,6 +1799,12 @@ struct t_arch_switch_inf {
17991799
e_power_buffer_type power_buffer_type = POWER_BUFFER_TYPE_AUTO;
18001800
float power_buffer_size = 0.;
18011801

1802+
// The template ID of the switch. This is metadata stored for each switch to
1803+
// simplify certain analyses. For example, when generating the CRR graph, the
1804+
// template ID is used to determine which switch in the template is used most
1805+
// or least frequently.
1806+
std::string template_id = "";
1807+
18021808
bool intra_tile = false;
18031809

18041810
public:

vpr/src/route/rr_graph_generation/tileable_rr_graph/crr_generator/crr_edge_builder.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ static std::string get_crr_switch_name(const int delay_ps) {
1212
}
1313
}
1414

15-
static t_arch_switch_inf create_crr_switch(const int delay_ps) {
15+
static t_arch_switch_inf create_crr_switch(const int delay_ps, const std::string& sw_template_id) {
1616
std::string switch_name = get_crr_switch_name(delay_ps);
1717

1818
t_arch_switch_inf arch_switch_inf;
@@ -27,23 +27,23 @@ static t_arch_switch_inf create_crr_switch(const int delay_ps) {
2727
arch_switch_inf.buf_size_type = e_buffer_size::ABSOLUTE;
2828
arch_switch_inf.buf_size = 0.;
2929
arch_switch_inf.intra_tile = false;
30+
arch_switch_inf.template_id = sw_template_id;
3031

3132
return arch_switch_inf;
3233
}
3334

34-
static RRSwitchId find_or_create_crr_switch_id(const int delay_ps) {
35+
static RRSwitchId find_or_create_crr_switch_id(const int delay_ps, const std::string& sw_template_id) {
3536
std::vector<t_arch_switch_inf>& all_sw_inf = g_vpr_ctx.mutable_device().all_sw_inf;
36-
std::string switch_name = get_crr_switch_name(delay_ps);
3737
int found_sw_id = -1;
3838
for (int sw_id = 0; sw_id < (int)all_sw_inf.size(); sw_id++) {
39-
if (all_sw_inf[sw_id].name == switch_name) {
39+
if (all_sw_inf[sw_id].template_id == sw_template_id) {
4040
found_sw_id = sw_id;
4141
break;
4242
}
4343
}
4444

4545
if (found_sw_id == -1) {
46-
t_arch_switch_inf new_arch_switch_inf = create_crr_switch(delay_ps);
46+
t_arch_switch_inf new_arch_switch_inf = create_crr_switch(delay_ps, sw_template_id);
4747
found_sw_id = (int)all_sw_inf.size();
4848
all_sw_inf.insert(std::make_pair(found_sw_id, new_arch_switch_inf));
4949
VTR_LOG("Created new CRR switch: %s with ID: %d\n", switch_name.c_str(), found_sw_id);
@@ -66,7 +66,7 @@ void build_crr_gsb_edges(RRGraphBuilder& rr_graph_builder,
6666
if (delay_ps == -1) {
6767
rr_switch_id = rr_node_driver_switches[connection.sink_node()];
6868
} else {
69-
rr_switch_id = find_or_create_crr_switch_id(delay_ps);
69+
rr_switch_id = find_or_create_crr_switch_id(delay_ps, connection.sw_template_id());
7070
}
7171
VTR_ASSERT(rr_switch_id != RRSwitchId::INVALID());
7272
rr_graph_builder.create_edge_in_cache(connection.src_node(),

0 commit comments

Comments
 (0)