aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanG077 <goemansrowan@gmail.com>2023-02-06 17:04:30 +0100
committerrowanG077 <goemansrowan@gmail.com>2023-02-06 17:05:28 +0100
commit9e8f8b7b45b4060531190259b2cfaae4d18819f1 (patch)
treea265347874f5dcff164eb146acd92c384bb55e13
parentd2bf44ba45370af601e1db9fe1cb02d3e58c8e27 (diff)
downloadnextpnr-9e8f8b7b45b4060531190259b2cfaae4d18819f1.tar.gz
nextpnr-9e8f8b7b45b4060531190259b2cfaae4d18819f1.tar.bz2
nextpnr-9e8f8b7b45b4060531190259b2cfaae4d18819f1.zip
streamline constant_net detection
-rw-r--r--ecp5/pack.cc6
-rw-r--r--ice40/pack.cc6
2 files changed, 8 insertions, 4 deletions
diff --git a/ecp5/pack.cc b/ecp5/pack.cc
index 7033319f..a6f31656 100644
--- a/ecp5/pack.cc
+++ b/ecp5/pack.cc
@@ -38,10 +38,12 @@ static bool is_nextpnr_iob(Context *ctx, CellInfo *cell)
static bool net_is_constant(const Context *ctx, NetInfo *net, bool &value)
{
+ auto gnd = ctx->id("$PACKER_GND_NET");
+ auto vcc = ctx->id("$PACKER_VCC_NET");
if (net == nullptr)
return false;
- if (net->name == ctx->id("$PACKER_GND_NET") || net->name == ctx->id("$PACKER_VCC_NET")) {
- value = (net->name == ctx->id("$PACKER_VCC_NET"));
+ if (net->name.in(gnd, vcc)) {
+ value = (net->name == vcc);
return true;
} else {
return false;
diff --git a/ice40/pack.cc b/ice40/pack.cc
index c9811721..f8944685 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -132,10 +132,12 @@ static void pack_nonlut_ffs(Context *ctx)
static bool net_is_constant(const Context *ctx, NetInfo *net, bool &value)
{
+ auto gnd = ctx->id("$PACKER_GND_NET");
+ auto vcc = ctx->id("$PACKER_VCC_NET");
if (net == nullptr)
return false;
- if (net->name == ctx->id("$PACKER_GND_NET") || net->name == ctx->id("$PACKER_VCC_NET")) {
- value = (net->name == ctx->id("$PACKER_VCC_NET"));
+ if (net->name.in(gnd, vcc)) {
+ value = (net->name == vcc);
return true;
} else {
return false;