aboutsummaryrefslogtreecommitdiffstats
path: root/mistral
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2022-02-26 15:17:46 +0000
committergatecat <gatecat@ds0.me>2022-02-27 13:47:05 +0000
commit86699b42f619960bfefd4d0b479dd44a90527ea4 (patch)
tree06997246ae104b75ce472215fcee3ba37ee5c50c /mistral
parent434a9737bb459189b463c8768454ea6c0e151406 (diff)
downloadnextpnr-86699b42f619960bfefd4d0b479dd44a90527ea4.tar.gz
nextpnr-86699b42f619960bfefd4d0b479dd44a90527ea4.tar.bz2
nextpnr-86699b42f619960bfefd4d0b479dd44a90527ea4.zip
Switch to potentially-sparse net users array
This uses a new data structure for net.users that allows gaps, so removing a port from a net is no longer an O(n) operation on the number of users the net has. Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'mistral')
-rw-r--r--mistral/pack.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/mistral/pack.cc b/mistral/pack.cc
index c4b3afe3..703fa386 100644
--- a/mistral/pack.cc
+++ b/mistral/pack.cc
@@ -200,10 +200,10 @@ struct MistralPacker
NetInfo *o = ci->getPort(id_O);
if (o == nullptr)
;
- else if (o->users.size() > 1)
+ else if (o->users.entries() > 1)
log_error("Top level pin '%s' has multiple input buffers\n", ctx->nameOf(port.first));
- else if (o->users.size() == 1)
- top_port = o->users.at(0);
+ else if (o->users.entries() == 1)
+ top_port = *o->users.begin();
}
if (ci->type == ctx->id("$nextpnr_obuf") || ci->type == ctx->id("$nextpnr_iobuf")) {
// Might have an output buffer (OB etc) connected to it
@@ -215,9 +215,9 @@ struct MistralPacker
top_port = i->driver;
}
// Edge case of a bidirectional buffer driving an output pin
- if (i->users.size() > 2) {
+ if (i->users.entries() > 2) {
log_error("Top level pin '%s' has illegal buffer configuration\n", ctx->nameOf(port.first));
- } else if (i->users.size() == 2) {
+ } else if (i->users.entries() == 2) {
if (top_port.cell != nullptr)
log_error("Top level pin '%s' has illegal buffer configuration\n", ctx->nameOf(port.first));
for (auto &usr : i->users) {
@@ -300,9 +300,9 @@ struct MistralPacker
const NetInfo *co = cursor->getPort(id_CO);
if (co == nullptr || co->users.empty())
break;
- if (co->users.size() > 1)
+ if (co->users.entries() > 1)
log_error("Carry net %s has more than one sink!\n", ctx->nameOf(co));
- auto &usr = co->users.at(0);
+ auto &usr = *co->users.begin();
if (usr.port != id_CI)
log_error("Carry net %s drives port %s, expected CI\n", ctx->nameOf(co), ctx->nameOf(usr.port));
cursor = usr.cell;