aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-08-09 10:49:11 +0200
committerGitHub <noreply@github.com>2018-08-09 10:49:11 +0200
commited602baa06959ae69cc97fa9e38ce7e9d6c7cd5f (patch)
treee5bb285ea62df09c30f7cd6dce7c2fe0fcb97f6f /common
parent41e05c95aae3b9d3397ec28d8836c40d089386e2 (diff)
parent834f7e4bfdbfaa8fbb3b51cef18c734176215c83 (diff)
downloadnextpnr-ed602baa06959ae69cc97fa9e38ce7e9d6c7cd5f.tar.gz
nextpnr-ed602baa06959ae69cc97fa9e38ce7e9d6c7cd5f.tar.bz2
nextpnr-ed602baa06959ae69cc97fa9e38ce7e9d6c7cd5f.zip
Merge pull request #42 from YosysHQ/floorplan
Add basic data structures for floorplanning
Diffstat (limited to 'common')
-rw-r--r--common/archcheck.cc4
-rw-r--r--common/nextpnr.h20
-rw-r--r--common/place_common.cc4
3 files changed, 24 insertions, 4 deletions
diff --git a/common/archcheck.cc b/common/archcheck.cc
index 5059066d..3d9e4e76 100644
--- a/common/archcheck.cc
+++ b/common/archcheck.cc
@@ -75,7 +75,7 @@ void archcheck_locs(const Context *ctx)
log_assert(0 <= loc.z);
log_assert(loc.x < ctx->getGridDimX());
log_assert(loc.y < ctx->getGridDimY());
- log_assert(loc.z < ctx->getTileDimZ(loc.x, loc.y));
+ log_assert(loc.z < ctx->getTileBelDimZ(loc.x, loc.y));
BelId bel2 = ctx->getBelByLocation(loc);
dbg(" ... %s\n", ctx->getBelName(bel2).c_str(ctx));
@@ -88,7 +88,7 @@ void archcheck_locs(const Context *ctx)
dbg("> %d %d\n", x, y);
std::unordered_set<int> usedz;
- for (int z = 0; z < ctx->getTileDimZ(x, y); z++) {
+ for (int z = 0; z < ctx->getTileBelDimZ(x, y); z++) {
BelId bel = ctx->getBelByLocation(Loc(x, y, z));
if (bel == BelId())
continue;
diff --git a/common/nextpnr.h b/common/nextpnr.h
index e588f47b..29a85a10 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -216,6 +216,19 @@ struct BelPin
struct CellInfo;
+struct Region
+{
+ IdString name;
+
+ bool constr_bels = false;
+ bool constr_wires = false;
+ bool constr_pips = false;
+
+ std::unordered_set<BelId> bels;
+ std::unordered_set<WireId> wires;
+ std::unordered_set<Loc> piplocs;
+};
+
enum PlaceStrength
{
STRENGTH_NONE = 0,
@@ -250,6 +263,8 @@ struct NetInfo : ArchNetInfo
// wire -> uphill_pip
std::unordered_map<WireId, PipMap> wires;
+
+ Region *region = nullptr;
};
enum PortType
@@ -289,6 +304,8 @@ struct CellInfo : ArchCellInfo
int constr_z = UNCONSTR; // this.z - parent.z
bool constr_abs_z = false; // parent.z := 0
// parent.[xyz] := 0 when (constr_parent == nullptr)
+
+ Region *region = nullptr;
};
enum TimingPortClass
@@ -391,6 +408,9 @@ struct BaseCtx
std::unordered_map<IdString, std::unique_ptr<NetInfo>> nets;
std::unordered_map<IdString, std::unique_ptr<CellInfo>> cells;
+ // Floorplanning regions
+ std::unordered_map<IdString, std::unique_ptr<Region>> region;
+
BaseCtx()
{
idstring_str_to_idx = new std::unordered_map<std::string, int>;
diff --git a/common/place_common.cc b/common/place_common.cc
index f9867057..5cdb96ef 100644
--- a/common/place_common.cc
+++ b/common/place_common.cc
@@ -251,7 +251,7 @@ class ConstraintLegaliseWorker
ySearch = IncreasingDiameterSearch(loc.y + child->constr_y);
}
if (child->constr_z == child->UNCONSTR) {
- zSearch = IncreasingDiameterSearch(loc.z, 0, ctx->getTileDimZ(loc.x, loc.y));
+ zSearch = IncreasingDiameterSearch(loc.z, 0, ctx->getTileBelDimZ(loc.x, loc.y));
} else {
if (child->constr_abs_z) {
zSearch = IncreasingDiameterSearch(child->constr_z);
@@ -329,7 +329,7 @@ class ConstraintLegaliseWorker
yRootSearch = IncreasingDiameterSearch(cell->constr_y);
if (cell->constr_z == cell->UNCONSTR)
- zRootSearch = IncreasingDiameterSearch(currentLoc.z, 0, ctx->getTileDimZ(currentLoc.x, currentLoc.y));
+ zRootSearch = IncreasingDiameterSearch(currentLoc.z, 0, ctx->getTileBelDimZ(currentLoc.x, currentLoc.y));
else
zRootSearch = IncreasingDiameterSearch(cell->constr_z);
while (!xRootSearch.done()) {