Skip to content

Commit b0ec0c1

Browse files
committed
equivalent tiles: added equivalent tile placement capability
This commit introduces two major features: - introduce the tile concept in the architecture XML. Top level pb_type is discarded and all the top level pb_type information are moved into the tile tags. This will cause CI build to fail as all the architectures do not include the tiles tag right now. - introduce the possibility to place blocks in equivalent tiles (SLICEL blocks into SLICEM ones). According to the XML architecture description there could be tiles equivalent to others that can be used during the placement step (this can bring to better placement solutions) Signed-off-by: Alessandro Comodi <[email protected]>
1 parent f6d5c7e commit b0ec0c1

File tree

10 files changed

+803
-260
lines changed

10 files changed

+803
-260
lines changed

libs/libarchfpga/src/physical_types.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,15 @@ std::vector<int> t_type_descriptor::get_clock_pins_indices () const {
142142
return indices;
143143
}
144144

145+
bool t_type_descriptor::is_available_tile_index(int index_to_check) const {
146+
auto search = this->available_tiles_indices.find(index_to_check);
147+
if (search != available_tiles_indices.end()) {
148+
return true;
149+
}
150+
151+
return false;
152+
}
153+
145154
/**
146155
* t_pb_graph_node
147156
*/

libs/libarchfpga/src/physical_types.h

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
#include <unordered_map>
3232
#include <string>
3333
#include <map>
34-
#include <unordered_map>
3534
#include <limits>
3635
#include <numeric>
36+
#include <unordered_set>
3737

3838
#include "vtr_ndmatrix.h"
3939
#include "vtr_hash.h"
@@ -170,9 +170,22 @@ enum e_pin_location_distr {
170170

171171
/* pb_type class */
172172
enum e_pb_type_class {
173-
UNKNOWN_CLASS = 0, LUT_CLASS = 1, LATCH_CLASS = 2, MEMORY_CLASS = 3
173+
UNKNOWN_CLASS = 0,
174+
LUT_CLASS = 1,
175+
LATCH_CLASS = 2,
176+
MEMORY_CLASS = 3,
177+
NUM_CLASSES
174178
};
175179

180+
// Set of all pb_type classes
181+
constexpr std::array<e_pb_type_class, NUM_CLASSES> TYPE_CLASSES = {
182+
{UNKNOWN_CLASS, LUT_CLASS, LATCH_CLASS, MEMORY_CLASS} };
183+
184+
// String versions of pb_type class values
185+
constexpr std::array<const char*, NUM_CLASSES> TYPE_CLASS_STRING = {
186+
{"unknown", "lut", "flipflop", "memory"} };
187+
188+
176189
/* Annotations for pin-to-pin connections */
177190
enum e_pin_to_pin_annotation_type {
178191
E_ANNOT_PIN_TO_PIN_DELAY = 0,
@@ -535,6 +548,20 @@ constexpr int DEFAULT_SWITCH = -2;
535548
* pb_type: Internal subblocks and routing information for this physical block
536549
* pb_graph_head: Head of DAG of pb_types_nodes and their edges
537550
*
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+
* available_tiles_indices: unordered map used to have a fast lookup on the available tiles.
564+
*
538565
* area: Describes how much area this logic block takes, if undefined, use default
539566
* type_timing_inf: timing information unique to this type
540567
* num_drivers: Total number of output drivers supplied
@@ -574,6 +601,13 @@ struct t_type_descriptor /* TODO rename this. maybe physical type descriptor or
574601
t_pb_type *pb_type = nullptr;
575602
t_pb_graph_node *pb_graph_head = nullptr;
576603

604+
/* Equivalent tiles information */
605+
int num_equivalent_tiles = 0;
606+
std::unordered_map<int, t_type_descriptor *> equivalent_tiles; /* [0..num_equivalent_tiles-1] */
607+
std::unordered_map<int, std::unordered_map<int, int>> equivalent_tile_pin_mapping; /* [0..num_equivalent_tiles-1][0..num_pins-1] */
608+
std::unordered_map<int, std::unordered_map<int, int>> equivalent_tile_inverse_pin_mapping; /* [0..num_equivalent_tiles-1][0..num_pins-1] */
609+
std::unordered_set<int> available_tiles_indices;
610+
577611
float area = 0;
578612

579613
/* This info can be determined from class_inf and pin_class but stored for faster access */
@@ -582,9 +616,16 @@ struct t_type_descriptor /* TODO rename this. maybe physical type descriptor or
582616

583617
int index = -1; /* index of type descriptor in array (allows for index referencing) */
584618

619+
/***********
620+
* Methods *
621+
***********/
622+
585623
/* Returns the indices of pins that contain a clock for this physical logic block */
586624
std::vector<int> get_clock_pins_indices() const;
587625

626+
/* Returns a boolean set to True if the input index belongs to an available tile, False otherwise */
627+
bool is_available_tile_index(int index_to_check) const;
628+
588629
};
589630
typedef const t_type_descriptor* t_type_ptr;
590631

@@ -864,6 +905,7 @@ struct t_pin_to_pin_annotation {
864905
* pb_type: Pointer to the type of pb graph node this belongs to
865906
* mode: parent mode of operation
866907
* placement_index: there are a certain number of pbs available, this gives the index of the node
908+
* illegal_modes: vector containing illigal modes that result in conflicts during routing
867909
* child_pb_graph_nodes: array of children pb graph nodes organized into modes
868910
* parent_pb_graph_node: parent pb graph node
869911
*/
@@ -873,6 +915,8 @@ class t_pb_graph_node {
873915

874916
int placement_index;
875917

918+
std::vector<int> illegal_modes;
919+
876920
t_pb_graph_pin **input_pins; /* [0..num_input_ports-1] [0..num_port_pins-1]*/
877921
t_pb_graph_pin **output_pins; /* [0..num_output_ports-1] [0..num_port_pins-1]*/
878922
t_pb_graph_pin **clock_pins; /* [0..num_clock_ports-1] [0..num_port_pins-1]*/
@@ -1153,6 +1197,7 @@ struct t_segment_inf {
11531197
std::vector<bool> cb;
11541198
std::vector<bool> sb;
11551199
//float Cmetal_per_m; /* Wire capacitance (per meter) */
1200+
t_metadata_dict *meta = nullptr;
11561201
};
11571202

11581203
enum class SwitchType {

0 commit comments

Comments
 (0)