From fcdf1e0bfdb45f1ee8a315d1d1ca0a07ca66f7a4 Mon Sep 17 00:00:00 2001 From: Dan Ravensloft Date: Wed, 3 Feb 2021 00:12:14 +0000 Subject: [PATCH] bind/unbind bel --- cyclonev/arch.cc | 16 ++++++++++++++++ cyclonev/arch.h | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/cyclonev/arch.cc b/cyclonev/arch.cc index f5dd35eb..ac19b7d2 100644 --- a/cyclonev/arch.cc +++ b/cyclonev/arch.cc @@ -90,6 +90,22 @@ IdString Arch::getBelName(BelId bel) const return id(bel_str); } +void Arch::bindBel(BelId bel, CellInfo *cell, PlaceStrength strength) +{ + bels.at(bel).bound_cell = cell; + cell->bel = bel; + cell->belStrength = strength; + refreshUiBel(bel); +} +void Arch::unbindBel(BelId bel) +{ + bels.at(bel).bound_cell->bel = BelId(); + bels.at(bel).bound_cell->belStrength = STRENGTH_NONE; + bels.at(bel).bound_cell = nullptr; + refreshUiBel(bel); +} + +bool Arch::checkBelAvail(BelId bel) const { return bels.at(bel).bound_cell == nullptr; } NEXTPNR_NAMESPACE_END \ No newline at end of file diff --git a/cyclonev/arch.h b/cyclonev/arch.h index cdf41f39..cd5905cd 100644 --- a/cyclonev/arch.h +++ b/cyclonev/arch.h @@ -30,11 +30,31 @@ struct ArchArgs std::string device; }; +struct BelInfo +{ + IdString name, type; + std::map attrs; + CellInfo *bound_cell; + std::unordered_map pins; + DecalXY decalxy; + int x, y, z; + bool gb; +}; + +struct PinInfo +{ + IdString name; + WireId wire; + PortType type; +}; + struct Arch : BaseCtx { ArchArgs args; mistral::CycloneV* cyclonev; + std::unordered_map bels; + Arch(ArchArgs args); std::string getChipName() const { return std::string{"TODO: getChipName"}; }