Skip to content

Commit 37ad863

Browse files
committed
Made comments doxygen compatible
1 parent c3ace92 commit 37ad863

File tree

9 files changed

+138
-87
lines changed

9 files changed

+138
-87
lines changed

vpr/src/base/partition.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ void Partition::set_name(std::string _part_name) {
1010
name = _part_name;
1111
}
1212

13-
const PartitionRegion Partition::get_part_regions() {
14-
return part_regions;
13+
const PartitionRegion Partition::get_part_region() {
14+
return part_region;
1515
}
1616

17-
void Partition::set_part_regions(PartitionRegion pr) {
18-
part_regions = pr;
17+
void Partition::set_part_region(PartitionRegion pr) {
18+
part_region = pr;
1919
}

vpr/src/base/partition.h

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,41 @@
77
#include "partition_region.h"
88
/**
99
* @file
10-
* @brief This file defines the data for a partition: a grouping of atoms that are constrained to a portion of an FPGA. A partition defines
11-
* the atoms that are assigned to it, and the locations in which they can be placed. The locations are a union of rectangles in x, y,
12-
* sub_tile space. Common cases include a single rectangle or a single x, y, sub_tile (specific location). More complex partitions
10+
* @brief This file defines the data for a partition: a grouping of atoms that are constrained to a portion of an FPGA.
11+
*
12+
* A partition defines the atoms that are assigned to it, and the locations in which they can be placed.
13+
* The locations are a union of rectangles in x, y, sub_tile space.
14+
* Common cases include a single rectangle or a single x, y, sub_tile (specific location). More complex partitions
1315
* with L, T or other shapes can be created with a union of multiple rectangles.
1416
*/
1517

16-
//Type tag for PartitionId
18+
/// @brief Type tag for PartitionId
1719
struct partition_id_tag;
1820

19-
//A unique identifier for a partition
21+
/// @brief A unique identifier for a partition
2022
typedef vtr::StrongId<partition_id_tag> PartitionId;
2123

2224
class Partition {
2325
public:
2426
const std::string get_name();
27+
2528
void set_name(std::string _part_name);
2629

27-
//set the union of regions for this partition;
28-
void set_part_regions(PartitionRegion pr);
30+
/**
31+
* @brief Set the PartitionRegion (union of rectangular regions) for this partition
32+
*
33+
* @param pr The PartitionRegion belonging to the partition
34+
*/
35+
void set_part_region(PartitionRegion pr);
2936

30-
//get the union of regions of this partition
31-
const PartitionRegion get_part_regions();
37+
/**
38+
* @brief Get the PartitionRegion (union of rectangular regions) for this partition
39+
*/
40+
const PartitionRegion get_part_region();
3241

3342
private:
34-
std::string name; //name of the partition, name will be unique across partitions
35-
PartitionRegion part_regions; //the union of regions that the partition can be placed in
43+
std::string name; ///< name of the partition, name will be unique across partitions
44+
PartitionRegion part_region; ///< the union of regions that the partition can be placed in
3645
};
3746

3847
#endif /* PARTITION_H */

vpr/src/base/partition_region.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ PartitionRegion PartitionRegion::get_intersection(PartitionRegion part_region) {
99
PartitionRegion pr;
1010
Region intersect_region;
1111
bool regions_intersect;
12-
for (unsigned int i = 0; i < partition_regions.size(); i++) {
13-
for (unsigned int j = 0; j < part_region.partition_regions.size(); j++) {
14-
regions_intersect = partition_regions[i].do_regions_intersect(part_region.partition_regions[j]);
12+
for (unsigned int i = 0; i < partition_region.size(); i++) {
13+
for (unsigned int j = 0; j < part_region.partition_region.size(); j++) {
14+
regions_intersect = partition_region[i].do_regions_intersect(part_region.partition_region[j]);
1515
if (regions_intersect) {
16-
intersect_region = partition_regions[i].regions_intersection(part_region.partition_regions[j]);
17-
pr.partition_regions.push_back(intersect_region);
16+
intersect_region = partition_region[i].regions_intersection(part_region.partition_region[j]);
17+
pr.partition_region.push_back(intersect_region);
1818
}
1919
}
2020
}
2121

2222
return pr;
2323
}
2424

25-
void PartitionRegion::add_to_part_regions(Region region) {
26-
partition_regions.push_back(region);
25+
void PartitionRegion::add_to_part_region(Region region) {
26+
partition_region.push_back(region);
2727
}
2828

29-
std::vector<Region> PartitionRegion::get_partition_regions() {
30-
return partition_regions;
29+
std::vector<Region> PartitionRegion::get_partition_region() {
30+
return partition_region;
3131
}

vpr/src/base/partition_region.h

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,27 @@
1212

1313
class PartitionRegion {
1414
public:
15-
//Returns the intersection of two PartitionRegions vectors that are passed to it.
15+
/**
16+
* @brief Return the intersection of two PartitionRegions
17+
*
18+
* @param part_region The PartitionRegion that the calling object will be intersected with
19+
*/
1620
PartitionRegion get_intersection(PartitionRegion part_region);
1721

18-
//function to add to the partition_regions vector
19-
void add_to_part_regions(Region region);
22+
/**
23+
* @brief Add a region to the union of regions belonging to the partition
24+
*
25+
* @param region The region to be added to the calling object
26+
*/
27+
void add_to_part_region(Region region);
2028

21-
//function to get the partition_regions vector
22-
std::vector<Region> get_partition_regions();
29+
/**
30+
* @brief Return the union of regions
31+
*/
32+
std::vector<Region> get_partition_region();
2333

2434
private:
25-
std::vector<Region> partition_regions; //vector of regions that a partition can be placed in
35+
std::vector<Region> partition_region; ///< union of rectangular regions that a partition can be placed in
2636
};
2737

2838
#endif /* PARTITION_REGIONS_H */

vpr/src/base/region.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "region.h"
22

3-
//sentinel value for indicating that a subtile has not been specified
3+
/// @brief sentinel value for indicating that a subtile has not been specified
44
constexpr int NO_SUBTILE = -1;
55

66
Region::Region() {
@@ -40,7 +40,8 @@ bool Region::do_regions_intersect(Region region) {
4040

4141
intersect_rect = intersection(region_bounds, region_rect);
4242

43-
/**if the intersection rectangle is empty or the subtile of the two regions does not match,
43+
/**
44+
* if the intersection rectangle is empty or the subtile of the two regions does not match,
4445
* the regions do not intersect
4546
*/
4647
if (intersect_rect.empty() || sub_tile != region.get_sub_tile()) {

vpr/src/base/region.h

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
/**
77
* @file
88
* @brief This file defines the Region class. The Region class stores the data for each constraint region.
9-
* This includes the x and y bounds of the region rectangle and its sub_tile. To lock a block down to a specific location,
10-
* when defining the region specify xmin = xmax, ymin = ymax, and specify a subtile value.
9+
*
10+
* This includes the x and y bounds of the region rectangle and its sub_tile. To lock a block down to a specific location,
11+
* when defining the region specify xmin = xmax, ymin = ymax, and specify a subtile value.
1112
*
1213
*/
1314

@@ -23,27 +24,38 @@ class Region {
2324

2425
void set_sub_tile(int _sub_tile);
2526

26-
//function to see if region is empty (checks if region rectangle is empty)
27+
/**
28+
* @brief Return whether the region is empty, based on whether the region rectangle is empty
29+
*/
2730
bool empty();
2831

29-
/**function to see if two regions intersect anywhere
32+
/**
33+
* @brief Returns whether two regions intersect
34+
*
3035
* Intersection is the area of overlap between the rectangles of two regions,
3136
* given that both regions have matching subtile values, or no subtiles assigned to them
3237
* The overlap is inclusive of the x and y boundaries of the rectangles
38+
*
39+
* @param region The region to intersect with the calling object
3340
*/
3441
bool do_regions_intersect(Region region);
3542

36-
//returns the coordinates of the rectangular intersection of two regions
43+
/**
44+
* @brief Returns the coordinates of intersection of two regions
45+
*
46+
* @param region The region to intersect with the calling object
47+
*/
3748
Region regions_intersection(Region region);
3849

39-
//function to check whether a block is locked down to a specific x, y, subtile location
40-
//can be called by the placer to see if the block is locked down
50+
/**
51+
* @brief Checks whether a block is locked down to a specific x, y, subtile location
52+
*/
4153
bool locked();
4254

4355
private:
4456
//may need to include zmin, zmax for future use in 3D FPGA designs
45-
vtr::Rect<int> region_bounds; //xmin, ymin, xmax, ymax inclusive
46-
int sub_tile; //users will optionally select a subtile
57+
vtr::Rect<int> region_bounds; ///< xmin, ymin, xmax, ymax inclusive
58+
int sub_tile; ///< users will optionally select a subtile
4759
};
4860

4961
#endif /* REGION_H */

vpr/src/base/vpr_constraints.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
void VprConstraints::add_constrained_atom(const AtomBlockId blk_id, const PartitionId part_id) {
44
constrained_atoms.insert({blk_id, part_id});
55

6-
//std::unordered_map<AtomBlockId, PartitionId>::const_iterator got = constrained_atoms.find(blk_id);
76
auto got = constrained_atoms.find(blk_id);
87

98
if (got == constrained_atoms.end()) {
@@ -16,7 +15,6 @@ void VprConstraints::add_constrained_atom(const AtomBlockId blk_id, const Partit
1615
PartitionId VprConstraints::get_atom_partition(AtomBlockId blk_id) {
1716
PartitionId part_id;
1817

19-
//std::unordered_map<AtomBlockId, PartitionId>::const_iterator got = constrained_atoms.find(blk_id);
2018
auto got = constrained_atoms.find(blk_id);
2119

2220
if (got == constrained_atoms.end()) {

vpr/src/base/vpr_constraints.h

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,58 @@
1414
* Overview
1515
* ========
1616
* This class contains functions that read in and store information from a constraints XML file.
17-
* The XML file provides a partition list, with the names/ids of the partitions, and each atom in the partition.
18-
* It also specifies which regions the partitions should be placed in.
17+
* The XML file provides a partition list, with the names of the partitions, and each atom in the partition.
18+
* It also specifies which regions the partitions should be placed in. Atoms cannot be placed in more than one partition.
19+
* If an atom is assigned to more than one partition, the last partition is was assigned to will be the partition it is placed in.
1920
*
2021
*/
2122

2223
class VprConstraints {
2324
public:
24-
//function to add an atom to constrained_atoms
25+
/**
26+
* @brief Store the id of a constrained atom with the id of the partition it belongs to
27+
*
28+
* @param blk_id The atom being stored
29+
* @param part_id The partition the atom is being constrained to
30+
*/
2531
void add_constrained_atom(const AtomBlockId blk_id, const PartitionId part_id);
2632

27-
//function to find which partition an atom belongs to
33+
/**
34+
* @brief Return id of the partition the atom belongs to
35+
*
36+
* @param blk_id The atom for which the partition id is needed
37+
*/
2838
PartitionId get_atom_partition(AtomBlockId blk_id);
2939

30-
//function to add a partition to partitions
40+
/**
41+
* @brief Store a partition
42+
*
43+
* @param part The partition being stored
44+
*/
3145
void add_partition(Partition part);
3246

33-
//function to return a partition given a PartitionId
47+
/**
48+
* @brief Return a partition
49+
*
50+
* @param part_id The id of the partition that is wanted
51+
*/
3452
Partition get_partition(PartitionId part_id);
3553

36-
//function to return the atoms belonging to a partition
54+
/**
55+
* @brief Return all the atoms that belong to a partition
56+
*
57+
* @param part_id The id of the partition whose atoms are needed
58+
*/
3759
std::vector<AtomBlockId> get_part_atoms(PartitionId part_id);
3860

3961
private:
4062
/**
41-
* Store constraints information of each constrained atom.
42-
* Store ID of the partition the atom belongs to.
63+
* Store all constrained atoms
4364
*/
4465
std::unordered_map<AtomBlockId, PartitionId> constrained_atoms;
4566

4667
/**
47-
* Store partitions in a vector
68+
* Store all partitions
4869
*/
4970
vtr::vector<PartitionId, Partition> partitions;
5071
};

0 commit comments

Comments
 (0)