Skip to content

Commit ba2c1dd

Browse files
authored
Merge pull request #2933 from verilog-to-routing/temp_format_try2
Another update of the code base to be consistent with code formatting rules
2 parents d0e656a + 53a5877 commit ba2c1dd

File tree

115 files changed

+1255
-1408
lines changed

Some content is hidden

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

115 files changed

+1255
-1408
lines changed

libs/libarchfpga/src/device_grid.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ struct t_grid_tile {
1919
const t_metadata_dict* meta = nullptr;
2020
};
2121

22-
2322
//TODO: All of the functions that use helper functions of this class should pass the layer_num to the functions, and the default value of layer_num should be deleted eventually.
2423
/**
2524
* @class DeviceGrid

libs/libarchfpga/src/physical_types.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,6 @@ struct t_physical_tile_type {
703703
* tile_block_pin_directs_map[logical block index][logical block pin] -> physical tile pin */
704704
std::unordered_map<int, std::unordered_map<int, vtr::bimap<t_logical_pin, t_physical_pin>>> tile_block_pin_directs_map;
705705

706-
707-
708706
// TODO: Remove is_input_type / is_output_type as part of
709707
// https://github.com/verilog-to-routing/vtr-verilog-to-routing/issues/1193
710708

@@ -714,7 +712,7 @@ struct t_physical_tile_type {
714712
// Does this t_physical_tile_type contain an outpad?
715713
bool is_output_type = false;
716714

717-
public: // Function members
715+
public: // Function members
718716
///@brief Returns the indices of pins that contain a clock for this physical logic block
719717
std::vector<int> get_clock_pins_indices() const;
720718

@@ -1280,8 +1278,8 @@ struct t_pin_to_pin_annotation {
12801278
* flat_site_index : Index of this primitive site within its primitive type within this cluster type.
12811279
* Values are in [0...total_primitive_count-1], e.g. if there are 10 ALMs per cluster, 2 FFS
12821280
* and 2 LUTs per ALM, then flat site indices for FFs would run from 0 to 19, and flat site
1283-
indices for LUTs would run from 0 to 19. This member is only used by nodes corresponding
1284-
to primitive sites. It is used when reconstructing clusters from a flat placement file.
1281+
* indices for LUTs would run from 0 to 19. This member is only used by nodes corresponding
1282+
* to primitive sites. It is used when reconstructing clusters from a flat placement file.
12851283
* illegal_modes : vector containing illegal modes that result in conflicts during routing
12861284
*/
12871285
class t_pb_graph_node {
@@ -1335,7 +1333,7 @@ class t_pb_graph_node {
13351333

13361334
int total_pb_pins; /* only valid for top-level */
13371335

1338-
void* temp_scratch_pad; /* temporary data, useful for keeping track of things when traversing data structure */
1336+
void* temp_scratch_pad; /* temporary data, useful for keeping track of things when traversing data structure */
13391337

13401338
int* input_pin_class_size; /* Stores the number of pins that belong to a particular input pin class */
13411339
int num_input_pin_class; /* number of input pin classes that this pb_graph_node has */
@@ -1345,7 +1343,6 @@ class t_pb_graph_node {
13451343
int total_primitive_count; /* total number of this primitive type in the cluster */
13461344
int flat_site_index; /* index of this primitive within sites of its type in this cluster */
13471345

1348-
13491346
/* Interconnect instances for this pb
13501347
* Only used for power
13511348
*/
@@ -1988,7 +1985,7 @@ struct t_switchblock_inf {
19881985
/* We can also define a region to apply this SB to all locations falls into this region using regular expression in the architecture file*/
19891986
t_sb_loc_spec reg_x;
19901987
t_sb_loc_spec reg_y;
1991-
1988+
19921989
t_permutation_map permutation_map; /* map holding the permutation functions attributed to this switchblock */
19931990

19941991
std::vector<t_wireconn_inf> wireconns; /* list of wire types/groups this SB will connect */
@@ -2145,11 +2142,11 @@ struct t_arch {
21452142
std::vector<std::string> ipin_cblock_switch_name;
21462143

21472144
std::vector<t_grid_def> grid_layouts; //Set of potential device layouts
2148-
2145+
21492146
//the layout that is chosen to be used with command line options
21502147
//It is used to generate custom SB for a specific locations within the device
21512148
//If the layout is not specified in the command line options, this variable will be set to "auto"
2152-
std::string device_layout;
2149+
std::string device_layout;
21532150

21542151
t_clock_arch_spec clock_arch; // Clock related data types
21552152

libs/libarchfpga/src/read_xml_arch_file_noc_tag.cpp

Lines changed: 46 additions & 61 deletions
Large diffs are not rendered by default.

libs/libarchfpga/src/read_xml_arch_file_noc_tag.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,25 @@ void process_noc_tag(pugi::xml_node noc_tag,
1717
t_arch* arch,
1818
const pugiutil::loc_data& loc_data);
1919

20+
/**
21+
* @brief Describes a mesh topology as specified in the architecture file.
22+
* It is assumed that NoC routers are equally distanced in each axis.
23+
*/
24+
struct t_mesh_region {
25+
/// The location the bottom left NoC router on the X-axis.
26+
float start_x;
27+
/// The location the top right NoC router on the X-axis.
28+
float end_x;
29+
/// The location the bottom left NoC router on the Y-axis.
30+
float start_y;
31+
/// The location the top right NoC router on the Y-axis.
32+
float end_y;
33+
/// The layer from which the mesh start.
34+
int start_layer;
35+
/// The layer at which the mesh ends.
36+
int end_layer;
37+
/// The number of NoC routers in each row or column.
38+
int mesh_size;
39+
};
40+
2041
#endif //VTR_READ_XML_ARCH_FILE_NOC_TAG_H

libs/libarchfpga/test/test_read_xml_arch_file.cpp

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -148,31 +148,33 @@ TEST_CASE("Verifying mesh topology creation", "[NoC Arch Tests]") {
148148
t_noc_inf test_noc;
149149

150150
// mesh parameters
151-
float mesh_start_x = 10;
152-
float mesh_start_y = 10;
153-
float mesh_end_x = 5;
154-
float mesh_end_y = 56;
155-
float mesh_size = 0;
156-
int mesh_start_layer = 0;
157-
int mesh_end_layer = 0;
151+
t_mesh_region mesh_region{
152+
.start_x = 10.0f,
153+
.end_x = 5.0f,
154+
.start_y = 10.0f,
155+
.end_y = 56.0f,
156+
.start_layer = 0,
157+
.end_layer = 0,
158+
.mesh_size = 0
159+
};
158160

159161
SECTION("Check the error where a mesh size was illegal.") {
160-
REQUIRE_THROWS_WITH(generate_noc_mesh(test, test_location, &test_noc, mesh_start_x, mesh_end_x, mesh_start_y, mesh_end_y, mesh_start_layer, mesh_end_layer, mesh_size), "The NoC mesh size cannot be 0.");
162+
REQUIRE_THROWS_WITH(generate_noc_mesh(test, test_location, &test_noc, mesh_region), "The NoC mesh size cannot be 0.");
161163
}
162164
SECTION("Check the error where a mesh region size was invalid.") {
163-
mesh_size = 3;
165+
mesh_region.mesh_size = 3;
164166

165-
REQUIRE_THROWS_WITH(generate_noc_mesh(test, test_location, &test_noc, mesh_start_x, mesh_end_x, mesh_start_y, mesh_end_y, mesh_start_layer, mesh_end_layer, mesh_size), "The NoC region is invalid.");
167+
REQUIRE_THROWS_WITH(generate_noc_mesh(test, test_location, &test_noc, mesh_region), "The NoC region is invalid.");
166168
}
167169
SECTION("Check the mesh creation for integer precision coordinates.") {
168170
// define test parameters
169-
mesh_size = 3;
171+
mesh_region.mesh_size = 3;
170172

171-
mesh_start_x = 0;
172-
mesh_start_y = 0;
173+
mesh_region.start_x = 0;
174+
mesh_region.start_y = 0;
173175

174-
mesh_end_x = 4;
175-
mesh_end_y = 4;
176+
mesh_region.end_x = 4;
177+
mesh_region.end_y = 4;
176178

177179
// create the golden results
178180
float golden_results_x[9];
@@ -202,10 +204,10 @@ TEST_CASE("Verifying mesh topology creation", "[NoC Arch Tests]") {
202204
golden_results_x[8] = 4;
203205
golden_results_y[8] = 4;
204206

205-
generate_noc_mesh(test, test_location, &test_noc, mesh_start_x, mesh_end_x, mesh_start_y, mesh_end_y, mesh_start_layer, mesh_end_layer, mesh_size);
207+
generate_noc_mesh(test, test_location, &test_noc, mesh_region);
206208

207209
// go through all the expected routers
208-
for (int expected_router_id = 0; expected_router_id < (mesh_size * mesh_size); expected_router_id++) {
210+
for (int expected_router_id = 0; expected_router_id < (mesh_region.mesh_size * mesh_region.mesh_size); expected_router_id++) {
209211
// make sure the router ids match
210212
REQUIRE(test_noc.router_list[expected_router_id].id == expected_router_id);
211213

@@ -218,13 +220,13 @@ TEST_CASE("Verifying mesh topology creation", "[NoC Arch Tests]") {
218220
}
219221
SECTION("Check the mesh creation for double precision coordinates.") {
220222
// define test parameters
221-
mesh_size = 3;
223+
mesh_region.mesh_size = 3;
222224

223-
mesh_start_x = 3.5;
224-
mesh_start_y = 5.7;
225+
mesh_region.start_x = 3.5;
226+
mesh_region.start_y = 5.7;
225227

226-
mesh_end_x = 10.8;
227-
mesh_end_y = 6.4;
228+
mesh_region.end_x = 10.8;
229+
mesh_region.end_y = 6.4;
228230

229231
// create the golden results
230232
float golden_results_x[9];
@@ -254,10 +256,10 @@ TEST_CASE("Verifying mesh topology creation", "[NoC Arch Tests]") {
254256
golden_results_x[8] = 10.8;
255257
golden_results_y[8] = 6.4;
256258

257-
generate_noc_mesh(test, test_location, &test_noc, mesh_start_x, mesh_end_x, mesh_start_y, mesh_end_y, mesh_start_layer, mesh_end_layer, mesh_size);
259+
generate_noc_mesh(test, test_location, &test_noc, mesh_region);
258260

259261
// go through all the expected routers
260-
for (int expected_router_id = 0; expected_router_id < (mesh_size * mesh_size); expected_router_id++) {
262+
for (int expected_router_id = 0; expected_router_id < (mesh_region.mesh_size * mesh_region.mesh_size); expected_router_id++) {
261263
// make sure the router ids match
262264
REQUIRE(test_noc.router_list[expected_router_id].id == expected_router_id);
263265

vpr/src/analytical_place/analytical_solver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static inline void update_linear_system_with_anchors(Eigen::SparseMatrix<double>
265265
PartialPlacement& p_placement,
266266
size_t num_moveable_blocks,
267267
vtr::vector<APRowId, APBlockId> row_id_to_blk_id,
268-
unsigned iteration) {
268+
unsigned iteration) {
269269
// Anchor weights grow exponentially with iteration.
270270
double coeff_pseudo_anchor = 0.01 * std::exp((double)iteration / 5);
271271
for (size_t row_id_idx = 0; row_id_idx < num_moveable_blocks; row_id_idx++) {

vpr/src/analytical_place/detailed_placer.cpp

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,39 @@
2323
#include "vpr_types.h"
2424
#include "vpr_utils.h"
2525

26-
std::unique_ptr<DetailedPlacer> make_detailed_placer(
27-
e_ap_detailed_placer detailed_placer_type,
28-
const BlkLocRegistry& curr_clustered_placement,
29-
const AtomNetlist& atom_netlist,
30-
const ClusteredNetlist& clustered_netlist,
31-
t_vpr_setup& vpr_setup,
32-
const t_arch& arch) {
26+
std::unique_ptr<DetailedPlacer> make_detailed_placer(e_ap_detailed_placer detailed_placer_type,
27+
const BlkLocRegistry& curr_clustered_placement,
28+
const AtomNetlist& atom_netlist,
29+
const ClusteredNetlist& clustered_netlist,
30+
t_vpr_setup& vpr_setup,
31+
const t_arch& arch) {
3332
switch (detailed_placer_type) {
3433
case e_ap_detailed_placer::Identity:
3534
return std::make_unique<IdentityDetailedPlacer>();
3635
case e_ap_detailed_placer::Annealer:
37-
return std::make_unique<AnnealerDetailedPlacer>(
38-
curr_clustered_placement,
39-
atom_netlist,
40-
clustered_netlist,
41-
vpr_setup,
42-
arch);
36+
return std::make_unique<AnnealerDetailedPlacer>(curr_clustered_placement,
37+
atom_netlist,
38+
clustered_netlist,
39+
vpr_setup,
40+
arch);
4341
default:
4442
VPR_FATAL_ERROR(VPR_ERROR_AP,
4543
"Unrecognized detailed placer type");
4644
}
4745
}
4846

49-
AnnealerDetailedPlacer::AnnealerDetailedPlacer(
50-
const BlkLocRegistry& curr_clustered_placement,
51-
const AtomNetlist& atom_netlist,
52-
const ClusteredNetlist& clustered_netlist,
53-
t_vpr_setup& vpr_setup,
54-
const t_arch& arch)
55-
: DetailedPlacer(),
56-
// TODO: These two variables needed to be stored in the class since
57-
// the Placer stores a reference to these objects. These
58-
// should really be initialized and stored into the Placer
59-
// class directly.
60-
pb_gpin_lookup_(g_vpr_ctx.device().logical_block_types),
61-
netlist_pin_lookup_(clustered_netlist, atom_netlist, pb_gpin_lookup_) {
47+
AnnealerDetailedPlacer::AnnealerDetailedPlacer(const BlkLocRegistry& curr_clustered_placement,
48+
const AtomNetlist& atom_netlist,
49+
const ClusteredNetlist& clustered_netlist,
50+
t_vpr_setup& vpr_setup,
51+
const t_arch& arch)
52+
: DetailedPlacer()
53+
// TODO: These two variables needed to be stored in the class since
54+
// the Placer stores a reference to these objects. These
55+
// should really be initialized and stored into the Placer
56+
// class directly.
57+
, pb_gpin_lookup_(g_vpr_ctx.device().logical_block_types)
58+
, netlist_pin_lookup_(clustered_netlist, atom_netlist, pb_gpin_lookup_) {
6259
// Initialize the place delay model.
6360
// TODO: This initialization is complicated. Should be moved within create_delay_model
6461
// or something.
@@ -102,8 +99,7 @@ void AnnealerDetailedPlacer::optimize_placement() {
10299
// Copy the placement solution into the global placement solution.
103100
placer_->copy_locs_to_global_state(g_vpr_ctx.mutable_placement());
104101

105-
// Since the placement was modified, need to resyncronize the pins in the
102+
// Since the placement was modified, need to resynchronize the pins in the
106103
// clusters.
107104
post_place_sync();
108105
}
109-

vpr/src/analytical_place/detailed_placer.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* flow).
2323
*/
2424
class DetailedPlacer {
25-
public:
25+
public:
2626
virtual ~DetailedPlacer() {}
2727

2828
DetailedPlacer() = default;
@@ -36,14 +36,12 @@ class DetailedPlacer {
3636
/**
3737
* @brief A factory method which creates a Detailed Placer of the given type.
3838
*/
39-
std::unique_ptr<DetailedPlacer> make_detailed_placer(
40-
e_ap_detailed_placer detailed_placer_type,
41-
const BlkLocRegistry& curr_clustered_placement,
42-
const AtomNetlist& atom_netlist,
43-
const ClusteredNetlist& clustered_netlist,
44-
t_vpr_setup& vpr_setup,
45-
const t_arch& arch);
46-
39+
std::unique_ptr<DetailedPlacer> make_detailed_placer(e_ap_detailed_placer detailed_placer_type,
40+
const BlkLocRegistry& curr_clustered_placement,
41+
const AtomNetlist& atom_netlist,
42+
const ClusteredNetlist& clustered_netlist,
43+
t_vpr_setup& vpr_setup,
44+
const t_arch& arch);
4745

4846
/**
4947
* @brief The Identity Detailed Placer.
@@ -53,7 +51,7 @@ std::unique_ptr<DetailedPlacer> make_detailed_placer(
5351
* with.
5452
*/
5553
class IdentityDetailedPlacer : public DetailedPlacer {
56-
public:
54+
public:
5755
using DetailedPlacer::DetailedPlacer;
5856

5957
void optimize_placement() final {}
@@ -71,7 +69,7 @@ class IdentityDetailedPlacer : public DetailedPlacer {
7169
* stage. So options passed to the Placer will be used in here.
7270
*/
7371
class AnnealerDetailedPlacer : public DetailedPlacer {
74-
public:
72+
public:
7573
/**
7674
* @brief Construct the Annealer Detailed Placer class.
7775
*
@@ -98,7 +96,7 @@ class AnnealerDetailedPlacer : public DetailedPlacer {
9896
*/
9997
void optimize_placement() final;
10098

101-
private:
99+
private:
102100
/// @brief The placer class, which contains the annealer.
103101
std::unique_ptr<Placer> placer_;
104102

@@ -108,4 +106,3 @@ class AnnealerDetailedPlacer : public DetailedPlacer {
108106
/// @brief A lookup between CLB pins and atom pins.
109107
ClusteredPinAtomPinsLookup netlist_pin_lookup_;
110108
};
111-

vpr/src/analytical_place/flat_placement_bins.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ typedef vtr::StrongId<flat_placement_bin_tag, size_t> FlatPlacementBinId;
4242
* higher level classes.
4343
*/
4444
class FlatPlacementBins {
45-
public:
45+
public:
4646
// Iterator for the flat placement bin IDs
4747
typedef typename vtr::vector_map<FlatPlacementBinId, FlatPlacementBinId>::const_iterator bin_iterator;
4848

@@ -110,7 +110,8 @@ class FlatPlacementBins {
110110
*/
111111
inline const vtr::Rect<double>& bin_region(FlatPlacementBinId bin_id) const {
112112
VTR_ASSERT(bin_id.is_valid());
113-
return bin_region_[bin_id];;
113+
return bin_region_[bin_id];
114+
;
114115
}
115116

116117
/**
@@ -179,7 +180,7 @@ class FlatPlacementBins {
179180
return true;
180181
}
181182

182-
private:
183+
private:
183184
/// @brief A vector of the Flat Placement Bin IDs. If any of them are invalid,
184185
/// then that means that the bin has been destroyed.
185186
vtr::vector_map<FlatPlacementBinId, FlatPlacementBinId> bin_ids_;
@@ -194,4 +195,3 @@ class FlatPlacementBins {
194195
// TODO: For 3D FPGAs, this should be a 3D rectangle.
195196
vtr::vector_map<FlatPlacementBinId, vtr::Rect<double>> bin_region_;
196197
};
197-

0 commit comments

Comments
 (0)