Skip to content

Commit fc664ea

Browse files
committed
equivalent tiles: added documentation to new members and functions
Signed-off-by: Alessandro Comodi <[email protected]>
1 parent 4be2dee commit fc664ea

File tree

3 files changed

+51
-7
lines changed

3 files changed

+51
-7
lines changed

libs/libarchfpga/src/physical_types.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,19 @@ constexpr int DEFAULT_SWITCH = -2;
548548
* pb_type: Internal subblocks and routing information for this physical block
549549
* pb_graph_head: Head of DAG of pb_types_nodes and their edges
550550
*
551+
*
552+
* num_equivalent_tiles: Specifies the number of equivalent physical types that can be used during placement.
553+
* If the value is `0` all the data structures relative to the equivalent tiles will be empty.
554+
* equivalent_tiles: Array containing pointers to the equivalent tiles. The number of elements contained is specified
555+
* by num_equivalent_tiles.
556+
* equivalent_tile_pin_mapping: Multi-dimensional array that, for each different equivalent tile contains a mapping between
557+
* the pins of the two tiles.
558+
* Example: equivalent_tile_pin_mapping[eq_tile_index][pin_index] = equivalent_pin_index
559+
* This is necessary to maintain consistency between two equivalent tiles that have the same pins
560+
* defined with different indeces.
561+
* equivalent_tile_inverse_pin_mapping: Multi-dimensional array that works as the previous one, but the mapping is inverse in this case.
562+
* Example: equivalent_tile_pin_mapping[eq_tile_index][equivalent_pin_index] = pin_index
563+
*
551564
* area: Describes how much area this logic block takes, if undefined, use default
552565
* type_timing_inf: timing information unique to this type
553566
* num_drivers: Total number of output drivers supplied
@@ -587,6 +600,7 @@ struct t_type_descriptor /* TODO rename this. maybe physical type descriptor or
587600
t_pb_type *pb_type = nullptr;
588601
t_pb_graph_node *pb_graph_head = nullptr;
589602

603+
/* Equivalent tiles information */
590604
int num_equivalent_tiles = 0;
591605
t_type_descriptor **equivalent_tiles = nullptr;
592606
int **equivalent_tile_pin_mapping = nullptr; /* [0..num_equivalent_tiles-1][0..num_pins-1] */

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ void XmlReadArch(const char *ArchFile, const bool timing_enabled,
302302
Next = get_single_child(architecture, "tiles", loc_data);
303303
ProcessTilesTags(Next, Types, *NumTypes, *arch, arch_def_fc, loc_data);
304304

305-
/* Process directs */
305+
/* Process directs */
306306
Next = get_single_child(architecture, "directlist", loc_data, OPTIONAL);
307307
if (Next) {
308308
ProcessDirects(Next, &(arch->Directs), &(arch->num_directs),
@@ -2816,7 +2816,24 @@ static void ProcessTilesTags(pugi::xml_node Node,
28162816
}
28172817
}
28182818

2819-
/* TODO Add documentation */
2819+
/* Processes the equivalent tiles defined in the XML arch definition
2820+
* <tiles>
2821+
* <tile name="LAB">
2822+
* <mode name="MLAB">
2823+
* <map .../>
2824+
* <map .../>
2825+
* <map .../>
2826+
* </mode>
2827+
* </tile>
2828+
* </tiles>
2829+
*
2830+
* In particular this function parses the `modes` (if they exist) of each tile
2831+
* and adds the equivalent tile information to the t_type_descriptor relative to
2832+
* the current tile.
2833+
* It populates the following t_type_descriptor members:
2834+
* - num_equivalent_tiles;
2835+
* - equivalent_tiles.
2836+
*/
28202837
static void ProcessTileExtraModes(pugi::xml_node Node,
28212838
t_type_descriptor *Type,
28222839
t_type_descriptor **Types,
@@ -2848,7 +2865,11 @@ static void ProcessTileExtraModes(pugi::xml_node Node,
28482865
}
28492866
}
28502867

2851-
/* TODO: Add documentation */
2868+
/* Processes the pin_mapping of each equivalent tile.
2869+
* It goes through each mode and populates the following t_type_descriptor memebrs:
2870+
* - equivalent_tile_pin_mapping;
2871+
* - equivalent_tile_inverse_pin_mapping.
2872+
*/
28522873
static void ProcessTileExtraModePinMapping(pugi::xml_node Node,
28532874
t_type_descriptor *Type,
28542875
t_type_descriptor *EquivalentType,

vpr/src/base/clustered_netlist.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,21 @@ class ClusteredNetlist : public Netlist<ClusterBlockId, ClusterPortId, ClusterPi
126126
//Returns the physical block
127127
t_pb* block_pb(const ClusterBlockId id) const;
128128

129-
//Returns the type of CLB (Logic block, RAM, DSP, etc.). Calls block_type with boolean set to true.
129+
/*
130+
* Returns the type of CLB (Logic block, RAM, DSP, etc.). There are two different overloaded block_type functions
131+
* 1) The first one (without the boolean) is used to retrieve the actual physical type corresponding to the placed
132+
* block. This function will call the one with the boolean, setting `get_equivalent_if_set` to true.
133+
* 2) The second one (with the boolean) is used to retrieve the physical or logical type relative to a block.
134+
* Depending on the value of `get_equivalent_if_set` we will get a different block_type:
135+
* - True: the function returns the physical placed tile (can be an equivalent tile) of the block;
136+
* - False: the function returns the logical tile of the block (even if it was placed in an equivalent tile).
137+
*/
130138
t_type_ptr block_type(const ClusterBlockId id) const;
131-
132-
//Returns the type of CLB. If get_equivalent_if_set is true, if the equivalent tile has been chosen it returns it.
133139
t_type_ptr block_type(const ClusterBlockId id, bool get_equivalent_if_set) const;
134140

135141
//Returns the equivalent type index (if any) of a CLB
142+
//The index is used to retrieve the equivalent type from the t_type_descriptor structure
143+
//Example: type->equivalent_tiles[index]
136144
int block_eq_type_index(const ClusterBlockId id) const;
137145

138146
//Returns the net of the block attached to the specific pin index
@@ -182,7 +190,8 @@ class ClusteredNetlist : public Netlist<ClusterBlockId, ClusterPortId, ClusterPi
182190
// t_type_ptr : The type of the CLB
183191
ClusterBlockId create_block(const char *name, t_pb* pb, t_type_ptr type);
184192

185-
//Add the equivalent block type for a CLB
193+
//Add the equivalent block type for a CLB. This mutator adds both the equivalent type index and
194+
//the equivalent type to the corresponding vector_maps
186195
// blk_id : The block placed in an equivalent tile location
187196
// i_eq_type : The index used to retrieve the equivalent tile from the t_type_ptr structure
188197
// eq_type : The equivalent type associated with this block

0 commit comments

Comments
 (0)