Skip to content

Commit dfb6462

Browse files
Fix minor styling issues
1 parent 0e6f62a commit dfb6462

7 files changed

+67
-66
lines changed

vpr/src/base/atom_lookup.h

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class AtomLookup {
3131
* PBs
3232
*/
3333

34-
3534
/**
3635
* @brief Sets the atom to pb bimap access lock to value.
3736
* If set to true, access to the bimap is prohibited and will result in failing assertions.
@@ -41,11 +40,10 @@ class AtomLookup {
4140
inline void set_atom_pb_bimap_lock(bool value) {
4241
VTR_ASSERT_SAFE_MSG(lock_atom_pb_bimap_ != value, "Double locking or unlocking the atom pb bimap lock");
4342
lock_atom_pb_bimap_ = value;
44-
}
45-
46-
/// @brief Gets the current atom to pb bimap lock value.
47-
inline bool atom_pb_bimap_islocked() const {return lock_atom_pb_bimap_;}
43+
}
4844

45+
/// @brief Gets the current atom to pb bimap lock value.
46+
inline bool atom_pb_bimap_islocked() const { return lock_atom_pb_bimap_; }
4947

5048
// All accesses, mutable or immutable, to the atom to pb bimap
5149
// will result in failing assertions if the lock is set to true.
@@ -55,18 +53,24 @@ class AtomLookup {
5553

5654
/// @brief Returns a mutable reference to the atom to pb bimap, provided that access to it is unlocked. It will result in a crash otherwise.
5755
/// @return Mutable reference to the atom pb bimap.
58-
inline AtomPBBimap &mutable_atom_pb_bimap() {VTR_ASSERT(!lock_atom_pb_bimap_); return atom_to_pb_bimap_;}
56+
inline AtomPBBimap& mutable_atom_pb_bimap() {
57+
VTR_ASSERT(!lock_atom_pb_bimap_);
58+
return atom_to_pb_bimap_;
59+
}
5960

6061
/// @brief Returns an immutable reference to the atom to pb bimap, provided that access to it is unlocked. It will result in a crash otherwise.
6162
/// @return Immutable reference to the atom pb bimap.
62-
inline const AtomPBBimap &atom_pb_bimap() const {VTR_ASSERT(!lock_atom_pb_bimap_); return atom_to_pb_bimap_;}
63+
inline const AtomPBBimap& atom_pb_bimap() const {
64+
VTR_ASSERT(!lock_atom_pb_bimap_);
65+
return atom_to_pb_bimap_;
66+
}
6367

6468
/**
6569
* @brief Set atom to pb bimap
6670
*
6771
* @param atom_to_pb Reference to AtomPBBimab to be copied from
6872
*/
69-
void set_atom_to_pb_bimap(const AtomPBBimap& atom_to_pb){atom_to_pb_bimap_ = atom_to_pb;}
73+
void set_atom_to_pb_bimap(const AtomPBBimap& atom_to_pb) { atom_to_pb_bimap_ = atom_to_pb; }
7074

7175
/*
7276
* PB Pins
@@ -131,11 +135,10 @@ class AtomLookup {
131135

132136
private: //Types
133137
private:
134-
135-
/**
136-
* @brief Allows or disallows access to the AtomPBBimap data.
137-
* Useful to make sure global context is not accessed in places you don't want it to.
138-
*/
138+
/**
139+
* @brief Allows or disallows access to the AtomPBBimap data.
140+
* Useful to make sure global context is not accessed in places you don't want it to.
141+
*/
139142
bool lock_atom_pb_bimap_ = false;
140143
AtomPBBimap atom_to_pb_bimap_;
141144

vpr/src/pack/atom_pb_bimap.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ class t_pb_graph_node;
2323
* Used in the global AtomLookup context and in ClusterLegalizer
2424
*/
2525
class AtomPBBimap {
26-
public:
26+
public:
2727
AtomPBBimap() = default;
28-
AtomPBBimap(const vtr::bimap<AtomBlockId, const t_pb*, vtr::linear_map, std::unordered_map> &atom_to_pb);
29-
28+
AtomPBBimap(const vtr::bimap<AtomBlockId, const t_pb*, vtr::linear_map, std::unordered_map>& atom_to_pb);
3029

3130
/**
3231
* @brief Returns the leaf pb associated with the atom blk_id
@@ -53,7 +52,7 @@ class AtomPBBimap {
5352
/// @brief Returns if the bimap is empty
5453
bool is_empty() const;
5554

56-
private:
57-
/// @brief Two way map between AtomBlockIds and t_pb
58-
vtr::bimap<AtomBlockId, const t_pb*, vtr::linear_map, std::unordered_map> atom_to_pb_;
59-
};
55+
private:
56+
/// @brief Two way map between AtomBlockIds and t_pb
57+
vtr::bimap<AtomBlockId, const t_pb*, vtr::linear_map, std::unordered_map> atom_to_pb_;
58+
};

vpr/src/pack/cluster_legalizer.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
*/
4646
static void alloc_and_load_pb_stats(t_pb* pb) {
4747
/* Call this routine when starting to fill up a new cluster. It resets *
48-
* the gain vector, etc. */
48+
* the gain vector, etc. */
4949

5050
pb->pb_stats = new t_pb_stats;
5151

@@ -61,7 +61,7 @@ static void alloc_and_load_pb_stats(t_pb* pb) {
6161
* @brief Check the atom blocks of a cluster pb. Used in the verify method.
6262
*/
6363
/* TODO: May want to check that all atom blocks are actually reached */
64-
static void check_cluster_atom_blocks(t_pb* pb, std::unordered_set<AtomBlockId>& blocks_checked, const AtomPBBimap &atom_pb_lookup) {
64+
static void check_cluster_atom_blocks(t_pb* pb, std::unordered_set<AtomBlockId>& blocks_checked, const AtomPBBimap& atom_pb_lookup) {
6565
const AtomContext& atom_ctx = g_vpr_ctx.atom();
6666

6767
const t_pb_type* pb_type = pb->pb_graph_node->pb_type;
@@ -191,7 +191,7 @@ static bool check_cluster_floorplanning(AtomBlockId atom_blk_id,
191191
VTR_LOGV(log_verbosity > 3,
192192
"\t\t\t Intersect: Atom block %d passed cluster, cluster PR was updated with intersection result \n",
193193
atom_blk_id);
194-
return true;
194+
return true;
195195
}
196196

197197
/**
@@ -390,8 +390,8 @@ static bool primitive_memory_sibling_feasible(const AtomBlockId blk_id, const t_
390390
}
391391

392392
/*
393-
* @brief Check if the given atom is feasible in the given pb.
394-
*/
393+
* @brief Check if the given atom is feasible in the given pb.
394+
*/
395395
static bool primitive_feasible(const AtomBlockId blk_id, t_pb* cur_pb, const AtomPBBimap& atom_to_pb) {
396396
const t_pb_type* cur_pb_type = cur_pb->pb_graph_node->pb_type;
397397

@@ -408,7 +408,7 @@ static bool primitive_feasible(const AtomBlockId blk_id, t_pb* cur_pb, const Ato
408408
* - all siblings must share all nets, including open nets, with the exception of data nets */
409409

410410
/* find sibling if one exists */
411-
const t_pb *sibling_memory_pb = find_memory_sibling(cur_pb);
411+
const t_pb* sibling_memory_pb = find_memory_sibling(cur_pb);
412412
AtomBlockId sibling_memory_blk_id = atom_to_pb.pb_atom(sibling_memory_pb);
413413

414414
if (sibling_memory_blk_id) {
@@ -429,17 +429,17 @@ static bool primitive_feasible(const AtomBlockId blk_id, t_pb* cur_pb, const Ato
429429
*/
430430
static enum e_block_pack_status
431431
try_place_atom_block_rec(const t_pb_graph_node* pb_graph_node,
432-
const AtomBlockId blk_id,
433-
t_pb* cb,
434-
t_pb** parent,
435-
const LegalizationClusterId cluster_id,
436-
vtr::vector_map<AtomBlockId, LegalizationClusterId>& atom_cluster,
437-
const PackMoleculeId molecule_id,
438-
t_lb_router_data* router_data,
439-
int verbosity,
440-
const Prepacker& prepacker,
441-
const vtr::vector_map<MoleculeChainId, t_clustering_chain_info>& clustering_chain_info,
442-
AtomPBBimap& atom_to_pb) {
432+
const AtomBlockId blk_id,
433+
t_pb* cb,
434+
t_pb** parent,
435+
const LegalizationClusterId cluster_id,
436+
vtr::vector_map<AtomBlockId, LegalizationClusterId>& atom_cluster,
437+
const PackMoleculeId molecule_id,
438+
t_lb_router_data* router_data,
439+
int verbosity,
440+
const Prepacker& prepacker,
441+
const vtr::vector_map<MoleculeChainId, t_clustering_chain_info>& clustering_chain_info,
442+
AtomPBBimap& atom_to_pb) {
443443
const AtomContext& atom_ctx = g_vpr_ctx.atom();
444444

445445
VTR_ASSERT_SAFE(cb != nullptr);
@@ -450,11 +450,11 @@ try_place_atom_block_rec(const t_pb_graph_node* pb_graph_node,
450450
if (pb_graph_node->parent_pb_graph_node != cb->pb_graph_node) {
451451
t_pb* my_parent = nullptr;
452452
block_pack_status = try_place_atom_block_rec(pb_graph_node->parent_pb_graph_node, blk_id, cb,
453-
&my_parent, cluster_id,
454-
atom_cluster,
455-
molecule_id, router_data,
456-
verbosity,
457-
prepacker, clustering_chain_info, atom_to_pb);
453+
&my_parent, cluster_id,
454+
atom_cluster,
455+
molecule_id, router_data,
456+
verbosity,
457+
prepacker, clustering_chain_info, atom_to_pb);
458458
parent_pb = my_parent;
459459
} else {
460460
parent_pb = cb;
@@ -543,10 +543,10 @@ try_place_atom_block_rec(const t_pb_graph_node* pb_graph_node,
543543
VTR_ASSERT(molecule.chain_id.is_valid());
544544
const t_chain_info& prepack_chain_info = prepacker.get_molecule_chain_info(molecule.chain_id);
545545
block_pack_status = check_chain_root_placement_feasibility(pb_graph_node,
546-
prepack_chain_info,
547-
clustering_chain_info[molecule.chain_id],
548-
molecule.pack_pattern,
549-
blk_id);
546+
prepack_chain_info,
547+
clustering_chain_info[molecule.chain_id],
548+
molecule.pack_pattern,
549+
blk_id);
550550
}
551551
}
552552

@@ -629,7 +629,7 @@ static int net_sinks_reachable_in_cluster(const t_pb_graph_pin* driver_pb_gpin,
629629

630630
/**
631631
* @brief Returns the pb_graph_pin of the atom pin defined by the driver_pin_id in the driver_pb
632-
*/
632+
*/
633633
static t_pb_graph_pin* get_driver_pb_graph_pin(const t_pb* driver_pb, const AtomPinId driver_pin_id) {
634634
const AtomNetlist& atom_netlist = g_vpr_ctx.atom().netlist();
635635

@@ -792,8 +792,8 @@ static void compute_and_mark_lookahead_pins_used_for_pin(const t_pb_graph_pin* p
792792
* @brief Determine if pins of speculatively packed pb are legal
793793
*/
794794
static void compute_and_mark_lookahead_pins_used(const AtomBlockId blk_id,
795-
const vtr::vector_map<AtomBlockId, LegalizationClusterId>& atom_cluster,
796-
const AtomPBBimap& atom_to_pb) {
795+
const vtr::vector_map<AtomBlockId, LegalizationClusterId>& atom_cluster,
796+
const AtomPBBimap& atom_to_pb) {
797797
const AtomNetlist& atom_netlist = g_vpr_ctx.atom().netlist();
798798

799799
const t_pb* cur_pb = atom_to_pb.atom_pb(blk_id);
@@ -1417,7 +1417,7 @@ ClusterLegalizer::start_new_cluster(PackMoleculeId molecule_id,
14171417

14181418
// Allocate and load the LB router data
14191419
t_lb_router_data* router_data = alloc_and_load_router_data(&lb_type_rr_graphs_[cluster_type->index],
1420-
cluster_type);
1420+
cluster_type);
14211421

14221422
// Allocate and load the cluster's placement stats
14231423
t_intra_cluster_placement_stats* cluster_placement_stats = alloc_and_load_cluster_placement_stats(cluster_type, cluster_mode);
@@ -1468,7 +1468,7 @@ ClusterLegalizer::start_new_cluster(PackMoleculeId molecule_id,
14681468
}
14691469

14701470
e_block_pack_status ClusterLegalizer::add_mol_to_cluster(PackMoleculeId molecule_id,
1471-
LegalizationClusterId cluster_id) {
1471+
LegalizationClusterId cluster_id) {
14721472
// Safety asserts to make sure the inputs are valid.
14731473
VTR_ASSERT_SAFE(cluster_id.is_valid() && (size_t)cluster_id < legalization_clusters_.size());
14741474
VTR_ASSERT(legalization_cluster_ids_[cluster_id].is_valid() && "Cannot add to a destroyed cluster");

vpr/src/pack/cluster_legalizer.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,8 @@ class ClusterLegalizer {
514514
log_verbosity_ = verbosity;
515515
}
516516

517-
inline const AtomPBBimap &atom_pb_lookup() const {return atom_pb_lookup_;}
518-
inline AtomPBBimap &mutable_atom_pb_lookup() {return atom_pb_lookup_;}
517+
inline const AtomPBBimap& atom_pb_lookup() const { return atom_pb_lookup_; }
518+
inline AtomPBBimap& mutable_atom_pb_lookup() { return atom_pb_lookup_; }
519519

520520
/// @brief Destructor of the class. Frees allocated data.
521521
~ClusterLegalizer();
@@ -588,5 +588,4 @@ class ClusterLegalizer {
588588
/// @brief A two way map between AtomBlockIds and pb types. This is a copy
589589
/// of the AtomPBBimap in the global context's AtomLookup
590590
AtomPBBimap atom_pb_lookup_;
591-
592591
};

vpr/src/pack/cluster_router.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ class reservable_pq : public std::priority_queue<T, U, V> {
7575
******************************************************************************************/
7676
static void free_lb_net_rt(t_lb_trace* lb_trace);
7777
static void free_lb_trace(t_lb_trace* lb_trace);
78-
static void add_pin_to_rt_terminals(t_lb_router_data* router_data, const AtomPinId pin_id, const AtomPBBimap &atom_to_pb);
79-
static void remove_pin_from_rt_terminals(t_lb_router_data* router_data, const AtomPinId pin_id, const AtomPBBimap &atom_to_pb);
78+
static void add_pin_to_rt_terminals(t_lb_router_data* router_data, const AtomPinId pin_id, const AtomPBBimap& atom_to_pb);
79+
static void remove_pin_from_rt_terminals(t_lb_router_data* router_data, const AtomPinId pin_id, const AtomPBBimap& atom_to_pb);
8080

81-
static void fix_duplicate_equivalent_pins(t_lb_router_data* router_data, const AtomPBBimap &atom_to_pb);
81+
static void fix_duplicate_equivalent_pins(t_lb_router_data* router_data, const AtomPBBimap& atom_to_pb);
8282

8383
static void commit_remove_rt(t_lb_trace* rt, t_lb_router_data* router_data, e_commit_remove op, std::unordered_map<const t_pb_graph_node*, const t_mode*>* mode_map, t_mode_selection_status* mode_status);
8484
static bool is_skip_route_net(t_lb_trace* rt, t_lb_router_data* router_data);
@@ -249,7 +249,7 @@ static bool check_edge_for_route_conflicts(std::unordered_map<const t_pb_graph_n
249249
******************************************************************************************/
250250

251251
/* Add pins of netlist atom to to current routing drivers/targets */
252-
void add_atom_as_target(t_lb_router_data* router_data, const AtomBlockId blk_id, const AtomPBBimap &atom_to_pb) {
252+
void add_atom_as_target(t_lb_router_data* router_data, const AtomBlockId blk_id, const AtomPBBimap& atom_to_pb) {
253253
const t_pb* pb;
254254
auto& atom_ctx = g_vpr_ctx.atom();
255255

@@ -275,7 +275,7 @@ void add_atom_as_target(t_lb_router_data* router_data, const AtomBlockId blk_id,
275275
}
276276

277277
/* Remove pins of netlist atom from current routing drivers/targets */
278-
void remove_atom_from_target(t_lb_router_data* router_data, const AtomBlockId blk_id, const AtomPBBimap &atom_to_pb) {
278+
void remove_atom_from_target(t_lb_router_data* router_data, const AtomBlockId blk_id, const AtomPBBimap& atom_to_pb) {
279279
auto& atom_ctx = g_vpr_ctx.atom();
280280

281281
std::map<AtomBlockId, bool>& atoms_added = *router_data->atoms_added;
@@ -626,7 +626,7 @@ static void free_lb_trace(t_lb_trace* lb_trace) {
626626
/* Given a pin of a net, assign route tree terminals for it
627627
* Assumes that pin is not already assigned
628628
*/
629-
static void add_pin_to_rt_terminals(t_lb_router_data* router_data, const AtomPinId pin_id, const AtomPBBimap &atom_to_pb) {
629+
static void add_pin_to_rt_terminals(t_lb_router_data* router_data, const AtomPinId pin_id, const AtomPBBimap& atom_to_pb) {
630630
std::vector<t_intra_lb_net>& lb_nets = *router_data->intra_lb_nets;
631631
std::vector<t_lb_type_rr_node>& lb_type_graph = *router_data->lb_type_graph;
632632
t_logical_block_type_ptr lb_type = router_data->lb_type;
@@ -793,7 +793,7 @@ static void add_pin_to_rt_terminals(t_lb_router_data* router_data, const AtomPin
793793

794794
/* Given a pin of a net, remove route tree terminals from it
795795
*/
796-
static void remove_pin_from_rt_terminals(t_lb_router_data* router_data, const AtomPinId pin_id, const AtomPBBimap &atom_to_pb) {
796+
static void remove_pin_from_rt_terminals(t_lb_router_data* router_data, const AtomPinId pin_id, const AtomPBBimap& atom_to_pb) {
797797
std::vector<t_intra_lb_net>& lb_nets = *router_data->intra_lb_nets;
798798
std::vector<t_lb_type_rr_node>& lb_type_graph = *router_data->lb_type_graph;
799799
t_logical_block_type_ptr lb_type = router_data->lb_type;
@@ -918,7 +918,7 @@ static void remove_pin_from_rt_terminals(t_lb_router_data* router_data, const At
918918
//To work around this, we fix all but one of these duplicate connections to route to specific pins,
919919
//(instead of the common sink). This ensures a legal routing is produced and that the duplicate pins
920920
//are not 'missing' in the clustered netlist.
921-
static void fix_duplicate_equivalent_pins(t_lb_router_data* router_data, const AtomPBBimap &atom_to_pb) {
921+
static void fix_duplicate_equivalent_pins(t_lb_router_data* router_data, const AtomPBBimap& atom_to_pb) {
922922
auto& atom_ctx = g_vpr_ctx.atom();
923923

924924
std::vector<t_lb_type_rr_node>& lb_type_graph = *router_data->lb_type_graph;

vpr/src/pack/cluster_router.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ void free_router_data(t_lb_router_data* router_data);
1616
void free_intra_lb_nets(std::vector<t_intra_lb_net>* intra_lb_nets);
1717

1818
/* Routing Functions */
19-
void add_atom_as_target(t_lb_router_data* router_data, const AtomBlockId blk_id, const AtomPBBimap &atom_to_pb);
20-
void remove_atom_from_target(t_lb_router_data* router_data, const AtomBlockId blk_id, const AtomPBBimap &atom_to_pb);
19+
void add_atom_as_target(t_lb_router_data* router_data, const AtomBlockId blk_id, const AtomPBBimap& atom_to_pb);
20+
void remove_atom_from_target(t_lb_router_data* router_data, const AtomBlockId blk_id, const AtomPBBimap& atom_to_pb);
2121
void set_reset_pb_modes(t_lb_router_data* router_data, const t_pb* pb, const bool set);
2222
bool try_intra_lb_route(t_lb_router_data* router_data, int verbosity, t_mode_selection_status* mode_status);
2323
void reset_intra_lb_route(t_lb_router_data* router_data);

vpr/src/pack/greedy_candidate_selector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ void GreedyCandidateSelector::update_connection_gain_values(
406406
AtomBlockId blk_id = atom_netlist_.pin_block(pin_id);
407407
// TODO: Should investigate this. Using the atom pb bimap through is_atom_blk_in_cluster_block
408408
// in this class is very strange
409-
const t_pb *pin_block_pb = cluster_legalizer.atom_pb_lookup().atom_pb(blk_id);
410-
const t_pb *cluster_pb = cluster_legalizer.atom_pb_lookup().atom_pb(clustered_blk_id);
409+
const t_pb* pin_block_pb = cluster_legalizer.atom_pb_lookup().atom_pb(blk_id);
410+
const t_pb* cluster_pb = cluster_legalizer.atom_pb_lookup().atom_pb(clustered_blk_id);
411411

412412
if (cluster_legalizer.get_atom_cluster(blk_id) == legalization_cluster_id && is_pb_in_cluster_pb(pin_block_pb, cluster_pb)) {
413413
num_internal_connections++;

0 commit comments

Comments
 (0)