aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Rothman <537074+litghost@users.noreply.github.com>2021-02-01 14:28:32 -0800
committerKeith Rothman <537074+litghost@users.noreply.github.com>2021-02-02 07:44:49 -0800
commitda74a425d23352d7cddf9d1c4b0b7c86dd567c40 (patch)
tree3657232a91e97f839cd9114f40aa0c565afc23d4
parent01509ec7c991f0ec674fd933095dfe52be28b46f (diff)
downloadnextpnr-da74a425d23352d7cddf9d1c4b0b7c86dd567c40.tar.gz
nextpnr-da74a425d23352d7cddf9d1c4b0b7c86dd567c40.tar.bz2
nextpnr-da74a425d23352d7cddf9d1c4b0b7c86dd567c40.zip
Run "make clangformat".
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
-rw-r--r--common/arch_pybindings_shared.h12
-rw-r--r--common/archcheck.cc20
-rw-r--r--common/fast_bels.h45
-rw-r--r--common/place_common.cc3
-rw-r--r--common/placer1.cc7
-rw-r--r--common/placer_heap.cc49
-rw-r--r--ecp5/arch.cc4
-rw-r--r--ecp5/arch.h32
-rw-r--r--ecp5/arch_pybindings.cc4
-rw-r--r--ecp5/archdefs.h8
-rw-r--r--generic/arch.h36
-rw-r--r--generic/arch_pybindings.cc28
-rw-r--r--gowin/arch.cc4
-rw-r--r--gowin/arch.h35
-rw-r--r--ice40/arch.cc4
-rw-r--r--ice40/arch.h32
-rw-r--r--ice40/arch_pybindings.cc5
-rw-r--r--ice40/archdefs.h8
-rw-r--r--nexus/arch.cc4
-rw-r--r--nexus/arch.h32
-rw-r--r--nexus/arch_pybindings.cc4
-rw-r--r--nexus/archdefs.h8
22 files changed, 174 insertions, 210 deletions
diff --git a/common/arch_pybindings_shared.h b/common/arch_pybindings_shared.h
index b8ea7b17..5295c6ab 100644
--- a/common/arch_pybindings_shared.h
+++ b/common/arch_pybindings_shared.h
@@ -112,17 +112,17 @@ fn_wrapper_2a_v<Context, decltype(&Context::writeSVG), &Context::writeSVG, pass_
pass_through<std::string>>::def_wrap(ctx_cls, "writeSVG");
// const\_range\<BelBucketId\> getBelBuckets() const
-fn_wrapper_0a<Context, decltype(&Context::getBelBuckets), &Context::getBelBuckets, wrap_context<BelBucketRange>>::def_wrap(ctx_cls,
- "getBelBuckets");
+fn_wrapper_0a<Context, decltype(&Context::getBelBuckets), &Context::getBelBuckets,
+ wrap_context<BelBucketRange>>::def_wrap(ctx_cls, "getBelBuckets");
// BelBucketId getBelBucketForBel(BelId bel) const
fn_wrapper_1a<Context, decltype(&Context::getBelBucketForBel), &Context::getBelBucketForBel, conv_to_str<BelBucketId>,
conv_from_str<BelId>>::def_wrap(ctx_cls, "getBelBucketForBel");
// BelBucketId getBelBucketForCellType(IdString cell\_type) const
-fn_wrapper_1a<Context, decltype(&Context::getBelBucketForCellType), &Context::getBelBucketForCellType, conv_to_str<BelBucketId>,
- conv_from_str<IdString>>::def_wrap(ctx_cls, "getBelBucketForCellType");
+fn_wrapper_1a<Context, decltype(&Context::getBelBucketForCellType), &Context::getBelBucketForCellType,
+ conv_to_str<BelBucketId>, conv_from_str<IdString>>::def_wrap(ctx_cls, "getBelBucketForCellType");
// const\_range\<BelId\> getBelsInBucket(BelBucketId bucket) const
-fn_wrapper_1a<Context, decltype(&Context::getBelsInBucket), &Context::getBelsInBucket, wrap_context<BelRangeForBelBucket>,
- conv_from_str<BelBucketId>>::def_wrap(ctx_cls, "getBelsInBucket");
+fn_wrapper_1a<Context, decltype(&Context::getBelsInBucket), &Context::getBelsInBucket,
+ wrap_context<BelRangeForBelBucket>, conv_from_str<BelBucketId>>::def_wrap(ctx_cls, "getBelsInBucket");
// bool isValidBelForCellType(IdString cell\_type, BelId bel) const
fn_wrapper_2a<Context, decltype(&Context::isValidBelForCellType), &Context::isValidBelForCellType, pass_through<bool>,
conv_from_str<IdString>, conv_from_str<BelId>>::def_wrap(ctx_cls, "isValidBelForCellType");
diff --git a/common/archcheck.cc b/common/archcheck.cc
index 585fcfee..f5760c88 100644
--- a/common/archcheck.cc
+++ b/common/archcheck.cc
@@ -53,7 +53,7 @@ void archcheck_names(const Context *ctx)
}
log_info("Checking bucket names..\n");
- for(BelBucketId bucket : ctx->getBelBuckets()) {
+ for (BelBucketId bucket : ctx->getBelBuckets()) {
IdString name = ctx->getBelBucketName(bucket);
BelBucketId bucket2 = ctx->getBelBucketByName(name);
if (bucket != bucket2) {
@@ -204,12 +204,12 @@ void archcheck_buckets(const Context *ctx)
// BEL buckets should be subsets of BELs that form an exact cover.
// In particular that means cell types in a bucket should only be
// placable in that bucket.
- for(BelBucketId bucket : ctx->getBelBuckets()) {
+ for (BelBucketId bucket : ctx->getBelBuckets()) {
// Find out which cell types are in this bucket.
std::unordered_set<IdString> cell_types_in_bucket;
- for(IdString cell_type : ctx->getCellTypes()) {
- if(ctx->getBelBucketForCellType(cell_type) == bucket) {
+ for (IdString cell_type : ctx->getCellTypes()) {
+ if (ctx->getBelBucketForCellType(cell_type) == bucket) {
cell_types_in_bucket.insert(cell_type);
}
}
@@ -219,7 +219,7 @@ void archcheck_buckets(const Context *ctx)
std::unordered_set<IdString> cell_types_unused;
std::unordered_set<BelId> bels_in_bucket;
- for(BelId bel : ctx->getBelsInBucket(bucket)) {
+ for (BelId bel : ctx->getBelsInBucket(bucket)) {
BelBucketId bucket2 = ctx->getBelBucketForBel(bel);
log_assert(bucket == bucket2);
@@ -227,9 +227,9 @@ void archcheck_buckets(const Context *ctx)
// Check to see if a cell type not in this bucket can be
// placed at a BEL in this bucket.
- for(IdString cell_type : ctx->getCellTypes()) {
- if(ctx->getBelBucketForCellType(cell_type) == bucket) {
- if(ctx->isValidBelForCellType(cell_type, bel)) {
+ for (IdString cell_type : ctx->getCellTypes()) {
+ if (ctx->getBelBucketForCellType(cell_type) == bucket) {
+ if (ctx->isValidBelForCellType(cell_type, bel)) {
cell_types_unused.erase(cell_type);
}
} else {
@@ -240,8 +240,8 @@ void archcheck_buckets(const Context *ctx)
// Verify that any BEL not in this bucket reports a different
// bucket.
- for(BelId bel : ctx->getBels()) {
- if(ctx->getBelBucketForBel(bel) != bucket) {
+ for (BelId bel : ctx->getBels()) {
+ if (ctx->getBelBucketForBel(bel) != bucket) {
log_assert(bels_in_bucket.count(bel) == 0);
}
}
diff --git a/common/fast_bels.h b/common/fast_bels.h
index 2301bc7d..be2852cd 100644
--- a/common/fast_bels.h
+++ b/common/fast_bels.h
@@ -20,24 +20,30 @@
#pragma once
-#include "nextpnr.h"
#include <cstddef>
+#include "nextpnr.h"
NEXTPNR_NAMESPACE_BEGIN
// FastBels is a lookup class that provides a fast lookup for finding BELs
// that support a given cell type.
-struct FastBels {
- struct TypeData {
+struct FastBels
+{
+ struct TypeData
+ {
size_t type_index;
int number_of_possible_bels;
};
- FastBels(Context *ctx, bool check_bel_available, int minBelsForGridPick) : ctx(ctx), check_bel_available(check_bel_available), minBelsForGridPick(minBelsForGridPick) {}
+ FastBels(Context *ctx, bool check_bel_available, int minBelsForGridPick)
+ : ctx(ctx), check_bel_available(check_bel_available), minBelsForGridPick(minBelsForGridPick)
+ {
+ }
- void addCellType(IdString cell_type) {
+ void addCellType(IdString cell_type)
+ {
auto iter = cell_types.find(cell_type);
- if(iter != cell_types.end()) {
+ if (iter != cell_types.end()) {
// This cell type has already been added to the fast BEL lookup.
return;
}
@@ -50,7 +56,7 @@ struct FastBels {
auto &bel_data = fast_bels_by_cell_type.at(type_idx);
for (auto bel : ctx->getBels()) {
- if(!ctx->isValidBelForCellType(cell_type, bel)) {
+ if (!ctx->isValidBelForCellType(cell_type, bel)) {
continue;
}
@@ -58,11 +64,11 @@ struct FastBels {
}
for (auto bel : ctx->getBels()) {
- if(check_bel_available && !ctx->checkBelAvail(bel)) {
+ if (check_bel_available && !ctx->checkBelAvail(bel)) {
continue;
}
- if(!ctx->isValidBelForCellType(cell_type, bel)) {
+ if (!ctx->isValidBelForCellType(cell_type, bel)) {
continue;
}
@@ -83,9 +89,10 @@ struct FastBels {
}
}
- void addBelBucket(BelBucketId partition) {
+ void addBelBucket(BelBucketId partition)
+ {
auto iter = partition_types.find(partition);
- if(iter != partition_types.end()) {
+ if (iter != partition_types.end()) {
// This partition has already been added to the fast BEL lookup.
return;
}
@@ -98,7 +105,7 @@ struct FastBels {
auto &bel_data = fast_bels_by_partition_type.at(type_idx);
for (auto bel : ctx->getBels()) {
- if(ctx->getBelBucketForBel(bel) != partition) {
+ if (ctx->getBelBucketForBel(bel) != partition) {
continue;
}
@@ -106,11 +113,11 @@ struct FastBels {
}
for (auto bel : ctx->getBels()) {
- if(check_bel_available && !ctx->checkBelAvail(bel)) {
+ if (check_bel_available && !ctx->checkBelAvail(bel)) {
continue;
}
- if(ctx->getBelBucketForBel(bel) != partition) {
+ if (ctx->getBelBucketForBel(bel) != partition) {
continue;
}
@@ -133,9 +140,10 @@ struct FastBels {
typedef std::vector<std::vector<std::vector<BelId>>> FastBelsData;
- int getBelsForCellType(IdString cell_type, FastBelsData **data) {
+ int getBelsForCellType(IdString cell_type, FastBelsData **data)
+ {
auto iter = cell_types.find(cell_type);
- if(iter == cell_types.end()) {
+ if (iter == cell_types.end()) {
addCellType(cell_type);
iter = cell_types.find(cell_type);
NPNR_ASSERT(iter != cell_types.end());
@@ -147,9 +155,10 @@ struct FastBels {
return cell_type_data.number_of_possible_bels;
}
- size_t getBelsForBelBucket(BelBucketId partition, FastBelsData **data) {
+ size_t getBelsForBelBucket(BelBucketId partition, FastBelsData **data)
+ {
auto iter = partition_types.find(partition);
- if(iter == partition_types.end()) {
+ if (iter == partition_types.end()) {
addBelBucket(partition);
iter = partition_types.find(partition);
NPNR_ASSERT(iter != partition_types.end());
diff --git a/common/place_common.cc b/common/place_common.cc
index fb973e2c..3f89169a 100644
--- a/common/place_common.cc
+++ b/common/place_common.cc
@@ -118,7 +118,8 @@ bool place_single_cell(Context *ctx, CellInfo *cell, bool require_legality)
}
IdString targetType = cell->type;
for (auto bel : ctx->getBels()) {
- if (ctx->isValidBelForCellType(targetType, bel) && (!require_legality || ctx->isValidBelForCell(cell, bel))) {
+ if (ctx->isValidBelForCellType(targetType, bel) &&
+ (!require_legality || ctx->isValidBelForCell(cell, bel))) {
if (ctx->checkBelAvail(bel)) {
wirelen_t wirelen = get_cell_metric_at_bel(ctx, cell, bel, MetricType::COST);
if (iters >= 4)
diff --git a/common/placer1.cc b/common/placer1.cc
index 2d63ea42..1c039090 100644
--- a/common/placer1.cc
+++ b/common/placer1.cc
@@ -39,11 +39,11 @@
#include <stdlib.h>
#include <string.h>
#include <vector>
+#include "fast_bels.h"
#include "log.h"
#include "place_common.h"
#include "timing.h"
#include "util.h"
-#include "fast_bels.h"
namespace std {
template <> struct hash<std::pair<NEXTPNR_NAMESPACE_PREFIX IdString, std::size_t>>
@@ -76,7 +76,8 @@ class SAPlacer
};
public:
- SAPlacer(Context *ctx, Placer1Cfg cfg) : ctx(ctx), fast_bels(ctx, /*check_bel_available=*/false, cfg.minBelsForGridPick), cfg(cfg)
+ SAPlacer(Context *ctx, Placer1Cfg cfg)
+ : ctx(ctx), fast_bels(ctx, /*check_bel_available=*/false, cfg.minBelsForGridPick), cfg(cfg)
{
for (auto bel : ctx->getBels()) {
Loc loc = ctx->getBelLocation(bel);
@@ -91,7 +92,7 @@ class SAPlacer
cell_types_in_use.insert(cell_type);
}
- for(auto cell_type : cell_types_in_use) {
+ for (auto cell_type : cell_types_in_use) {
fast_bels.addCellType(cell_type);
}
diff --git a/common/placer_heap.cc b/common/placer_heap.cc
index e14a4660..d149a5b0 100644
--- a/common/placer_heap.cc
+++ b/common/placer_heap.cc
@@ -44,13 +44,13 @@
#include <queue>
#include <tuple>
#include <unordered_map>
+#include "fast_bels.h"
#include "log.h"
#include "nextpnr.h"
#include "place_common.h"
#include "placer1.h"
#include "timing.h"
#include "util.h"
-#include "fast_bels.h"
NEXTPNR_NAMESPACE_BEGIN
@@ -138,7 +138,10 @@ template <typename T> struct EquationSystem
class HeAPPlacer
{
public:
- HeAPPlacer(Context *ctx, PlacerHeapCfg cfg) : ctx(ctx), cfg(cfg), fast_bels(ctx, /*check_bel_available=*/true, -1) { Eigen::initParallel(); }
+ HeAPPlacer(Context *ctx, PlacerHeapCfg cfg) : ctx(ctx), cfg(cfg), fast_bels(ctx, /*check_bel_available=*/true, -1)
+ {
+ Eigen::initParallel();
+ }
bool place()
{
@@ -429,10 +432,10 @@ class HeAPPlacer
buckets_in_use.insert(bucket);
}
- for(auto cell_type : cell_types_in_use) {
+ for (auto cell_type : cell_types_in_use) {
fast_bels.addCellType(cell_type);
}
- for(auto bucket : buckets_in_use) {
+ for (auto bucket : buckets_in_use) {
fast_bels.addBelBucket(bucket);
}
@@ -500,8 +503,8 @@ class HeAPPlacer
continue;
}
- for(auto cell_type : cell_types) {
- if(ctx->isValidBelForCellType(cell_type, bel)) {
+ for (auto cell_type : cell_types) {
+ if (ctx->isValidBelForCellType(cell_type, bel)) {
available_bels[cell_type].push_back(bel);
}
}
@@ -532,23 +535,21 @@ class HeAPPlacer
// all.
if (!available_bels.count(ci->type)) {
log_error("Unable to place cell '%s', no BELs remaining to implement cell type '%s'\n",
- ci->name.c_str(ctx),
- ci->type.c_str(ctx));
+ ci->name.c_str(ctx), ci->type.c_str(ctx));
}
// Find an unused BEL from bels_for_cell_type.
auto &bels_for_cell_type = available_bels.at(ci->type);
BelId bel;
- while(true) {
+ while (true) {
if (bels_for_cell_type.empty()) {
log_error("Unable to place cell '%s', no BELs remaining to implement cell type '%s'\n",
- ci->name.c_str(ctx),
- ci->type.c_str(ctx));
+ ci->name.c_str(ctx), ci->type.c_str(ctx));
}
BelId candidate_bel = bels_for_cell_type.back();
bels_for_cell_type.pop_back();
- if(bels_used.count(candidate_bel)) {
+ if (bels_used.count(candidate_bel)) {
// candidate_bel has already been used by another
// cell type, skip it.
continue;
@@ -1202,13 +1203,12 @@ class HeAPPlacer
return int(fb.at(type)->at(x).at(y).size());
}
- bool is_cell_fixed(const CellInfo & cell) const {
+ bool is_cell_fixed(const CellInfo &cell) const
+ {
return buckets.count(ctx->getBelBucketForCellType(cell.type)) == 0;
}
- size_t cell_index(const CellInfo & cell) const {
- return type_index.at(ctx->getBelBucketForCellType(cell.type));
- }
+ size_t cell_index(const CellInfo &cell) const { return type_index.at(ctx->getBelBucketForCellType(cell.type)); }
void init()
{
@@ -1239,9 +1239,9 @@ class HeAPPlacer
for (auto &cell_loc : p->cell_locs) {
IdString cell_name = cell_loc.first;
- const CellInfo & cell = *ctx->cells.at(cell_name);
- const CellLocation & loc = cell_loc.second;
- if(is_cell_fixed(cell)) {
+ const CellInfo &cell = *ctx->cells.at(cell_name);
+ const CellLocation &loc = cell_loc.second;
+ if (is_cell_fixed(cell)) {
continue;
}
@@ -1261,9 +1261,9 @@ class HeAPPlacer
for (auto &cell_loc : p->cell_locs) {
IdString cell_name = cell_loc.first;
- const CellInfo & cell = *ctx->cells.at(cell_name);
- const CellLocation & loc = cell_loc.second;
- if(is_cell_fixed(cell)) {
+ const CellInfo &cell = *ctx->cells.at(cell_name);
+ const CellLocation &loc = cell_loc.second;
+ if (is_cell_fixed(cell)) {
continue;
}
@@ -1285,7 +1285,7 @@ class HeAPPlacer
}
for (auto cell : p->solve_cells) {
- if(is_cell_fixed(*cell)) {
+ if (is_cell_fixed(*cell)) {
continue;
}
@@ -1476,8 +1476,7 @@ class HeAPPlacer
if (reg.cells > reg.bels) {
IdString bucket_name = ctx->getBelBucketName(bucket);
log_error("Failed to expand region (%d, %d) |_> (%d, %d) of %d %ss\n", reg.x0, reg.y0,
- reg.x1, reg.y1, reg.cells.at(type_index.at(bucket)),
- bucket_name.c_str(ctx));
+ reg.x1, reg.y1, reg.cells.at(type_index.at(bucket)), bucket_name.c_str(ctx));
}
}
break;
diff --git a/ecp5/arch.cc b/ecp5/arch.cc
index fc618dac..25f95c53 100644
--- a/ecp5/arch.cc
+++ b/ecp5/arch.cc
@@ -117,11 +117,11 @@ Arch::Arch(ArchArgs args) : args(args)
bel_to_cell.resize(chip_info->height * chip_info->width * max_loc_bels, nullptr);
std::unordered_set<IdString> bel_types;
- for(BelId bel : getBels()) {
+ for (BelId bel : getBels()) {
bel_types.insert(getBelType(bel));
}
- for(IdString bel_type : bel_types) {
+ for (IdString bel_type : bel_types) {
cell_types.push_back(bel_type);
BelBucketId bucket;
diff --git a/ecp5/arch.h b/ecp5/arch.h
index e91def74..18a70fe8 100644
--- a/ecp5/arch.h
+++ b/ecp5/arch.h
@@ -950,44 +950,40 @@ struct Arch : BaseCtx
// -------------------------------------------------
// Placement validity checks
- bool isValidBelForCellType(IdString cell_type, BelId bel) const {
- return cell_type == getBelType(bel);
- }
+ bool isValidBelForCellType(IdString cell_type, BelId bel) const { return cell_type == getBelType(bel); }
- const std::vector<IdString> &getCellTypes() const {
- return cell_types;
- }
+ const std::vector<IdString> &getCellTypes() const { return cell_types; }
- std::vector<BelBucketId> getBelBuckets() const {
- return buckets;
- }
+ std::vector<BelBucketId> getBelBuckets() const { return buckets; }
- IdString getBelBucketName(BelBucketId bucket) const {
- return bucket.name;
- }
+ IdString getBelBucketName(BelBucketId bucket) const { return bucket.name; }
- BelBucketId getBelBucketByName(IdString name) const {
+ BelBucketId getBelBucketByName(IdString name) const
+ {
BelBucketId bucket;
bucket.name = name;
return bucket;
}
- BelBucketId getBelBucketForBel(BelId bel) const {
+ BelBucketId getBelBucketForBel(BelId bel) const
+ {
BelBucketId bucket;
bucket.name = getBelType(bel);
return bucket;
}
- BelBucketId getBelBucketForCellType(IdString cell_type) const {
+ BelBucketId getBelBucketForCellType(IdString cell_type) const
+ {
BelBucketId bucket;
bucket.name = cell_type;
return bucket;
}
- std::vector<BelId> getBelsInBucket(BelBucketId bucket) const {
+ std::vector<BelId> getBelsInBucket(BelBucketId bucket) const
+ {
std::vector<BelId> bels;
- for(BelId bel : getBels()) {
- if(getBelType(bel) == bucket.name) {
+ for (BelId bel : getBels()) {
+ if (getBelType(bel) == bucket.name) {
bels.push_back(bel);
}
}
diff --git a/ecp5/arch_pybindings.cc b/ecp5/arch_pybindings.cc
index b000ea78..e1adbb46 100644
--- a/ecp5/arch_pybindings.cc
+++ b/ecp5/arch_pybindings.cc
@@ -59,8 +59,8 @@ void arch_wrap_python(py::module &m)
typedef const PipRange UphillPipRange;
typedef const PipRange DownhillPipRange;
- typedef const std::vector<BelBucketId> & BelBucketRange;
- typedef const std::vector<BelId> & BelRangeForBelBucket;
+ typedef const std::vector<BelBucketId> &BelBucketRange;
+ typedef const std::vector<BelId> &BelRangeForBelBucket;
#include "arch_pybindings_shared.h"
WRAP_RANGE(m, Bel, conv_to_str<BelId>);
diff --git a/ecp5/archdefs.h b/ecp5/archdefs.h
index f766dee2..3bc75ab4 100644
--- a/ecp5/archdefs.h
+++ b/ecp5/archdefs.h
@@ -126,15 +126,13 @@ struct PipId
}
};
-struct BelBucketId {
+struct BelBucketId
+{
IdString name;
bool operator==(const BelBucketId &other) const { return (name == other.name); }
bool operator!=(const BelBucketId &other) const { return (name != other.name); }
- bool operator<(const BelBucketId &other) const
- {
- return name < other.name;
- }
+ bool operator<(const BelBucketId &other) const { return name < other.name; }
};
struct GroupId
diff --git a/generic/arch.h b/generic/arch.h
index 924115a7..f3e26bb5 100644
--- a/generic/arch.h
+++ b/generic/arch.h
@@ -271,40 +271,32 @@ struct Arch : BaseCtx
bool place();
bool route();
- std::vector<IdString> getCellTypes() const {
+ std::vector<IdString> getCellTypes() const
+ {
std::vector<IdString> cell_types;
cell_types.reserve(bels.size());
- for(auto bel : bels) {
+ for (auto bel : bels) {
cell_types.push_back(bel.first);
}
return cell_types;
}
- std::vector<BelBucketId> getBelBuckets() const {
- return getCellTypes();
- }
+ std::vector<BelBucketId> getBelBuckets() const { return getCellTypes(); }
- IdString getBelBucketName(BelBucketId bucket) const {
- return bucket;
- }
+ IdString getBelBucketName(BelBucketId bucket) const { return bucket; }
- BelBucketId getBelBucketByName(IdString bucket) const {
- return bucket;
- }
+ BelBucketId getBelBucketByName(IdString bucket) const { return bucket; }
- BelBucketId getBelBucketForBel(BelId bel) const {
- return getBelType(bel);
- }
+ BelBucketId getBelBucketForBel(BelId bel) const { return getBelType(bel); }
- BelBucketId getBelBucketForCellType(IdString cell_type) const {
- return cell_type;
- }
+ BelBucketId getBelBucketForCellType(IdString cell_type) const { return cell_type; }
- std::vector<BelId> getBelsInBucket(BelBucketId bucket) const {
+ std::vector<BelId> getBelsInBucket(BelBucketId bucket) const
+ {
std::vector<BelId> bels;
- for(BelId bel : getBels()) {
- if(bucket == getBelBucketForBel(bel)) {
+ for (BelId bel : getBels()) {
+ if (bucket == getBelBucketForBel(bel)) {
bels.push_back(bel);
}
}
@@ -323,9 +315,7 @@ struct Arch : BaseCtx
// Get the TimingClockingInfo of a port
TimingClockingInfo getPortClockingInfo(const CellInfo *cell, IdString port, int index) const;
- bool isValidBelForCellType(IdString cell_type, BelId bel) const {
- return cell_type == getBelType(bel);
- }
+ bool isValidBelForCellType(IdString cell_type, BelId bel) const { return cell_type == getBelType(bel); }
bool isValidBelForCell(CellInfo *cell, BelId bel) const;
bool isBelLocationValid(BelId bel) const;
diff --git a/generic/arch_pybindings.cc b/generic/arch_pybindings.cc
index 9e98bfe5..23f2c05c 100644
--- a/generic/arch_pybindings.cc
+++ b/generic/arch_pybindings.cc
@@ -227,30 +227,26 @@ void arch_wrap_python(py::module &m)
"clock"_a, "clktoq"_a);
// const\_range\<BelBucketId\> getBelBuckets() const
- fn_wrapper_0a<Context, decltype(&Context::getBelBuckets),
- &Context::getBelBuckets,
- wrap_context<const std::vector<BelBucketId> &>>::def_wrap(ctx_cls, "getBelBuckets");
+ fn_wrapper_0a<Context, decltype(&Context::getBelBuckets), &Context::getBelBuckets,
+ wrap_context<const std::vector<BelBucketId> &>>::def_wrap(ctx_cls, "getBelBuckets");
// BelBucketId getBelBucketForBel(BelId bel) const
- fn_wrapper_1a<Context, decltype(&Context::getBelBucketForBel),
- &Context::getBelBucketForBel, conv_to_str<BelBucketId>,
- conv_from_str<BelId>>::def_wrap(ctx_cls, "getBelBucketForBel");
+ fn_wrapper_1a<Context, decltype(&Context::getBelBucketForBel), &Context::getBelBucketForBel,
+ conv_to_str<BelBucketId>, conv_from_str<BelId>>::def_wrap(ctx_cls, "getBelBucketForBel");
// BelBucketId getBelBucketForCellType(IdString cell\_type) const
- fn_wrapper_1a<Context, decltype(&Context::getBelBucketForCellType),
- &Context::getBelBucketForCellType, conv_to_str<BelBucketId>,
- conv_from_str<IdString>>::def_wrap(ctx_cls, "getBelBucketForCellType");
+ fn_wrapper_1a<Context, decltype(&Context::getBelBucketForCellType), &Context::getBelBucketForCellType,
+ conv_to_str<BelBucketId>, conv_from_str<IdString>>::def_wrap(ctx_cls, "getBelBucketForCellType");
// const\_range\<BelId\> getBelsInBucket(BelBucketId bucket) const
- fn_wrapper_1a<Context, decltype(&Context::getBelsInBucket),
- &Context::getBelsInBucket, wrap_context<const std::vector<BelId> &>,
- conv_from_str<BelBucketId>>::def_wrap(ctx_cls, "getBelsInBucket");
+ fn_wrapper_1a<Context, decltype(&Context::getBelsInBucket), &Context::getBelsInBucket,
+ wrap_context<const std::vector<BelId> &>, conv_from_str<BelBucketId>>::def_wrap(ctx_cls,
+ "getBelsInBucket");
// bool isValidBelForCellType(IdString cell\_type, BelId bel) const
- fn_wrapper_2a<Context, decltype(&Context::isValidBelForCellType),
- &Context::isValidBelForCellType, pass_through<bool>,
- conv_from_str<IdString>, conv_from_str<BelId>>::def_wrap(
- ctx_cls, "isValidBelForCellType");
+ fn_wrapper_2a<Context, decltype(&Context::isValidBelForCellType), &Context::isValidBelForCellType,
+ pass_through<bool>, conv_from_str<IdString>, conv_from_str<BelId>>::def_wrap(ctx_cls,
+ "isValidBelForCellType");
WRAP_MAP_UPTR(m, CellMap, "IdCellMap");
WRAP_MAP_UPTR(m, NetMap, "IdNetMap");
diff --git a/gowin/arch.cc b/gowin/arch.cc
index cd4048ca..5a1a56e3 100644
--- a/gowin/arch.cc
+++ b/gowin/arch.cc
@@ -741,11 +741,11 @@ Arch::Arch(ArchArgs args) : args(args)
decal_graphics[IdString()];
std::unordered_set<IdString> bel_types;
- for(BelId bel : getBels()) {
+ for (BelId bel : getBels()) {
bel_types.insert(getBelType(bel));
}
- for(IdString bel_type : bel_types) {
+ for (IdString bel_type : bel_types) {
cell_types.push_back(bel_type);
}
}
diff --git a/gowin/arch.h b/gowin/arch.h
index 6304a15c..f12c604e 100644
--- a/gowin/arch.h
+++ b/gowin/arch.h
@@ -422,38 +422,25 @@ struct Arch : BaseCtx
// Get the TimingClockingInfo of a port
TimingClockingInfo getPortClockingInfo(const CellInfo *cell, IdString port, int index) const;
- bool isValidBelForCellType(IdString cell_type, BelId bel) const {
- return cell_type == getBelType(bel);
- }
+ bool isValidBelForCellType(IdString cell_type, BelId bel) const { return cell_type == getBelType(bel); }
- const std::vector<IdString> &getCellTypes() const {
- return cell_types;
- }
+ const std::vector<IdString> &getCellTypes() const { return cell_types; }
- std::vector<BelBucketId> getBelBuckets() const {
- return cell_types;
- }
+ std::vector<BelBucketId> getBelBuckets() const { return cell_types; }
- IdString getBelBucketName(BelBucketId bucket) const {
- return bucket;
- }
+ IdString getBelBucketName(BelBucketId bucket) const { return bucket; }
- BelBucketId getBelBucketByName(IdString name) const {
- return name;
- }
+ BelBucketId getBelBucketByName(IdString name) const { return name; }
- BelBucketId getBelBucketForBel(BelId bel) const {
- return getBelType(bel);
- }
+ BelBucketId getBelBucketForBel(BelId bel) const { return getBelType(bel); }
- BelBucketId getBelBucketForCellType(IdString cell_type) const {
- return cell_type;
- }
+ BelBucketId getBelBucketForCellType(IdString cell_type) const { return cell_type; }
- std::vector<BelId> getBelsInBucket(BelBucketId bucket) const {
+ std::vector<BelId> getBelsInBucket(BelBucketId bucket) const
+ {
std::vector<BelId> bels;
- for(BelId bel : getBels()) {
- if(getBelType(bel) == bucket) {
+ for (BelId bel : getBels()) {
+ if (getBelType(bel) == bucket) {
bels.push_back(bel);
}
}
diff --git a/ice40/arch.cc b/ice40/arch.cc
index 1849d993..6fe77e4b 100644
--- a/ice40/arch.cc
+++ b/ice40/arch.cc
@@ -117,11 +117,11 @@ Arch::Arch(ArchArgs args) : args(args)
switches_locked.resize(chip_info->num_switches);
std::unordered_set<IdString> bel_types;
- for(BelId bel : getBels()) {
+ for (BelId bel : getBels()) {
bel_types.insert(getBelType(bel));
}
- for(IdString bel_type : bel_types) {
+ for (IdString bel_type : bel_types) {
cell_types.push_back(bel_type);
BelBucketId bucket;
diff --git a/ice40/arch.h b/ice40/arch.h
index ddad1658..fd92d988 100644
--- a/ice40/arch.h
+++ b/ice40/arch.h
@@ -822,44 +822,40 @@ struct Arch : BaseCtx
// implemented in arch_place.cc)
// Whether this cell type can be placed at this BEL.
- bool isValidBelForCellType(IdString cell_type, BelId bel) const {
- return cell_type == getBelType(bel);
- }
+ bool isValidBelForCellType(IdString cell_type, BelId bel) const { return cell_type == getBelType(bel); }
- const std::vector<IdString> &getCellTypes() const {
- return cell_types;
- }
+ const std::vector<IdString> &getCellTypes() const { return cell_types; }
- std::vector<BelBucketId> getBelBuckets() const {
- return buckets;
- }
+ std::vector<BelBucketId> getBelBuckets() const { return buckets; }
- IdString getBelBucketName(BelBucketId bucket) const {
- return bucket.name;
- }
+ IdString getBelBucketName(BelBucketId bucket) const { return bucket.name; }
- BelBucketId getBelBucketByName(IdString name) const {
+ BelBucketId getBelBucketByName(IdString name) const
+ {
BelBucketId bucket;
bucket.name = name;
return bucket;
}
- BelBucketId getBelBucketForBel(BelId bel) const {
+ BelBucketId getBelBucketForBel(BelId bel) const
+ {
BelBucketId bucket;
bucket.name = getBelType(bel);
return bucket;
}
- BelBucketId getBelBucketForCellType(IdString cell_type) const {
+ BelBucketId getBelBucketForCellType(IdString cell_type) const
+ {
BelBucketId bucket;
bucket.name = cell_type;
return bucket;
}
- std::vector<BelId> getBelsInBucket(BelBucketId bucket) const {
+ std::vector<BelId> getBelsInBucket(BelBucketId bucket) const
+ {
std::vector<BelId> bels;
- for(BelId bel : getBels()) {
- if(getBelType(bel) == bucket.name) {
+ for (BelId bel : getBels()) {
+ if (getBelType(bel) == bucket.name) {
bels.push_back(bel);
}
}
diff --git a/ice40/arch_pybindings.cc b/ice40/arch_pybindings.cc
index 060cf0b1..76ce7590 100644
--- a/ice40/arch_pybindings.cc
+++ b/ice40/arch_pybindings.cc
@@ -75,8 +75,8 @@ void arch_wrap_python(py::module &m)
typedef const PipRange UphillPipRange;
typedef const PipRange DownhillPipRange;
- typedef const std::vector<BelBucketId> & BelBucketRange;
- typedef const std::vector<BelId> & BelRangeForBelBucket;
+ typedef const std::vector<BelBucketId> &BelBucketRange;
+ typedef const std::vector<BelId> &BelRangeForBelBucket;
#include "arch_pybindings_shared.h"
WRAP_RANGE(m, Bel, conv_to_str<BelId>);
@@ -85,7 +85,6 @@ void arch_wrap_python(py::module &m)
WRAP_RANGE(m, Pip, conv_to_str<PipId>);
WRAP_RANGE(m, BelPin, wrap_context<BelPin>);
-
WRAP_MAP_UPTR(m, CellMap, "IdCellMap");
WRAP_MAP_UPTR(m, NetMap, "IdNetMap");
WRAP_MAP(m, HierarchyMap, wrap_context<HierarchicalCell &>, "HierarchyMap");
diff --git a/ice40/archdefs.h b/ice40/archdefs.h
index 37249331..c0a6ac66 100644
--- a/ice40/archdefs.h
+++ b/ice40/archdefs.h
@@ -170,15 +170,13 @@ struct ArchCellInfo
};
};
-struct BelBucketId {
+struct BelBucketId
+{
IdString name;
bool operator==(const BelBucketId &other) const { return (name == other.name); }
bool operator!=(const BelBucketId &other) const { return (name != other.name); }
- bool operator<(const BelBucketId &other) const
- {
- return name < other.name;
- }
+ bool operator<(const BelBucketId &other) const { return name < other.name; }
};
NEXTPNR_NAMESPACE_END
diff --git a/nexus/arch.cc b/nexus/arch.cc
index 79e00e0d..95b409bf 100644
--- a/nexus/arch.cc
+++ b/nexus/arch.cc
@@ -173,11 +173,11 @@ Arch::Arch(ArchArgs args) : args(args)
log_error("Unknown speed grade '%s'.\n", speed.c_str());
std::unordered_set<IdString> bel_types;
- for(BelId bel : getBels()) {
+ for (BelId bel : getBels()) {
bel_types.insert(getBelType(bel));
}
- for(IdString bel_type : bel_types) {
+ for (IdString bel_type : bel_types) {
cell_types.push_back(bel_type);
BelBucketId bucket;
diff --git a/nexus/arch.h b/nexus/arch.h
index 9b3aea20..ee66599a 100644
--- a/nexus/arch.h
+++ b/nexus/arch.h
@@ -1336,44 +1336,40 @@ struct Arch : BaseCtx
// implemented in arch_place.cc)
// Whether this cell type can be placed at this BEL.
- bool isValidBelForCellType(IdString cell_type, BelId bel) const {
- return cell_type == getBelType(bel);
- }
+ bool isValidBelForCellType(IdString cell_type, BelId bel) const { return cell_type == getBelType(bel); }
- const std::vector<IdString> &getCellTypes() const {
- return cell_types;
- }
+ const std::vector<IdString> &getCellTypes() const { return cell_types; }
- std::vector<BelBucketId> getBelBuckets() const {
- return buckets;
- }
+ std::vector<BelBucketId> getBelBuckets() const { return buckets; }
- IdString getBelBucketName(BelBucketId bucket) const {
- return bucket.name;
- }
+ IdString getBelBucketName(BelBucketId bucket) const { return bucket.name; }
- BelBucketId getBelBucketByName(IdString name) const {
+ BelBucketId getBelBucketByName(IdString name) const
+ {
BelBucketId bucket;
bucket.name = name;
return bucket;
}
- BelBucketId getBelBucketForBel(BelId bel) const {
+ BelBucketId getBelBucketForBel(BelId bel) const
+ {
BelBucketId bucket;
bucket.name = getBelType(bel);
return bucket;
}
- BelBucketId getBelBucketForCellType(IdString cell_type) const {
+ BelBucketId getBelBucketForCellType(IdString cell_type) const
+ {
BelBucketId bucket;
bucket.name = cell_type;
return bucket;
}
- std::vector<BelId> getBelsInBucket(BelBucketId bucket) const {
+ std::vector<BelId> getBelsInBucket(BelBucketId bucket) const
+ {
std::vector<BelId> bels;
- for(BelId bel : getBels()) {
- if(getBelType(bel) == bucket.name) {
+ for (BelId bel : getBels()) {
+ if (getBelType(bel) == bucket.name) {
bels.push_back(bel);
}
}
diff --git a/nexus/arch_pybindings.cc b/nexus/arch_pybindings.cc
index cf0badae..b07031f7 100644
--- a/nexus/arch_pybindings.cc
+++ b/nexus/arch_pybindings.cc
@@ -55,8 +55,8 @@ void arch_wrap_python(py::module &m)
typedef UpDownhillPipRange DownhillPipRange;
typedef WireBelPinRange BelPinRange;
- typedef const std::vector<BelBucketId> & BelBucketRange;
- typedef const std::vector<BelId> & BelRangeForBelBucket;
+ typedef const std::vector<BelBucketId> &BelBucketRange;
+ typedef const std::vector<BelId> &BelRangeForBelBucket;
#include "arch_pybindings_shared.h"
diff --git a/nexus/archdefs.h b/nexus/archdefs.h
index 52f5cf58..7e427e06 100644
--- a/nexus/archdefs.h
+++ b/nexus/archdefs.h
@@ -114,15 +114,13 @@ struct PipId
}
};
-struct BelBucketId {
+struct BelBucketId
+{
IdString name;
bool operator==(const BelBucketId &other) const { return (name == other.name); }
bool operator!=(const BelBucketId &other) const { return (name != other.name); }
- bool operator<(const BelBucketId &other) const
- {
- return name < other.name;
- }
+ bool operator<(const BelBucketId &other) const { return name < other.name; }
};
struct GroupId