aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/design_utils.cc8
-rw-r--r--common/nextpnr.cc4
-rw-r--r--common/nextpnr.h6
-rw-r--r--common/place_common.cc4
-rw-r--r--common/placer1.cc16
5 files changed, 19 insertions, 19 deletions
diff --git a/common/design_utils.cc b/common/design_utils.cc
index 6876babe..21c9dcc4 100644
--- a/common/design_utils.cc
+++ b/common/design_utils.cc
@@ -55,18 +55,18 @@ void replace_port(CellInfo *old_cell, IdString old_name, CellInfo *rep_cell, IdS
void print_utilisation(const Context *ctx)
{
// Sort by Bel type
- std::map<BelType, int> used_types;
+ std::map<IdString, int> used_types;
for (auto &cell : ctx->cells) {
- used_types[ctx->belTypeFromId(cell.second.get()->type)]++;
+ used_types[cell.second.get()->type]++;
}
- std::map<BelType, int> available_types;
+ std::map<IdString, int> available_types;
for (auto bel : ctx->getBels()) {
available_types[ctx->getBelType(bel)]++;
}
log_break();
log_info("Device utilisation:\n");
for (auto type : available_types) {
- IdString type_id = ctx->belTypeToId(type.first);
+ IdString type_id = type.first;
int used_bels = get_or_default(used_types, type.first, 0);
log_info("\t%20s: %5d/%5d %5d%%\n", type_id.c_str(ctx), used_bels, type.second, 100 * used_bels / type.second);
}
diff --git a/common/nextpnr.cc b/common/nextpnr.cc
index 3bdca166..b04679ad 100644
--- a/common/nextpnr.cc
+++ b/common/nextpnr.cc
@@ -67,7 +67,7 @@ WireId Context::getNetinfoSourceWire(const NetInfo *net_info) const
if (driver_port_it != net_info->driver.cell->pins.end())
driver_port = driver_port_it->second;
- return getBelPinWire(src_bel, portPinFromId(driver_port));
+ return getBelPinWire(src_bel, driver_port);
}
WireId Context::getNetinfoSinkWire(const NetInfo *net_info, const PortRef &user_info) const
@@ -84,7 +84,7 @@ WireId Context::getNetinfoSinkWire(const NetInfo *net_info, const PortRef &user_
if (user_port_it != user_info.cell->pins.end())
user_port = user_port_it->second;
- return getBelPinWire(dst_bel, portPinFromId(user_port));
+ return getBelPinWire(dst_bel, user_port);
}
delay_t Context::getNetinfoRouteDelay(const NetInfo *net_info, const PortRef &user_info) const
diff --git a/common/nextpnr.h b/common/nextpnr.h
index 3d9a66ca..f231f1b8 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -100,13 +100,13 @@ struct Context;
struct IdString
{
- int index = 0;
+ int index;
static void initialize_arch(const BaseCtx *ctx);
static void initialize_add(const BaseCtx *ctx, const char *s, int idx);
- IdString() {}
+ constexpr IdString(int index = 0) : index(index) {}
void set(const BaseCtx *ctx, const std::string &s);
@@ -211,7 +211,7 @@ struct DecalXY
struct BelPin
{
BelId bel;
- PortPin pin;
+ IdString pin;
};
struct CellInfo;
diff --git a/common/place_common.cc b/common/place_common.cc
index fe9cf03d..f9867057 100644
--- a/common/place_common.cc
+++ b/common/place_common.cc
@@ -115,7 +115,7 @@ bool place_single_cell(Context *ctx, CellInfo *cell, bool require_legality)
if (cell->bel != BelId()) {
ctx->unbindBel(cell->bel);
}
- BelType targetType = ctx->belTypeFromId(cell->type);
+ IdString targetType = cell->type;
for (auto bel : ctx->getBels()) {
if (ctx->getBelType(bel) == targetType && (!require_legality || ctx->isValidBelForCell(cell, bel))) {
if (ctx->checkBelAvail(bel)) {
@@ -228,7 +228,7 @@ class ConstraintLegaliseWorker
if (locBel == BelId()) {
return false;
}
- if (ctx->getBelType(locBel) != ctx->belTypeFromId(cell->type)) {
+ if (ctx->getBelType(locBel) != cell->type) {
return false;
}
if (!ctx->checkBelAvail(locBel)) {
diff --git a/common/placer1.cc b/common/placer1.cc
index 1d00e77a..36a607d7 100644
--- a/common/placer1.cc
+++ b/common/placer1.cc
@@ -51,7 +51,7 @@ class SAPlacer
int num_bel_types = 0;
for (auto bel : ctx->getBels()) {
Loc loc = ctx->getBelLocation(bel);
- BelType type = ctx->getBelType(bel);
+ IdString type = ctx->getBelType(bel);
int type_idx;
if (bel_types.find(type) == bel_types.end()) {
type_idx = num_bel_types++;
@@ -91,17 +91,17 @@ class SAPlacer
loc_name.c_str(), cell->name.c_str(ctx));
}
- BelType bel_type = ctx->getBelType(bel);
- if (bel_type != ctx->belTypeFromId(cell->type)) {
+ IdString bel_type = ctx->getBelType(bel);
+ if (bel_type != cell->type) {
log_error("Bel \'%s\' of type \'%s\' does not match cell "
"\'%s\' of type \'%s\'\n",
- loc_name.c_str(), ctx->belTypeToId(bel_type).c_str(ctx), cell->name.c_str(ctx),
+ loc_name.c_str(), bel_type.c_str(ctx), cell->name.c_str(ctx),
cell->type.c_str(ctx));
}
if (!ctx->isValidBelForCell(cell, bel)) {
log_error("Bel \'%s\' of type \'%s\' is not valid for cell "
"\'%s\' of type \'%s\'\n",
- loc_name.c_str(), ctx->belTypeToId(bel_type).c_str(ctx), cell->name.c_str(ctx),
+ loc_name.c_str(), bel_type.c_str(ctx), cell->name.c_str(ctx),
cell->type.c_str(ctx));
}
@@ -297,7 +297,7 @@ class SAPlacer
if (cell->bel != BelId()) {
ctx->unbindBel(cell->bel);
}
- BelType targetType = ctx->belTypeFromId(cell->type);
+ IdString targetType = cell->type;
for (auto bel : ctx->getBels()) {
if (ctx->getBelType(bel) == targetType && ctx->isValidBelForCell(cell, bel)) {
if (ctx->checkBelAvail(bel)) {
@@ -420,7 +420,7 @@ class SAPlacer
// diameter
BelId random_bel_for_cell(CellInfo *cell)
{
- BelType targetType = ctx->belTypeFromId(cell->type);
+ IdString targetType = cell->type;
Loc curr_loc = ctx->getBelLocation(cell->bel);
while (true) {
int nx = ctx->rng(2 * diameter + 1) + std::max(curr_loc.x - diameter, 0);
@@ -448,7 +448,7 @@ class SAPlacer
bool improved = false;
int n_move, n_accept;
int diameter = 35, max_x = 1, max_y = 1;
- std::unordered_map<BelType, int> bel_types;
+ std::unordered_map<IdString, int> bel_types;
std::vector<std::vector<std::vector<std::vector<BelId>>>> fast_bels;
std::unordered_set<BelId> locked_bels;
bool require_legal = false;