From 603b60da8dcadf23eec8609ffc128f8f191c1122 Mon Sep 17 00:00:00 2001 From: gatecat Date: Wed, 7 Dec 2022 10:27:58 +0100 Subject: api: add explain_invalid option to isBelLocationValid Signed-off-by: gatecat --- generic/arch.cc | 4 ++-- generic/arch.h | 2 +- generic/viaduct/example/example.cc | 2 +- generic/viaduct/fabulous/fabulous.cc | 5 ++++- generic/viaduct/okami/okami.cc | 2 +- generic/viaduct_api.h | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) (limited to 'generic') diff --git a/generic/arch.cc b/generic/arch.cc index c60c7674..579140b9 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -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 cells; Loc loc = getBelLocation(bel); for (auto tbel : getBelsByTile(loc.x, loc.y)) { diff --git a/generic/arch.h b/generic/arch.h index a27dc78e..2a177be9 100644 --- a/generic/arch.h +++ b/generic/arch.h @@ -386,7 +386,7 @@ struct Arch : BaseArch { 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 availablePlacers; diff --git a/generic/viaduct/example/example.cc b/generic/viaduct/example/example.cc index 987c3236..7a61a594 100644 --- a/generic/viaduct/example/example.cc +++ b/generic/viaduct/example/example.cc @@ -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)) { diff --git a/generic/viaduct/fabulous/fabulous.cc b/generic/viaduct/fabulous/fabulous.cc index 3c6f025f..e2fe1b74 100644 --- a/generic/viaduct/fabulous/fabulous.cc +++ b/generic/viaduct/fabulous/fabulous.cc @@ -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 diff --git a/generic/viaduct/okami/okami.cc b/generic/viaduct/okami/okami.cc index 8142756f..4ff97cb3 100644 --- a/generic/viaduct/okami/okami.cc +++ b/generic/viaduct/okami/okami.cc @@ -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)) { diff --git a/generic/viaduct_api.h b/generic/viaduct_api.h index 6887f56c..3caa0ba1 100644 --- a/generic/viaduct_api.h +++ b/generic/viaduct_api.h @@ -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) -- cgit v1.2.3