Skip to content

Commit 4bcb6d6

Browse files
[AP] Changed Block Type to Block Mobility
Feedback from Vaughn, who thinks that APBlockType was a bit ambiguous and may cause problems later. He recommended calling it mobility instead.
1 parent 7f868f3 commit 4bcb6d6

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

vpr/src/analytical_place/ap_netlist.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ const t_pack_molecule* APNetlist::block_molecule(const APBlockId id) const {
2121
return block_molecules_[id];
2222
}
2323

24-
APBlockType APNetlist::block_type(const APBlockId id) const {
24+
APBlockMobility APNetlist::block_mobility(const APBlockId id) const {
2525
VTR_ASSERT_SAFE(valid_block_id(id));
2626

27-
return block_types_[id];
27+
return block_mobilities_[id];
2828
}
2929

3030
const APFixedBlockLoc& APNetlist::block_loc(const APBlockId id) const {
3131
VTR_ASSERT_SAFE(valid_block_id(id));
32-
VTR_ASSERT(block_type(id) == APBlockType::FIXED);
32+
VTR_ASSERT(block_mobility(id) == APBlockMobility::FIXED);
3333

3434
return block_locs_[id];
3535
}
@@ -42,15 +42,15 @@ APBlockId APNetlist::create_block(const std::string& name, const t_pack_molecule
4242

4343
// Initialize the data
4444
block_molecules_.insert(blk_id, mol);
45-
block_types_.insert(blk_id, APBlockType::MOVEABLE);
45+
block_mobilities_.insert(blk_id, APBlockMobility::MOVEABLE);
4646
block_locs_.insert(blk_id, APFixedBlockLoc());
4747

4848
// Check post-conditions: size
4949
VTR_ASSERT(validate_block_sizes());
5050

5151
// Check post-conditions: values
5252
VTR_ASSERT(block_molecule(blk_id) == mol);
53-
VTR_ASSERT(block_type(blk_id) == APBlockType::MOVEABLE);
53+
VTR_ASSERT(block_mobility(blk_id) == APBlockMobility::MOVEABLE);
5454

5555
return blk_id;
5656
}
@@ -63,7 +63,7 @@ void APNetlist::set_block_loc(const APBlockId id, const APFixedBlockLoc& loc) {
6363
return;
6464

6565
block_locs_[id] = loc;
66-
block_types_[id] = APBlockType::FIXED;
66+
block_mobilities_[id] = APBlockMobility::FIXED;
6767
}
6868

6969
APPortId APNetlist::create_port(const APBlockId blk_id, const std::string& name, BitIndex width, PortType type) {
@@ -112,8 +112,8 @@ APNetId APNetlist::create_net(const std::string& name) {
112112
void APNetlist::clean_blocks_impl(const vtr::vector_map<APBlockId, APBlockId>& block_id_map) {
113113
// Update all the block molecules
114114
block_molecules_ = clean_and_reorder_values(block_molecules_, block_id_map);
115-
// Update all the block types
116-
block_types_ = clean_and_reorder_values(block_types_, block_id_map);
115+
// Update all the block mobilities
116+
block_mobilities_ = clean_and_reorder_values(block_mobilities_, block_id_map);
117117
// Update the fixed block locations
118118
block_locs_ = clean_and_reorder_values(block_locs_, block_id_map);
119119
}
@@ -150,7 +150,7 @@ void APNetlist::rebuild_net_refs_impl(const vtr::vector_map<APPinId, APPinId>& /
150150
void APNetlist::shrink_to_fit_impl() {
151151
// Block data
152152
block_molecules_.shrink_to_fit();
153-
block_types_.shrink_to_fit();
153+
block_mobilities_.shrink_to_fit();
154154
block_locs_.shrink_to_fit();
155155
}
156156

@@ -176,7 +176,7 @@ void APNetlist::remove_net_impl(const APNetId /*net_id*/) {
176176
bool APNetlist::validate_block_sizes_impl(size_t num_blocks) const {
177177
if (block_molecules_.size() != num_blocks)
178178
return false;
179-
if (block_types_.size() != num_blocks)
179+
if (block_mobilities_.size() != num_blocks)
180180
return false;
181181
if (block_locs_.size() != num_blocks)
182182
return false;

vpr/src/analytical_place/ap_netlist.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
* An example of a block is pack molecules, which are atoms which were prepacked
1414
* together.
1515
*
16-
* The nets in the netlist represent the logical connections between atom
17-
* blocks, where nets which are unused by Analytical Placement are ignored.
16+
* The nets in the netlist represent the logical connections between AP
17+
* blocks (inferred from the atom block connectivity), where nets which are
18+
* unused by Analytical Placement are ignored.
1819
*/
1920

2021
#pragma once
@@ -42,11 +43,11 @@ struct APFixedBlockLoc {
4243
};
4344

4445
/**
45-
* @brief The type of a block in the APNetlist
46+
* @brief The mobility of a block in the APNetlist
4647
* TODO: It would be nice if the netlist contained lists of moveable and fixed
4748
* block ids.
4849
*/
49-
enum class APBlockType : bool {
50+
enum class APBlockMobility : bool {
5051
MOVEABLE, // The block is not constrained in any dimension.
5152
FIXED // The block is fixed.
5253
};
@@ -81,8 +82,8 @@ class APNetlist : public Netlist<APBlockId, APPortId, APPinId, APNetId> {
8182
/// @brief Returns the molecule that this block represents.
8283
const t_pack_molecule* block_molecule(const APBlockId id) const;
8384

84-
/// @brief Returns the type of this block.
85-
APBlockType block_type(const APBlockId id) const;
85+
/// @brief Returns the mobility of this block.
86+
APBlockMobility block_mobility(const APBlockId id) const;
8687

8788
/// @brief Returns the location of this block, if the block is fixed.
8889
/// This method should not be used if the block is moveable.
@@ -180,7 +181,7 @@ class APNetlist : public Netlist<APBlockId, APPortId, APPinId, APNetId> {
180181
/// @brief Molecule of each block
181182
vtr::vector_map<APBlockId, const t_pack_molecule*> block_molecules_;
182183
/// @brief Type of each block
183-
vtr::vector_map<APBlockId, APBlockType> block_types_;
184+
vtr::vector_map<APBlockId, APBlockMobility> block_mobilities_;
184185
/// @brief Location of each block (if fixed).
185186
/// NOTE: This vector will likely be quite sparse.
186187
vtr::vector_map<APBlockId, APFixedBlockLoc> block_locs_;

vpr/test/test_ap_netlist.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ TEST_CASE("test_ap_netlist_data_storage", "[vpr_ap_netlist]") {
5757
test_netlist.set_block_loc(fixed_block_id, fixed_block_loc);
5858

5959
SECTION("Test block_type returns the correct block type") {
60-
// Make sure the default block type is moveable.
61-
REQUIRE(test_netlist.block_type(block_id_a) == APBlockType::MOVEABLE);
62-
REQUIRE(test_netlist.block_type(block_id_c) == APBlockType::MOVEABLE);
63-
// Make sure the fixed block is labelled as fixed.
64-
REQUIRE(test_netlist.block_type(fixed_block_id) == APBlockType::FIXED);
60+
// Make sure the default block mobility is moveable.
61+
REQUIRE(test_netlist.block_mobility(block_id_a) == APBlockMobility::MOVEABLE);
62+
REQUIRE(test_netlist.block_mobility(block_id_c) == APBlockMobility::MOVEABLE);
63+
// Make sure the fixed block has a fixed mobility.
64+
REQUIRE(test_netlist.block_mobility(fixed_block_id) == APBlockMobility::FIXED);
6565
}
6666

6767
SECTION("Test block_loc returns the correct location") {

0 commit comments

Comments
 (0)