diff options
author | gatecat <gatecat@ds0.me> | 2021-05-12 21:21:33 +0100 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2021-05-15 14:54:33 +0100 |
commit | 3d1bb4f1b217b020e750277dd1ee2e4d3516b58f (patch) | |
tree | 01f68fe1da6f26afed4f9c3bb248b3eb1767a0f7 /mistral/lab.cc | |
parent | 2f2fde7e6cd687433c687b1f678ceb4bd25f588e (diff) | |
download | nextpnr-3d1bb4f1b217b020e750277dd1ee2e4d3516b58f.tar.gz nextpnr-3d1bb4f1b217b020e750277dd1ee2e4d3516b58f.tar.bz2 nextpnr-3d1bb4f1b217b020e750277dd1ee2e4d3516b58f.zip |
mistral: Carry debugging
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'mistral/lab.cc')
-rw-r--r-- | mistral/lab.cc | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/mistral/lab.cc b/mistral/lab.cc index 77bdac09..a0179a88 100644 --- a/mistral/lab.cc +++ b/mistral/lab.cc @@ -42,14 +42,14 @@ static void create_alm(Arch *arch, int x, int y, int z, uint32_t lab_idx) WireId carry_in, share_in; WireId carry_out, share_out; if (z == 0 && i == 0) { - if (y == 0) { + if (y == arch->getGridDimY() - 1) { // Base case carry_in = arch->add_wire(x, y, id_CARRY_START); share_in = arch->add_wire(x, y, id_CARRY_START); } else { // Output of last tile - carry_in = arch->add_wire(x, y - 1, id_CO); - share_in = arch->add_wire(x, y - 1, id_SHAREOUT); + carry_in = arch->add_wire(x, y + 1, id_CO); + share_in = arch->add_wire(x, y + 1, id_SHAREOUT); } } else { // Output from last combinational unit @@ -304,22 +304,6 @@ void Arch::assign_ff_info(CellInfo *cell) const cell->ffInfo.datain = get_net_or_empty(cell, id_DATAIN); } -namespace { -// Check if the other side of a carry chain wire is being used -bool carry_used(const Arch *arch, BelId bel, IdString pin) -{ - WireId wire = arch->getBelPinWire(bel, pin); - for (auto bp : arch->getWireBelPins(wire)) { - if (bp.bel == bel) - continue; - CellInfo *ci = arch->getBoundBelCell(bp.bel); - if (ci != nullptr && ci->combInfo.is_carry) - return true; - } - return false; -} -} // namespace - // Validity checking functions bool Arch::is_alm_legal(uint32_t lab, uint8_t alm) const { @@ -368,26 +352,9 @@ bool Arch::is_alm_legal(uint32_t lab, uint8_t alm) const bool carry_mode = false; - for (int i = 0; i < 2; i++) { - if (!luts[i]) - continue; - if (!luts[i]->combInfo.is_carry) - continue; - carry_mode = true; - // Never allow two disjoint carry chains to accidentally stack - if (luts[i]->combInfo.carry_start && carry_used(this, alm_data.lut_bels[i], id_CI)) - return false; - if (luts[i]->combInfo.carry_end && carry_used(this, alm_data.lut_bels[i], id_CO)) - return false; - } - - for (int i = 0; i < 2; i++) { - if (!luts[i]) - continue; - // No mixing of carry and non-carry - if (luts[i]->combInfo.is_carry != carry_mode) - return false; - } + // No mixing of carry and non-carry + if (luts[0] && luts[1] && luts[0]->combInfo.is_carry != luts[1]->combInfo.is_carry) + return false; // For each ALM half; check FF control set sharing and input routeability for (int i = 0; i < 2; i++) { |