1
0
mirror of https://github.com/YosysHQ/nextpnr.git synced 2026-05-05 23:45:42 +00:00

api: add explain_invalid option to isBelLocationValid

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat
2022-12-07 10:27:58 +01:00
parent d1afd6c0f1
commit 603b60da8d
26 changed files with 37 additions and 30 deletions

View File

@@ -693,10 +693,10 @@ TimingClockingInfo Arch::getPortClockingInfo(const CellInfo *cell, IdString port
return tmg.clockingInfo.at(port).at(index);
}
bool Arch::isBelLocationValid(BelId bel) const
bool Arch::isBelLocationValid(BelId bel, bool explain_invalid) const
{
if (uarch)
return uarch->isBelLocationValid(bel);
return uarch->isBelLocationValid(bel, explain_invalid);
std::vector<const CellInfo *> cells;
Loc loc = getBelLocation(bel);
for (auto tbel : getBelsByTile(loc.x, loc.y)) {

View File

@@ -386,7 +386,7 @@ struct Arch : BaseArch<ArchRanges>
{
return uarch ? uarch->isValidBelForCellType(cell_type, bel) : cell_type == getBelType(bel);
}
bool isBelLocationValid(BelId bel) const override;
bool isBelLocationValid(BelId bel, bool explain_invalid = false) const override;
static const std::string defaultPlacer;
static const std::vector<std::string> availablePlacers;

View File

@@ -62,7 +62,7 @@ struct ExampleImpl : ViaductAPI
void prePlace() override { assign_cell_info(); }
bool isBelLocationValid(BelId bel) const override
bool isBelLocationValid(BelId bel, bool explain_invalid) const override
{
Loc l = ctx->getBelLocation(bel);
if (is_io(l.x, l.y)) {

View File

@@ -81,7 +81,10 @@ struct FabulousImpl : ViaductAPI
}
void prePlace() override { assign_cell_info(); }
bool isBelLocationValid(BelId bel) const override { return blk_trk->check_validity(bel, cfg, cell_tags); }
bool isBelLocationValid(BelId bel, bool explain_invalid) const override
{
return blk_trk->check_validity(bel, cfg, cell_tags);
}
private:
FabricConfig cfg; // TODO: non-default config

View File

@@ -64,7 +64,7 @@ struct OkamiImpl : ViaductAPI
void prePlace() override { assign_cell_info(); }
bool isBelLocationValid(BelId bel) const override
bool isBelLocationValid(BelId bel, bool explain_invalid) const override
{
Loc l = ctx->getBelLocation(bel);
if (is_io(l.x, l.y)) {

View File

@@ -67,7 +67,7 @@ struct ViaductAPI
virtual BelBucketId getBelBucketForBel(BelId bel) const;
virtual BelBucketId getBelBucketForCellType(IdString cell_type) const;
virtual bool isValidBelForCellType(IdString cell_type, BelId bel) const;
virtual bool isBelLocationValid(BelId bel) const { return true; }
virtual bool isBelLocationValid(BelId bel, bool explain_invalid = false) const { return true; }
// --- Wire and pip functions ---
// Called when a wire/pip is placed/unplaced (with net=nullptr for a unbind)