aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-11-11 11:34:38 +0100
committerClifford Wolf <clifford@clifford.at>2018-11-11 11:34:38 +0100
commitd2bdb670c0be9e18722f79c170fc99d7f41768f1 (patch)
treec699864e888a9755e6a3f1aa958b8953e638e5f3 /ice40
parent285bffeac5ace1679489c2d23c8c5dc4b06f0bfc (diff)
downloadnextpnr-d2bdb670c0be9e18722f79c170fc99d7f41768f1.tar.gz
nextpnr-d2bdb670c0be9e18722f79c170fc99d7f41768f1.tar.bz2
nextpnr-d2bdb670c0be9e18722f79c170fc99d7f41768f1.zip
Add getConflictingPipWire() arch API, router1 improvements
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'ice40')
-rw-r--r--ice40/arch.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/ice40/arch.h b/ice40/arch.h
index 27d5db9f..46f2b348 100644
--- a/ice40/arch.h
+++ b/ice40/arch.h
@@ -404,7 +404,7 @@ struct Arch : BaseCtx
std::vector<CellInfo *> bel_to_cell;
std::vector<NetInfo *> wire_to_net;
std::vector<NetInfo *> pip_to_net;
- std::vector<NetInfo *> switches_locked;
+ std::vector<WireId> switches_locked;
ArchArgs args;
Arch(ArchArgs args);
@@ -546,7 +546,7 @@ struct Arch : BaseCtx
auto pip = it->second.pip;
if (pip != PipId()) {
pip_to_net[pip.index] = nullptr;
- switches_locked[chip_info->pip_data[pip.index].switch_index] = nullptr;
+ switches_locked[chip_info->pip_data[pip.index].switch_index] = WireId();
}
net_wires.erase(it);
@@ -608,14 +608,15 @@ struct Arch : BaseCtx
{
NPNR_ASSERT(pip != PipId());
NPNR_ASSERT(pip_to_net[pip.index] == nullptr);
- NPNR_ASSERT(switches_locked[chip_info->pip_data[pip.index].switch_index] == nullptr);
-
- pip_to_net[pip.index] = net;
- switches_locked[chip_info->pip_data[pip.index].switch_index] = net;
+ NPNR_ASSERT(switches_locked[chip_info->pip_data[pip.index].switch_index] == WireId());
WireId dst;
dst.index = chip_info->pip_data[pip.index].dst;
NPNR_ASSERT(wire_to_net[dst.index] == nullptr);
+
+ pip_to_net[pip.index] = net;
+ switches_locked[chip_info->pip_data[pip.index].switch_index] = dst;
+
wire_to_net[dst.index] = net;
net->wires[dst].pip = pip;
net->wires[dst].strength = strength;
@@ -627,7 +628,7 @@ struct Arch : BaseCtx
{
NPNR_ASSERT(pip != PipId());
NPNR_ASSERT(pip_to_net[pip.index] != nullptr);
- NPNR_ASSERT(switches_locked[chip_info->pip_data[pip.index].switch_index] != nullptr);
+ NPNR_ASSERT(switches_locked[chip_info->pip_data[pip.index].switch_index] != WireId());
WireId dst;
dst.index = chip_info->pip_data[pip.index].dst;
@@ -636,7 +637,7 @@ struct Arch : BaseCtx
pip_to_net[pip.index]->wires.erase(dst);
pip_to_net[pip.index] = nullptr;
- switches_locked[chip_info->pip_data[pip.index].switch_index] = nullptr;
+ switches_locked[chip_info->pip_data[pip.index].switch_index] = WireId();
refreshUiPip(pip);
refreshUiWire(dst);
}
@@ -647,7 +648,7 @@ struct Arch : BaseCtx
auto &pi = chip_info->pip_data[pip.index];
auto &si = chip_info->bits_info->switches[pi.switch_index];
- if (switches_locked[pi.switch_index] != nullptr)
+ if (switches_locked[pi.switch_index] != WireId())
return false;
if (pi.flags & PipInfoPOD::FLAG_ROUTETHRU) {
@@ -674,6 +675,13 @@ struct Arch : BaseCtx
NetInfo *getConflictingPipNet(PipId pip) const
{
NPNR_ASSERT(pip != PipId());
+ WireId wire = switches_locked[chip_info->pip_data[pip.index].switch_index];
+ return wire == WireId() ? nullptr : wire_to_net[wire.index];
+ }
+
+ WireId getConflictingPipWire(PipId pip) const
+ {
+ NPNR_ASSERT(pip != PipId());
return switches_locked[chip_info->pip_data[pip.index].switch_index];
}