Skip to content

Commit 638e72c

Browse files
committed
vtr_arch: added handler to insert equivalent tiles
Signed-off-by: Alessandro Comodi <[email protected]>
1 parent 938687c commit 638e72c

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

libs/libarchfpga/src/physical_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,9 @@ struct t_type_descriptor /* TODO rename this. maybe physical type descriptor or
587587
t_pb_type *pb_type = nullptr;
588588
t_pb_graph_node *pb_graph_head = nullptr;
589589

590+
int num_equivalent_tiles = 0;
591+
t_type_descriptor **equivalent_tiles = nullptr;
592+
590593
float area = 0;
591594

592595
/* This info can be determined from class_inf and pin_class but stored for faster access */

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ static void ProcessTilesTags(pugi::xml_node Node,
125125
t_arch& arch,
126126
const t_default_fc_spec &arch_def_fc,
127127
const pugiutil::loc_data& loc_data);
128+
static void ProcessTileExtraModes(pugi::xml_node Node,
129+
t_type_descriptor *Type,
130+
t_type_descriptor **Types,
131+
int NumTypes,
132+
const pugiutil::loc_data& loc_data);
128133
static void ProcessComplexBlocks(pugi::xml_node Node,
129134
t_type_descriptor ** Types,
130135
int NumTypes,
@@ -2692,7 +2697,7 @@ static void ProcessTiles(pugi::xml_node Node,
26922697
t_type_descriptor ** Types,
26932698
int *NumTypes,
26942699
const pugiutil::loc_data& loc_data) {
2695-
pugi::xml_node CurType, Prev;
2700+
pugi::xml_node CurType;
26962701
pugi::xml_node Cur;
26972702
t_type_descriptor * Type;
26982703
int i;
@@ -2789,22 +2794,54 @@ static void ProcessTilesTags(pugi::xml_node Node,
27892794
Cur = get_single_child(CurType, "fc", loc_data, OPTIONAL);
27902795
Process_Fc(Cur, Type, arch.Segments, arch_def_fc, loc_data);
27912796

2792-
//Load switchblock type and location overrides
2797+
/* Load switchblock type and location overrides */
27932798
Cur = get_single_child(CurType, "switchblock_locations", loc_data, OPTIONAL);
27942799
ProcessSwitchblockLocations(Cur, Type, arch, loc_data);
27952800

2801+
/* Load possible modes (pb_types which are compatible with the current tile) */
2802+
Cur = get_single_child(CurType, "equivalent_tiles", loc_data, OPTIONAL);
2803+
if(Cur) {
2804+
ProcessTileExtraModes(Cur, Type, Types, NumTypes, loc_data);
2805+
}
2806+
27962807
/* Free this node and get its next sibling node */
27972808
CurType = CurType.next_sibling (CurType.name());
27982809
}
27992810
}
28002811

2812+
/* TODO Add documentation */
2813+
static void ProcessTileExtraModes(pugi::xml_node Node,
2814+
t_type_descriptor *Type,
2815+
t_type_descriptor **Types,
2816+
int NumTypes,
2817+
const pugiutil::loc_data& loc_data) {
2818+
pugi::xml_node CurType;
2819+
2820+
Type->num_equivalent_tiles = count_children(Node, "mode", loc_data);
2821+
Type->equivalent_tiles = (t_type_descriptor **) vtr::malloc(Type->num_equivalent_tiles * sizeof(t_type_descriptor *));
2822+
int index = 0;
2823+
CurType = Node.first_child();
2824+
while(CurType && index < Type->num_equivalent_tiles) {
2825+
const char *equivalent_tile_name = get_attribute(CurType, "name", loc_data).value();
2826+
2827+
Type->equivalent_tiles[index] = get_correspondent_tile(Types, NumTypes, equivalent_tile_name);
2828+
if(Type->equivalent_tiles[index] == nullptr) {
2829+
archfpga_throw(loc_data.filename_c_str(), loc_data.line(CurType),
2830+
"No tiles found correspondent to equivalent tile name: '%s'.\n", Type->pb_type->name);
2831+
}
2832+
2833+
index++;
2834+
CurType = CurType.next_sibling (CurType.name());
2835+
}
2836+
}
2837+
28012838
static void ProcessComplexBlocks(pugi::xml_node Node,
28022839
t_type_descriptor ** Types,
28032840
int NumTypes,
28042841
t_arch& arch,
28052842
const bool timing_enabled,
28062843
const pugiutil::loc_data& loc_data) {
2807-
pugi::xml_node CurPbType, Prev;
2844+
pugi::xml_node CurPbType;
28082845
t_type_descriptor * Type;
28092846

28102847
map<string, int> pb_types;

0 commit comments

Comments
 (0)