From 3175891cb53ef5f9299d2897c286a803a47c9779 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 21 Jul 2018 19:48:00 +0200 Subject: Map ports to nets --- ice40/bitstream.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'ice40/bitstream.cc') diff --git a/ice40/bitstream.cc b/ice40/bitstream.cc index 65c90eb1..8819a643 100644 --- a/ice40/bitstream.cc +++ b/ice40/bitstream.cc @@ -758,6 +758,20 @@ bool read_asc(Context *ctx, std::istream &in) } } } + for (auto &cell : ctx->cells) { + if (cell.second->bel != BelId()) { + for (auto &port : cell.second->ports) { + PortPin pin = ctx->portPinFromId(port.first); + WireId wire = ctx->getWireBelPin(cell.second->bel, pin); + if (wire != WireId()) { + IdString name = ctx->getBoundWireNet(wire); + if (name != IdString()) { + port.second.net = ctx->nets[name].get(); + } + } + } + } + } return true; } catch (log_execution_error_exception) { return false; -- cgit v1.2.3