Skip to content

Commit eaafe90

Browse files
committed
Merge branch 'master' into improve-reg-tests
# Conflicts: # vtr_flow/tasks/regression_tests/vtr_reg_multiclock_odin/func_multiclock/blanket/config/golden_results.txt # vtr_flow/tasks/regression_tests/vtr_reg_multiclock_odin/func_multiclock/once/config/golden_results.txt
2 parents 5822937 + 2031f1f commit eaafe90

File tree

152 files changed

+8179
-3314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+8179
-3314
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,5 @@ tags
140140
#
141141
.idea
142142
cmake-build-debug
143+
cmake-build-release
143144
/.metadata/

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ add_definitions("-DVTR_ASSERT_LEVEL=${VTR_ASSERT_LEVEL}")
8888
include(CheckCXXCompilerFlag)
8989

9090
#
91-
# We require c++14 support
91+
# We require c++17 support
9292
#
93-
set(CMAKE_CXX_STANDARD 14)
93+
set(CMAKE_CXX_STANDARD 17)
9494
set(CMAKE_CXX_STANDARD_REQUIRED ON)
9595
set(CMAKE_CXX_EXTENSIONS OFF) #No compiler specific extensions
9696

@@ -252,7 +252,7 @@ set(SANITIZE_FLAGS "")
252252
if(VTR_ENABLE_SANITIZE)
253253
#Enable sanitizers
254254
# -fuse-ld=gold force the gold linker to be used (required for sanitizers, but not enabled by default on some systems)
255-
set(SANITIZE_FLAGS "-g -fsanitize=address -fsanitize=leak -fsanitize=undefined -fuse-ld=gold -static-libasan")
255+
set(SANITIZE_FLAGS "-g -fsanitize=address -fsanitize=leak -fuse-ld=gold -static-libasan")
256256
message(STATUS "SANITIZE_FLAGS: ${SANITIZE_FLAGS}")
257257
endif()
258258

libs/libarchfpga/src/arch_util.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,6 @@ void free_arch(t_arch* arch) {
152152
return;
153153
}
154154

155-
for (int i = 0; i < arch->num_switches; ++i) {
156-
if (arch->Switches->name != nullptr) {
157-
vtr::free(arch->Switches[i].name);
158-
}
159-
}
160155
delete[] arch->Switches;
161156
arch->Switches = nullptr;
162157

libs/libarchfpga/src/echo_arch.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,16 @@ void PrintArchInfo(FILE* Echo, const t_arch* arch) {
243243
//and a sign
244244
for (i = 0; i < arch->num_switches; i++) {
245245
if (arch->Switches[i].type() == SwitchType::MUX) {
246-
fprintf(Echo, "\tSwitch[%d]: name %s type mux\n", i + 1, arch->Switches[i].name);
246+
fprintf(Echo, "\tSwitch[%d]: name %s type mux\n", i + 1, arch->Switches[i].name.c_str());
247247
} else if (arch->Switches[i].type() == SwitchType::TRISTATE) {
248-
fprintf(Echo, "\tSwitch[%d]: name %s type tristate\n", i + 1, arch->Switches[i].name);
248+
fprintf(Echo, "\tSwitch[%d]: name %s type tristate\n", i + 1, arch->Switches[i].name.c_str());
249249
} else if (arch->Switches[i].type() == SwitchType::SHORT) {
250-
fprintf(Echo, "\tSwitch[%d]: name %s type short\n", i + 1, arch->Switches[i].name);
250+
fprintf(Echo, "\tSwitch[%d]: name %s type short\n", i + 1, arch->Switches[i].name.c_str());
251251
} else if (arch->Switches[i].type() == SwitchType::BUFFER) {
252-
fprintf(Echo, "\tSwitch[%d]: name %s type buffer\n", i + 1, arch->Switches[i].name);
252+
fprintf(Echo, "\tSwitch[%d]: name %s type buffer\n", i + 1, arch->Switches[i].name.c_str());
253253
} else {
254254
VTR_ASSERT(arch->Switches[i].type() == SwitchType::PASS_GATE);
255-
fprintf(Echo, "\tSwitch[%d]: name %s type pass_gate\n", i + 1, arch->Switches[i].name);
255+
fprintf(Echo, "\tSwitch[%d]: name %s type pass_gate\n", i + 1, arch->Switches[i].name.c_str());
256256
}
257257
fprintf(Echo, "\t\t\t\tR %e Cin %e Cout %e\n", arch->Switches[i].R,
258258
arch->Switches[i].Cin, arch->Switches[i].Cout);
@@ -281,11 +281,11 @@ void PrintArchInfo(FILE* Echo, const t_arch* arch) {
281281
if (seg.directionality == UNI_DIRECTIONAL) {
282282
//wire_switch == arch_opin_switch
283283
fprintf(Echo, "\t\t\t\ttype unidir mux_name %s\n",
284-
arch->Switches[seg.arch_wire_switch].name);
284+
arch->Switches[seg.arch_wire_switch].name.c_str());
285285
} else { //Should be bidir
286286
fprintf(Echo, "\t\t\t\ttype bidir wire_switch %s arch_opin_switch %s\n",
287-
arch->Switches[seg.arch_wire_switch].name,
288-
arch->Switches[seg.arch_opin_switch].name);
287+
arch->Switches[seg.arch_wire_switch].name.c_str(),
288+
arch->Switches[seg.arch_opin_switch].name.c_str());
289289
}
290290

291291
fprintf(Echo, "\t\t\t\tcb ");

libs/libarchfpga/src/parse_switchblocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ static void parse_switch_override(const char* switch_override, t_wireconn_inf& w
350350

351351
// iterate through the valid switch names in the arch looking for the requested switch_override
352352
for (int i = 0; i < num_switches; i++) {
353-
if (0 == strcmp(switch_override, switches[i].name)) {
353+
if (0 == strcmp(switch_override, switches[i].name.c_str())) {
354354
wireconn.switch_override_indx = i;
355355
return;
356356
}

libs/libarchfpga/src/physical_types.h

Lines changed: 66 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#include <unordered_map>
3636
#include <limits>
3737
#include <numeric>
38+
#include <set>
39+
#include <unordered_set>
3840

3941
#include "vtr_ndmatrix.h"
4042
#include "vtr_hash.h"
@@ -454,6 +456,28 @@ struct t_class_range {
454456
int total_num() const {
455457
return high - low + 1;
456458
}
459+
460+
t_class_range() = default;
461+
462+
t_class_range(int low_class_num, int high_class_num)
463+
: low(low_class_num)
464+
, high(high_class_num) {}
465+
};
466+
467+
// Struct to hold the pin ranges for a specific sub block
468+
struct t_pin_range {
469+
int low = 0;
470+
int high = 0;
471+
// Returns the total number of pins
472+
int total_num() const {
473+
return high - low + 1;
474+
}
475+
476+
t_pin_range() = default;
477+
478+
t_pin_range(int low_class_num, int high_class_num)
479+
: low(low_class_num)
480+
, high(high_class_num) {}
457481
};
458482

459483
enum e_power_wire_type {
@@ -617,14 +641,21 @@ struct t_physical_tile_type {
617641

618642
std::vector<t_class> class_inf; /* [0..num_class-1] */
619643

620-
std::unordered_map<int, t_class> internal_class_inf;
644+
// Primitive class is refered to a classes that are in the primitive blocks. These classes are
645+
// used during flat-routing to route the nets.
646+
// The starting number of primitive classes
647+
int primitive_class_starting_idx = -1;
648+
std::unordered_map<int, t_class> primitive_class_inf; // [primitive_class_num] -> primitive_class_inf
621649

622-
std::vector<int> pin_width_offset; // [0..num_pins-1]
623-
std::vector<int> pin_height_offset; // [0..num_pins-1]
624-
std::vector<int> pin_class; // [0..num_pins-1]
625-
std::unordered_map<int, int> internal_pin_class;
626-
std::vector<bool> is_ignored_pin; // [0..num_pins-1]
627-
std::vector<bool> is_pin_global; // [0..num_pins-1]
650+
std::vector<int> pin_width_offset; // [0..num_pins-1]
651+
std::vector<int> pin_height_offset; // [0..num_pins-1]
652+
std::vector<int> pin_class; // [0..num_pins-1]
653+
std::unordered_map<int, int> primitive_pin_class; // [primitive_pin_num] -> primitive_class_num
654+
std::vector<bool> is_ignored_pin; // [0..num_pins-1]
655+
std::vector<bool> is_pin_global; // [0..num_pins-1]
656+
657+
std::unordered_map<int, std::unordered_map<t_logical_block_type_ptr, t_pb_graph_pin*>> on_tile_pin_num_to_pb_pin; // [root_pin_physical_num][logical_block] -> t_pb_graph_pin*
658+
std::unordered_map<int, t_pb_graph_pin*> pin_num_to_pb_pin; // [intra_tile_pin_physical_num] -> t_pb_graph_pin
628659

629660
std::vector<t_fc_specification> fc_specs;
630661

@@ -730,10 +761,10 @@ struct t_sub_tile {
730761
///>E.g.: capacity can range from 4 to 7, meaning that there are four placeable sub tiles
731762
///> at a physical location, and compatible netlist blocks can be placed at sub_tile
732763
///> indices ranging from 4 to 7.
733-
t_class_range class_range;
764+
t_class_range class_range; // Range of the root-level classes
734765

735-
std::vector<std::unordered_map<t_logical_block_type_ptr, int>> starting_internal_class_idx;
736-
std::vector<std::unordered_map<t_logical_block_type_ptr, int>> starting_internal_pin_idx;
766+
std::vector<std::unordered_map<t_logical_block_type_ptr, t_class_range>> primitive_class_range; // [rel_cap][logical_block_ptr] -> class_range
767+
std::vector<std::unordered_map<t_logical_block_type_ptr, t_pin_range>> intra_pin_range; // [rel_cap][logical_block_ptr] -> intra_pin_range
737768

738769
int num_phy_pins = 0;
739770

@@ -832,7 +863,7 @@ struct t_physical_tile_port {
832863
* the logical block. The key of this map is the logical number of the pin, and the value is a pointer to the
833864
* corresponding pb_graph_pin
834865
*
835-
* pb_pin_to_class_logical_num_mapping: Maps each pin to its corresponding class's logical number. To retrieve the actual class, use this number as an
866+
* primitive_pb_pin_to_logical_class_num_mapping: Maps each pin to its corresponding class's logical number. To retrieve the actual class, use this number as an
836867
* index to logical_class_inf.
837868
*
838869
* logical_class_inf: Contains all the classes inside the logical block. The index of each class is the logical number associate with the class.
@@ -859,9 +890,10 @@ struct t_logical_block_type {
859890
std::vector<t_physical_tile_type_ptr> equivalent_tiles; ///>List of physical tiles at which one could
860891
///>place this type of netlist block.
861892

862-
std::unordered_map<int, const t_pb_graph_pin*> pin_logical_num_to_pb_pin_mapping; /* pin_logical_num_to_pb_pin_mapping[pin logical number] -> pb_graph_pin ptr} */
863-
std::unordered_map<const t_pb_graph_pin*, int> pb_pin_to_class_logical_num_mapping; /* pb_pin_to_class_logical_num_mapping[pb_graph_pin ptr] -> class logical number */
864-
std::vector<t_class> logical_class_inf; /* logical_class_inf[class_logical_number] -> class */
893+
std::unordered_map<int, t_pb_graph_pin*> pin_logical_num_to_pb_pin_mapping; /* pin_logical_num_to_pb_pin_mapping[pin logical number] -> pb_graph_pin ptr} */
894+
std::unordered_map<const t_pb_graph_pin*, int> primitive_pb_pin_to_logical_class_num_mapping; /* primitive_pb_pin_to_logical_class_num_mapping[pb_graph_pin ptr] -> class logical number */
895+
std::vector<t_class> primitive_logical_class_inf; /* primitive_logical_class_inf[class_logical_number] -> class */
896+
std::unordered_map<const t_pb_graph_node*, t_class_range> pb_graph_node_class_range;
865897

866898
// Is this t_logical_block_type empty?
867899
bool is_empty() const;
@@ -944,6 +976,8 @@ struct t_pb_type {
944976
t_pin_to_pin_annotation* annotations = nullptr; /* [0..num_annotations-1] */
945977
int num_annotations = 0;
946978

979+
int index_in_logical_block = 0; /* assign a unique id to each pb_type in a logical block */
980+
947981
/* Power related members */
948982
t_pb_type_power* pb_type_power = nullptr;
949983

@@ -1185,6 +1219,8 @@ class t_pb_graph_node {
11851219
* */
11861220
std::vector<int> illegal_modes;
11871221

1222+
t_pin_range pin_num_range;
1223+
11881224
t_pb_graph_pin** input_pins; /* [0..num_input_ports-1] [0..num_port_pins-1]*/
11891225
t_pb_graph_pin** output_pins; /* [0..num_output_ports-1] [0..num_port_pins-1]*/
11901226
t_pb_graph_pin** clock_pins; /* [0..num_clock_ports-1] [0..num_port_pins-1]*/
@@ -1260,6 +1296,9 @@ class t_pb_graph_pin {
12601296
int pin_number = 0;
12611297
std::vector<t_pb_graph_edge*> input_edges; /* [0..num_input_edges] */
12621298
int num_input_edges = 0;
1299+
// This map is initialized only if flat_routing is enabled
1300+
std::unordered_map<const t_pb_graph_pin*, int> sink_pin_edge_idx_map; /* [t_pb_graph_pin*] -> edge_idx - This is the index of the corresponding edge stored in output_edges vector */
1301+
12631302
std::vector<t_pb_graph_edge*> output_edges; /* [0..num_output_edges] */
12641303
int num_output_edges = 0;
12651304

@@ -1277,6 +1316,13 @@ class t_pb_graph_pin {
12771316
float tco_max = std::numeric_limits<float>::quiet_NaN(); /* For sequential logic elements the maximum clock to output time */
12781317
t_pb_graph_pin* associated_clock_pin = nullptr; /* For sequentail elements, the associated clock */
12791318

1319+
/* This member is used when flat-routing and has_choking_spot are enabled.
1320+
* It is used to identify choke points.
1321+
* This is only valid for IPINs, and it only contain the pins that are reachable to the pin by a forwarding path.
1322+
* It doesn't take into account feed-back connection.
1323+
* */
1324+
std::unordered_set<int> connected_sinks_ptc; /* ptc numbers of sinks which are directly or indirectly connected to this pin */
1325+
12801326
/* combinational timing information */
12811327
int num_pin_timing = 0; /* Number of ipin to opin timing edges*/
12821328
std::vector<t_pb_graph_pin*> pin_timing; /* timing edge sink pins [0..num_pin_timing-1]*/
@@ -1360,6 +1406,8 @@ class t_pb_graph_edge {
13601406
int* pack_pattern_indices;
13611407
bool infer_pattern;
13621408

1409+
int switch_type_idx = OPEN; /* architecture switch id of the edge - used when flat_routing is enabled */
1410+
13631411
// class member functions
13641412
public:
13651413
// Returns true is this edge is annotated with the given pattern_index
@@ -1573,7 +1621,7 @@ struct t_arch_switch_inf {
15731621
public:
15741622
static constexpr int UNDEFINED_FANIN = -1;
15751623

1576-
char* name = nullptr;
1624+
std::string name;
15771625
float R = 0.;
15781626
float Cin = 0.;
15791627
float Cout = 0.;
@@ -1584,6 +1632,8 @@ struct t_arch_switch_inf {
15841632
e_power_buffer_type power_buffer_type = POWER_BUFFER_TYPE_AUTO;
15851633
float power_buffer_size = 0.;
15861634

1635+
bool intra_tile = false;
1636+
15871637
public:
15881638
//Returns the type of switch
15891639
SwitchType type() const;
@@ -1644,7 +1694,7 @@ struct t_rr_switch_inf {
16441694
float Tdel = 0.;
16451695
float mux_trans_size = 0.;
16461696
float buf_size = 0.;
1647-
const char* name = nullptr;
1697+
std::string name;
16481698
e_power_buffer_type power_buffer_type = POWER_BUFFER_TYPE_UNDEFINED;
16491699
float power_buffer_size = 0.;
16501700

0 commit comments

Comments
 (0)