-
Notifications
You must be signed in to change notification settings - Fork 415
Created draft of new constraints class header file #1535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
42492c7
Created draft of new constraints class header file
sfkhalid 31b826e
Added new classes - Partition, Region, PartitionRegions
sfkhalid cbaf198
Added accessor functions to the header files
sfkhalid 29d9bf5
Added source files for implementation of classes and unit test for th…
sfkhalid 85f1c10
Ran make format on files
sfkhalid 131eca9
Removed unnecessary functions in partition_regions class
sfkhalid 4c93f5f
Added some more unit test cases
sfkhalid 92f267b
Moved rectangle intersection code to vtr_geometry file and refactored…
sfkhalid ff1c22d
Added more unit test cases for the partition regions intersection fun…
sfkhalid ff95d41
Added and modified some comments
sfkhalid c3ace92
Added member functions to VprConstraints and added unit tests to test…
sfkhalid 37ad863
Made comments doxygen compatible
sfkhalid 687105b
Fixed locked member function in Region class
sfkhalid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef PARTITION_H | ||
#define PARTITION_H | ||
|
||
#include "vtr_strong_id.h" | ||
#include "region.h" | ||
|
||
/** | ||
* This class stores the data for each constraint partition - | ||
* partition name, the atoms that are in the partition, | ||
* and the regions that the partition can be placed in. | ||
*/ | ||
|
||
//Type tag for PartitionId | ||
struct partition_id_tag; | ||
|
||
//A unique identifier for a partition | ||
typedef vtr::StrongId<partition_id_tag> PartitionId; | ||
|
||
class Partition { | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public: //accessors | ||
private: | ||
PartitionId id; | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment this too - unique id for this partition |
||
std::string name; | ||
std::vector<AtomBlockId> atomBlocks; //atoms that belong to this partition | ||
std::vector<Region> regions; //regions that this partition can be placed in | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
#endif /* PARTITION_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef PARTITION_REGIONS_H | ||
#define PARTITION_REGIONS_H | ||
|
||
/** | ||
* Vectors of type PartitionRegions are used to return information on the intersection of regions | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* (ex. between a cluster and an atom). | ||
*/ | ||
|
||
class PartitionRegions { | ||
public: //accessors | ||
private: | ||
std::vector<Region> partition_regions; | ||
}; | ||
|
||
#endif /* PARTITION_REGIONS_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef REGION_H | ||
#define REGION_H | ||
|
||
#include "vtr_strong_id.h" | ||
#include "globals.h" | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* This class stores the data for each constraint region - the region bounds and the subtile bounds. | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
|
||
//Type tag for RegionId | ||
struct region_id_tag; | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
//A unique identifier for a region | ||
typedef vtr::StrongId<region_id_tag> RegionId; | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
class Region { | ||
public: //accessors | ||
private: | ||
//may need to include zmin, zmax for future use in 3D FPGA designs | ||
vtr::Rect<int> region_bounds; //xmin, xmax, ymin, ymax | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
int subTilemin, subTilemax; | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
#endif /* REGION_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#ifndef VPR_CONSTRAINTS_H | ||
#define VPR_CONSTRAINTS_H | ||
|
||
#include "vtr_vector.h" | ||
#include "vpr_utils.h" | ||
#include "partition.h" | ||
#include "partition_regions.h" | ||
|
||
/** | ||
* @file | ||
* @brief This file defines the VprConstraints class used to store and read out data related to user-specified | ||
* block and region constraints for the packing and placement stages. | ||
* | ||
* Overview | ||
* ======== | ||
* This class contains functions that read in and store information from a constraints XML file. | ||
* The XML file provides a partition list, with the names/ids of the partitions, and each atom in the partition. | ||
* It also provides placement constraints, where it is specified which regions the partitions should go in. | ||
* In the constraints file, a placement constraint can also be created for a specific primitive. A partition would be automatically | ||
* created for the primitive when a placement constraint was specified for it. | ||
* | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
|
||
class VprConstraints { | ||
public: | ||
/** | ||
* Returns the intersection of two PartitionRegions vectors that are passed to it. | ||
* Can be used by atom_cluster_intersection. | ||
*/ | ||
PartitionRegions do_regions_intersect(PartitionRegions part_regions_old, PartitionRegions part_regions_new); | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* Takes Atom Id and PartitonRegions vector and returns the intersection of the atom's partition regions | ||
* and the net PartitionRegions of the cluster (if any exists) | ||
* Used by clusterer during packing. | ||
*/ | ||
PartitionRegions atom_cluster_intersection(const AtomBlockId id, PartitionRegions part_regions); | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
private: | ||
/** | ||
* Store constraints information of each constrained atom. | ||
* Store ID of the partition the atom belongs to/invalid entry if it doesn't belong to any partition. | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
std::unordered_map<AtomBlockId, PartitionId> constrained_atoms; | ||
|
||
/** | ||
* Store partitions in a vector | ||
sfkhalid marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
std::vector<Partition> partitions; | ||
}; | ||
|
||
#endif /* VPR_CONSTRAINTS_H */ |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.