bind/unbind bel

This commit is contained in:
Dan Ravensloft 2021-02-03 00:12:14 +00:00 committed by gatecat
parent 189164e7c8
commit fcdf1e0bfd
2 changed files with 36 additions and 0 deletions

View File

@ -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

View File

@ -30,11 +30,31 @@ struct ArchArgs
std::string device;
};
struct BelInfo
{
IdString name, type;
std::map<IdString, std::string> attrs;
CellInfo *bound_cell;
std::unordered_map<IdString, PinInfo> 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<IdString, BelInfo> bels;
Arch(ArchArgs args);
std::string getChipName() const { return std::string{"TODO: getChipName"}; }