api: Make NetInfo* of checkPipAvailForNet const

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2022-12-02 14:20:39 +01:00
parent f07d9a1835
commit c62a947a28
12 changed files with 12 additions and 12 deletions

View File

@ -93,7 +93,7 @@ template <typename R> struct ArchAPI : BaseCtx
virtual void bindPip(PipId pip, NetInfo *net, PlaceStrength strength) = 0; virtual void bindPip(PipId pip, NetInfo *net, PlaceStrength strength) = 0;
virtual void unbindPip(PipId pip) = 0; virtual void unbindPip(PipId pip) = 0;
virtual bool checkPipAvail(PipId pip) const = 0; virtual bool checkPipAvail(PipId pip) const = 0;
virtual bool checkPipAvailForNet(PipId pip, NetInfo *net) const = 0; virtual bool checkPipAvailForNet(PipId pip, const NetInfo *net) const = 0;
virtual NetInfo *getBoundPipNet(PipId pip) const = 0; virtual NetInfo *getBoundPipNet(PipId pip) const = 0;
virtual WireId getConflictingPipWire(PipId pip) const = 0; virtual WireId getConflictingPipWire(PipId pip) const = 0;
virtual NetInfo *getConflictingPipNet(PipId pip) const = 0; virtual NetInfo *getConflictingPipNet(PipId pip) const = 0;

View File

@ -274,7 +274,7 @@ template <typename R> struct BaseArch : ArchAPI<R>
p2n_entry = nullptr; p2n_entry = nullptr;
} }
virtual bool checkPipAvail(PipId pip) const override { return getBoundPipNet(pip) == nullptr; } virtual bool checkPipAvail(PipId pip) const override { return getBoundPipNet(pip) == nullptr; }
virtual bool checkPipAvailForNet(PipId pip, NetInfo *net) const override virtual bool checkPipAvailForNet(PipId pip, const NetInfo *net) const override
{ {
NetInfo *bound_net = getBoundPipNet(pip); NetInfo *bound_net = getBoundPipNet(pip);
return bound_net == nullptr || bound_net == net; return bound_net == nullptr || bound_net == net;

View File

@ -402,7 +402,7 @@ pip to a net.
*BaseArch default: returns `getBoundPipNet(pip) == nullptr`* *BaseArch default: returns `getBoundPipNet(pip) == nullptr`*
### bool checkPipAvailForNet(PipId pip, NetInfo *net) const ### bool checkPipAvailForNet(PipId pip, const NetInfo *net) const
Returns true if the given pip is available to be bound to a net, or if the Returns true if the given pip is available to be bound to a net, or if the
pip is already bound to that net. pip is already bound to that net.

View File

@ -847,7 +847,7 @@ struct Arch : BaseArch<ArchRanges>
return false; return false;
} }
bool checkPipAvail(PipId pip) const override { return (getBoundPipNet(pip) == nullptr) && !is_pip_blocked(pip); } bool checkPipAvail(PipId pip) const override { return (getBoundPipNet(pip) == nullptr) && !is_pip_blocked(pip); }
bool checkPipAvailForNet(PipId pip, NetInfo *net) const override bool checkPipAvailForNet(PipId pip, const NetInfo *net) const override
{ {
NetInfo *bound_net = getBoundPipNet(pip); NetInfo *bound_net = getBoundPipNet(pip);
return (bound_net == nullptr || bound_net == net) && !is_pip_blocked(pip); return (bound_net == nullptr || bound_net == net) && !is_pip_blocked(pip);

View File

@ -1743,7 +1743,7 @@ void Arch::bindWire(WireId wire, NetInfo *net, PlaceStrength strength)
refreshUiWire(wire); refreshUiWire(wire);
} }
bool Arch::checkPipAvailForNet(PipId pip, NetInfo *net) const bool Arch::checkPipAvailForNet(PipId pip, const NetInfo *net) const
{ {
NPNR_ASSERT(pip != PipId()); NPNR_ASSERT(pip != PipId());
auto pip_iter = pip_to_net.find(pip); auto pip_iter = pip_to_net.find(pip);

View File

@ -596,7 +596,7 @@ struct Arch : ArchAPI<ArchRanges>
void unbindPip(PipId pip) final; void unbindPip(PipId pip) final;
bool checkPipAvail(PipId pip) const final; bool checkPipAvail(PipId pip) const final;
bool checkPipAvailForNet(PipId pip, NetInfo *net) const final; bool checkPipAvailForNet(PipId pip, const NetInfo *net) const final;
NetInfo *getBoundPipNet(PipId pip) const final NetInfo *getBoundPipNet(PipId pip) const final
{ {

View File

@ -468,7 +468,7 @@ bool Arch::checkPipAvail(PipId pip) const
return (!uarch || uarch->checkPipAvail(pip)) && (pip_info(pip).bound_net == nullptr); return (!uarch || uarch->checkPipAvail(pip)) && (pip_info(pip).bound_net == nullptr);
} }
bool Arch::checkPipAvailForNet(PipId pip, NetInfo *net) const bool Arch::checkPipAvailForNet(PipId pip, const NetInfo *net) const
{ {
if (uarch && !uarch->checkPipAvailForNet(pip, net)) if (uarch && !uarch->checkPipAvailForNet(pip, net))
return false; return false;

View File

@ -294,7 +294,7 @@ struct Arch : BaseArch<ArchRanges>
void bindPip(PipId pip, NetInfo *net, PlaceStrength strength) override; void bindPip(PipId pip, NetInfo *net, PlaceStrength strength) override;
void unbindPip(PipId pip) override; void unbindPip(PipId pip) override;
bool checkPipAvail(PipId pip) const override; bool checkPipAvail(PipId pip) const override;
bool checkPipAvailForNet(PipId pip, NetInfo *net) const override; bool checkPipAvailForNet(PipId pip, const NetInfo *net) const override;
NetInfo *getBoundPipNet(PipId pip) const override; NetInfo *getBoundPipNet(PipId pip) const override;
WireId getConflictingPipWire(PipId pip) const override; WireId getConflictingPipWire(PipId pip) const override;
NetInfo *getConflictingPipNet(PipId pip) const override; NetInfo *getConflictingPipNet(PipId pip) const override;

View File

@ -77,7 +77,7 @@ struct ViaductAPI
// it's bound (which the base arch will deal with) // it's bound (which the base arch will deal with)
virtual bool checkWireAvail(WireId wire) const { return true; } virtual bool checkWireAvail(WireId wire) const { return true; }
virtual bool checkPipAvail(PipId pip) const { return true; } virtual bool checkPipAvail(PipId pip) const { return true; }
virtual bool checkPipAvailForNet(PipId pip, NetInfo *net) const { return checkPipAvail(pip); }; virtual bool checkPipAvailForNet(PipId pip, const NetInfo *net) const { return checkPipAvail(pip); };
// --- Route lookahead --- // --- Route lookahead ---
virtual delay_t estimateDelay(WireId src, WireId dst) const; virtual delay_t estimateDelay(WireId src, WireId dst) const;

View File

@ -680,7 +680,7 @@ struct Arch : BaseArch<ArchRanges>
return switches_locked[pi.switch_index] == WireId(); return switches_locked[pi.switch_index] == WireId();
} }
bool checkPipAvailForNet(PipId pip, NetInfo *net) const override bool checkPipAvailForNet(PipId pip, const NetInfo *net) const override
{ {
if (ice40_pip_hard_unavail(pip)) if (ice40_pip_hard_unavail(pip))
return false; return false;

View File

@ -408,7 +408,7 @@ struct Arch : BaseArch<ArchRanges>
return BaseArch::checkPipAvail(pip); return BaseArch::checkPipAvail(pip);
} }
bool checkPipAvailForNet(PipId pip, NetInfo *net) const override bool checkPipAvailForNet(PipId pip, const NetInfo *net) const override
{ {
if (is_pip_blocked(pip)) if (is_pip_blocked(pip))
return false; return false;

View File

@ -1018,7 +1018,7 @@ struct Arch : BaseArch<ArchRanges>
return getBoundPipNet(pip) == nullptr; return getBoundPipNet(pip) == nullptr;
} }
bool checkPipAvailForNet(PipId pip, NetInfo *net) const override bool checkPipAvailForNet(PipId pip, const NetInfo *net) const override
{ {
if (disabled_pips.count(pip)) if (disabled_pips.count(pip))
return false; return false;