Skip to content

Commit d2c64e7

Browse files
second round of updating the base code to be consistent with .clang-format file
1 parent d0e656a commit d2c64e7

File tree

113 files changed

+1186
-1340
lines changed

Some content is hidden

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

113 files changed

+1186
-1340
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: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
* @param noc_ref To be filled with NoC router locations and their connectivity.
1919
*/
2020
static void process_topology(pugi::xml_node topology_tag,
21-
const pugiutil::loc_data& loc_data,
22-
t_noc_inf* noc_ref);
21+
const pugiutil::loc_data& loc_data,
22+
t_noc_inf* noc_ref);
2323

2424
/**
2525
* @brief Process a <router> tag under a <topology> tag.
@@ -50,8 +50,8 @@ static void process_router(pugi::xml_node router_tag,
5050
* @param noc_ref To be filled with NoC router locations and their connectivity.
5151
*/
5252
static void process_mesh_topology(pugi::xml_node mesh_topology_tag,
53-
const pugiutil::loc_data& loc_data, t_noc_inf* noc_ref);
54-
53+
const pugiutil::loc_data& loc_data,
54+
t_noc_inf* noc_ref);
5555

5656
/**
5757
* Create routers and set their properties so that a mesh grid of routers is created.
@@ -69,9 +69,12 @@ static void process_mesh_topology(pugi::xml_node mesh_topology_tag,
6969
static void generate_noc_mesh(pugi::xml_node mesh_topology_tag,
7070
const pugiutil::loc_data& loc_data,
7171
t_noc_inf* noc_ref,
72-
float mesh_region_start_x, float mesh_region_end_x,
73-
float mesh_region_start_y, float mesh_region_end_y,
74-
int mesh_region_start_layer, int mesh_region_end_layer,
72+
float mesh_region_start_x,
73+
float mesh_region_end_x,
74+
float mesh_region_start_y,
75+
float mesh_region_end_y,
76+
int mesh_region_start_layer,
77+
int mesh_region_end_layer,
7578
int mesh_size);
7679

7780
/**
@@ -153,7 +156,6 @@ void process_noc_tag(pugi::xml_node noc_tag,
153156

154157
const std::vector<std::string> expected_noc_children_tags = {"mesh", "topology"};
155158

156-
157159
// identifier that lets us know when we could not properly convert a string conversion value
158160
std::string attribute_conversion_failure_string;
159161

@@ -270,9 +272,12 @@ static void process_mesh_topology(pugi::xml_node mesh_topology_tag,
270272
static void generate_noc_mesh(pugi::xml_node mesh_topology_tag,
271273
const pugiutil::loc_data& loc_data,
272274
t_noc_inf* noc_ref,
273-
float mesh_region_start_x, float mesh_region_end_x,
274-
float mesh_region_start_y, float mesh_region_end_y,
275-
int mesh_region_start_layer, int mesh_region_end_layer,
275+
float mesh_region_start_x,
276+
float mesh_region_end_x,
277+
float mesh_region_start_y,
278+
float mesh_region_end_y,
279+
int mesh_region_start_layer,
280+
int mesh_region_end_layer,
276281
int mesh_size) {
277282
// check that the mesh size of the router is not 0
278283
if (mesh_size == 0) {
@@ -306,8 +311,7 @@ static void generate_noc_mesh(pugi::xml_node mesh_topology_tag,
306311
float horizontal_router_separation = (mesh_region_end_x - mesh_region_start_x) / (mesh_size - 1);
307312

308313
// improper region check
309-
if (vertical_router_separation <= 0 || horizontal_router_separation <= 0 ||
310-
mesh_region_end_layer < mesh_region_start_layer) {
314+
if (vertical_router_separation <= 0 || horizontal_router_separation <= 0 || mesh_region_end_layer < mesh_region_start_layer) {
311315
archfpga_throw(loc_data.filename_c_str(), loc_data.line(mesh_topology_tag),
312316
"The NoC region is invalid.");
313317
}
@@ -378,8 +382,8 @@ static void generate_noc_mesh(pugi::xml_node mesh_topology_tag,
378382
* Go through each router in the NoC and store the list of routers that connect to it.
379383
*/
380384
static void process_topology(pugi::xml_node topology_tag,
381-
const pugiutil::loc_data& loc_data,
382-
t_noc_inf* noc_ref) {
385+
const pugiutil::loc_data& loc_data,
386+
t_noc_inf* noc_ref) {
383387
// The topology tag should have no attributes, check that
384388
pugiutil::expect_only_attributes(topology_tag, {}, loc_data);
385389

@@ -652,8 +656,7 @@ static void process_noc_overrides(pugi::xml_node noc_overrides_tag,
652656
}
653657

654658
auto it = std::find_if(noc_ref.router_list.begin(), noc_ref.router_list.end(), [src, dst](const t_router& router) {
655-
return router.id == src &&
656-
std::find(router.connection_list.begin(), router.connection_list.end(), dst) != router.connection_list.end();
659+
return router.id == src && std::find(router.connection_list.begin(), router.connection_list.end(), dst) != router.connection_list.end();
657660
});
658661

659662
if (it == noc_ref.router_list.end()) {
@@ -667,14 +670,14 @@ static void process_noc_overrides(pugi::xml_node noc_overrides_tag,
667670
double latency = std::atof(link_latency_override);
668671
if (latency <= 0.0) {
669672
archfpga_throw(loc_data.filename_c_str(), loc_data.line(override_tag),
670-
"The override link latency value for link (%d, %d) must be positive:%g." ,
673+
"The override link latency value for link (%d, %d) must be positive:%g.",
671674
src, dst, latency);
672675
}
673676

674677
auto [_, success] = noc_ref.link_latency_overrides.insert({{src, dst}, latency});
675678
if (!success) {
676679
archfpga_throw(loc_data.filename_c_str(), loc_data.line(override_tag),
677-
"The latency for link (%d, %d) was overridden once before." ,
680+
"The latency for link (%d, %d) was overridden once before.",
678681
src, dst);
679682
}
680683
}
@@ -684,14 +687,14 @@ static void process_noc_overrides(pugi::xml_node noc_overrides_tag,
684687
double bandwidth = std::atof(link_latency_override);
685688
if (bandwidth <= 0.0) {
686689
archfpga_throw(loc_data.filename_c_str(), loc_data.line(override_tag),
687-
"The override link bandwidth value for link (%d, %d) must be positive:%g." ,
690+
"The override link bandwidth value for link (%d, %d) must be positive:%g.",
688691
src, dst, bandwidth);
689692
}
690693

691694
auto [_, success] = noc_ref.link_bandwidth_overrides.insert({{src, dst}, bandwidth});
692695
if (!success) {
693696
archfpga_throw(loc_data.filename_c_str(), loc_data.line(override_tag),
694-
"The bandwidth for link (%d, %d) was overridden once before." ,
697+
"The bandwidth for link (%d, %d) was overridden once before.",
695698
src, dst);
696699
}
697700
}

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 & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,40 @@
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+
,
54+
// TODO: These two variables needed to be stored in the class since
55+
// the Placer stores a reference to these objects. These
56+
// should really be initialized and stored into the Placer
57+
// class directly.
58+
pb_gpin_lookup_(g_vpr_ctx.device().logical_block_types)
59+
, netlist_pin_lookup_(clustered_netlist, atom_netlist, pb_gpin_lookup_) {
6260
// Initialize the place delay model.
6361
// TODO: This initialization is complicated. Should be moved within create_delay_model
6462
// or something.
@@ -106,4 +104,3 @@ void AnnealerDetailedPlacer::optimize_placement() {
106104
// clusters.
107105
post_place_sync();
108106
}
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)