Skip to content

Commit f9b3cd7

Browse files
committed
add flat idx to pb_graph_node and modifed alloc_and_load... to populate it
1 parent b04f8c5 commit f9b3cd7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

libs/libarchfpga/src/physical_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,7 @@ struct t_pin_to_pin_annotation {
12251225
* parent_pb_graph_node : parent pb graph node
12261226
* total_primitive_count : Total number of this primitive type in the cluster. If there are 10 ALMs per cluster
12271227
* and 2 FFs per ALM (given the mode of the parent of this primitive) then the total is 20.
1228+
* flat_site_index : index of this primitive within its primitive type in this cluster; in [0,...,total_primitive_count]
12281229
* illegal_modes : vector containing illegal modes that result in conflicts during routing
12291230
*/
12301231
class t_pb_graph_node {
@@ -1281,6 +1282,8 @@ class t_pb_graph_node {
12811282
int num_output_pin_class; /* number of output pin classes that this pb_graph_node has */
12821283

12831284
int total_primitive_count; /* total number of this primitive type in the cluster */
1285+
int flat_site_index; /* index of this primitive within sites of its type in this cluster */
1286+
12841287

12851288
/* Interconnect instances for this pb
12861289
* Only used for power

vpr/src/pack/pb_type_graph.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
4848
t_pb_graph_node* parent_pb_graph_node,
4949
t_pb_type* pb_type,
5050
const int index,
51+
const int flat_index,
5152
bool load_power_structures,
5253
int& pin_count_in_cluster);
5354

@@ -151,6 +152,7 @@ void alloc_and_load_all_pb_graphs(bool load_power_structures, bool is_flat) {
151152
nullptr,
152153
type.pb_type,
153154
0,
155+
0,
154156
load_power_structures,
155157
pin_count_in_cluster);
156158
type.pb_graph_head->total_pb_pins = pin_count_in_cluster;
@@ -224,6 +226,7 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
224226
t_pb_graph_node* parent_pb_graph_node,
225227
t_pb_type* pb_type,
226228
const int index,
229+
const int flat_index,
227230
bool load_power_structures,
228231
int& pin_count_in_cluster) {
229232
int i, j, k, i_input, i_output, i_clockport;
@@ -237,6 +240,7 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
237240
pb_graph_node->num_clock_ports = 0;
238241

239242
pb_graph_node->total_primitive_count = 0;
243+
pb_graph_node->flat_site_index = flat_index;
240244

241245
/* Generate ports for pb graph node */
242246
for (i = 0; i < pb_type->num_ports; i++) {
@@ -349,11 +353,14 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
349353
sizeof(t_pb_graph_node*));
350354
for (j = 0; j < pb_type->modes[i].num_pb_type_children; j++) {
351355
pb_graph_node->child_pb_graph_nodes[i][j] = (t_pb_graph_node*)vtr::calloc(pb_type->modes[i].pb_type_children[j].num_pb, sizeof(t_pb_graph_node));
356+
int base = flat_index*(pb_type->modes[i].pb_type_children[j].num_pb);
357+
352358
for (k = 0; k < pb_type->modes[i].pb_type_children[j].num_pb; k++) {
353359
alloc_and_load_pb_graph(&pb_graph_node->child_pb_graph_nodes[i][j][k],
354360
pb_graph_node,
355361
&pb_type->modes[i].pb_type_children[j],
356362
k,
363+
base + k,
357364
load_power_structures,
358365
pin_count_in_cluster);
359366
}

0 commit comments

Comments
 (0)