31
31
#include < unordered_map>
32
32
#include < string>
33
33
#include < map>
34
- #include < unordered_map>
35
34
#include < limits>
36
35
#include < numeric>
36
+ #include < unordered_set>
37
37
38
38
#include " vtr_ndmatrix.h"
39
39
#include " vtr_hash.h"
@@ -170,9 +170,22 @@ enum e_pin_location_distr {
170
170
171
171
/* pb_type class */
172
172
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
174
178
};
175
179
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
+
176
189
/* Annotations for pin-to-pin connections */
177
190
enum e_pin_to_pin_annotation_type {
178
191
E_ANNOT_PIN_TO_PIN_DELAY = 0 ,
@@ -535,6 +548,20 @@ constexpr int DEFAULT_SWITCH = -2;
535
548
* pb_type: Internal subblocks and routing information for this physical block
536
549
* pb_graph_head: Head of DAG of pb_types_nodes and their edges
537
550
*
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
+ *
538
565
* area: Describes how much area this logic block takes, if undefined, use default
539
566
* type_timing_inf: timing information unique to this type
540
567
* num_drivers: Total number of output drivers supplied
@@ -574,6 +601,13 @@ struct t_type_descriptor /* TODO rename this. maybe physical type descriptor or
574
601
t_pb_type *pb_type = nullptr ;
575
602
t_pb_graph_node *pb_graph_head = nullptr ;
576
603
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
+
577
611
float area = 0 ;
578
612
579
613
/* 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
582
616
583
617
int index = -1 ; /* index of type descriptor in array (allows for index referencing) */
584
618
619
+ /* **********
620
+ * Methods *
621
+ ***********/
622
+
585
623
/* Returns the indices of pins that contain a clock for this physical logic block */
586
624
std::vector<int > get_clock_pins_indices () const ;
587
625
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
+
588
629
};
589
630
typedef const t_type_descriptor* t_type_ptr;
590
631
@@ -864,6 +905,7 @@ struct t_pin_to_pin_annotation {
864
905
* pb_type: Pointer to the type of pb graph node this belongs to
865
906
* mode: parent mode of operation
866
907
* 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
867
909
* child_pb_graph_nodes: array of children pb graph nodes organized into modes
868
910
* parent_pb_graph_node: parent pb graph node
869
911
*/
@@ -873,6 +915,8 @@ class t_pb_graph_node {
873
915
874
916
int placement_index;
875
917
918
+ std::vector<int > illegal_modes;
919
+
876
920
t_pb_graph_pin **input_pins; /* [0..num_input_ports-1] [0..num_port_pins-1]*/
877
921
t_pb_graph_pin **output_pins; /* [0..num_output_ports-1] [0..num_port_pins-1]*/
878
922
t_pb_graph_pin **clock_pins; /* [0..num_clock_ports-1] [0..num_port_pins-1]*/
@@ -1153,6 +1197,7 @@ struct t_segment_inf {
1153
1197
std::vector<bool > cb;
1154
1198
std::vector<bool > sb;
1155
1199
// float Cmetal_per_m; /* Wire capacitance (per meter) */
1200
+ t_metadata_dict *meta = nullptr ;
1156
1201
};
1157
1202
1158
1203
enum class SwitchType {
0 commit comments