From 7922b3bfc4ef93b8f67194c05e1a236b4c83c3da Mon Sep 17 00:00:00 2001 From: gatecat Date: Fri, 19 Feb 2021 10:39:57 +0000 Subject: Replace DelayInfo with DelayPair/DelayQuad This replaces the arch-specific DelayInfo structure with new DelayPair (min/max only) and DelayQuad (min/max for both rise and fall) structures that form part of common code. This further reduces the amount of arch-specific code; and also provides useful data structures for timing analysis which will need to delay with pairs/quads of delays as it is improved. While there may be a small performance cost to arches that didn't separate the rise/fall cases (arches that aren't currently separating the min/max cases just need to be fixed...) in DelayInfo, my expectation is that inlining will mean this doesn't make much difference. Signed-off-by: gatecat --- gowin/arch.h | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'gowin/arch.h') diff --git a/gowin/arch.h b/gowin/arch.h index cdc011aa..0b0d7b9c 100644 --- a/gowin/arch.h +++ b/gowin/arch.h @@ -170,7 +170,7 @@ struct PipInfo std::map attrs; NetInfo *bound_net; WireId srcWire, dstWire; - DelayInfo delay; + DelayQuad delay; DecalXY decalxy; Loc loc; }; @@ -239,7 +239,7 @@ NEXTPNR_NAMESPACE_BEGIN struct CellTiming { std::unordered_map portClasses; - std::unordered_map combDelays; + std::unordered_map combDelays; std::unordered_map> clockingInfo; }; @@ -302,7 +302,7 @@ struct Arch : BaseArch std::unordered_map cellTiming; void addWire(IdString name, IdString type, int x, int y); - void addPip(IdString name, IdString type, IdString srcWire, IdString dstWire, DelayInfo delay, Loc loc); + void addPip(IdString name, IdString type, IdString srcWire, IdString dstWire, DelayQuad delay, Loc loc); void addBel(IdString name, IdString type, Loc loc, bool gb); void addBelInput(IdString bel, IdString name, IdString wire); @@ -327,12 +327,12 @@ struct Arch : BaseArch void setDelayScaling(double scale, double offset); void addCellTimingClock(IdString cell, IdString port); - void addCellTimingDelay(IdString cell, IdString fromPort, IdString toPort, DelayInfo delay); - void addCellTimingSetupHold(IdString cell, IdString port, IdString clock, DelayInfo setup, DelayInfo hold); - void addCellTimingClockToOut(IdString cell, IdString port, IdString clock, DelayInfo clktoq); + void addCellTimingDelay(IdString cell, IdString fromPort, IdString toPort, DelayQuad delay); + void addCellTimingSetupHold(IdString cell, IdString port, IdString clock, DelayPair setup, DelayPair hold); + void addCellTimingClockToOut(IdString cell, IdString port, IdString clock, DelayQuad clktoq); IdString wireToGlobal(int &row, int &col, const DatabasePOD *db, IdString &wire); - DelayInfo getWireTypeDelay(IdString wire); + DelayQuad getWireTypeDelay(IdString wire); void read_cst(std::istream &in); // --------------------------------------------------------------- @@ -384,7 +384,7 @@ struct Arch : BaseArch NetInfo *getBoundWireNet(WireId wire) const override; WireId getConflictingWireWire(WireId wire) const override { return wire; } NetInfo *getConflictingWireNet(WireId wire) const override; - DelayInfo getWireDelay(WireId wire) const override { return DelayInfo(); } + DelayQuad getWireDelay(WireId wire) const override { return DelayQuad(0); } const std::vector &getWires() const override; const std::vector &getWireBelPins(WireId wire) const override; @@ -402,7 +402,7 @@ struct Arch : BaseArch Loc getPipLocation(PipId pip) const override; WireId getPipSrcWire(PipId pip) const override; WireId getPipDstWire(PipId pip) const override; - DelayInfo getPipDelay(PipId pip) const override; + DelayQuad getPipDelay(PipId pip) const override; const std::vector &getPipsDownhill(WireId wire) const override; const std::vector &getPipsUphill(WireId wire) const override; @@ -420,15 +420,7 @@ struct Arch : BaseArch delay_t getRipupDelayPenalty() const override { return 0.4; } float getDelayNS(delay_t v) const override { return v; } - DelayInfo getDelayFromNS(float ns) const override - { - DelayInfo del; - del.maxRaise = ns; - del.maxFall = ns; - del.minRaise = ns; - del.minFall = ns; - return del; - } + delay_t getDelayFromNS(float ns) const override { return ns; } uint32_t getDelayChecksum(delay_t v) const override { return 0; } bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const override; @@ -439,7 +431,7 @@ struct Arch : BaseArch bool place() override; bool route() override; - bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, DelayInfo &delay) const; + bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, DelayQuad &delay) const; // Get the port class, also setting clockInfoCount to the number of TimingClockingInfos associated with a port TimingPortClass getPortTimingClass(const CellInfo *cell, IdString port, int &clockInfoCount) const; // Get the TimingClockingInfo of a port -- cgit v1.2.3