diff options
author | David Shah <davey1576@gmail.com> | 2018-06-10 12:17:55 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-10 12:17:55 +0200 |
commit | 6da8f98eacab15fad804ffa66ca95acb6350bbf3 (patch) | |
tree | 2d0f6dce48ea36bd07da6882635905af0dc674a6 | |
parent | 827a43c88c75f5daf4f3a626fce0e5dd1b3d47f2 (diff) | |
download | nextpnr-6da8f98eacab15fad804ffa66ca95acb6350bbf3.tar.gz nextpnr-6da8f98eacab15fad804ffa66ca95acb6350bbf3.tar.bz2 nextpnr-6da8f98eacab15fad804ffa66ca95acb6350bbf3.zip |
ice40: Lock out mutually exclusive pips
Signed-off-by: David Shah <davey1576@gmail.com>
-rw-r--r-- | ice40/chip.cc | 1 | ||||
-rw-r--r-- | ice40/chip.h | 14 |
2 files changed, 13 insertions, 2 deletions
diff --git a/ice40/chip.cc b/ice40/chip.cc index c2fba89f..0caabe0c 100644 --- a/ice40/chip.cc +++ b/ice40/chip.cc @@ -97,6 +97,7 @@ Chip::Chip(ChipArgs args) : args(args) bel_to_cell.resize(chip_info.num_bels); wire_to_net.resize(chip_info.num_wires); pip_to_net.resize(chip_info.num_pips); + pips_locked.resize(chip_info.num_pips); } // ----------------------------------------------------------------------- diff --git a/ice40/chip.h b/ice40/chip.h index 45987803..1a978fcd 100644 --- a/ice40/chip.h +++ b/ice40/chip.h @@ -404,7 +404,7 @@ struct Chip vector<IdString> bel_to_cell; vector<IdString> wire_to_net; vector<IdString> pip_to_net; - + vector<bool> pips_locked; Chip(ChipArgs args); ChipArgs args; @@ -561,6 +561,11 @@ struct Chip assert(pip != PipId()); assert(pip_to_net[pip.index] == IdString()); pip_to_net[pip.index] = net; + // Optimise? + for (int i = 0; i < chip_info.num_pips; i++) { + if (chip_info.pip_data[i].switch_index == chip_info.pip_data[pip.index].switch_index) + pips_locked[i] = true; + } } void unbindPip(PipId pip) @@ -568,12 +573,17 @@ struct Chip assert(pip != PipId()); assert(pip_to_net[pip.index] != IdString()); pip_to_net[pip.index] = IdString(); + // Optimise? + for (int i = 0; i < chip_info.num_pips; i++) { + if (chip_info.pip_data[i].switch_index == chip_info.pip_data[pip.index].switch_index) + pips_locked[i] = false; + } } bool checkPipAvail(PipId pip) const { assert(pip != PipId()); - return pip_to_net[pip.index] == IdString(); + return !pips_locked[pip.index]; } IdString getPipNet(PipId pip) const |