diff --git a/common/nextpnr.cc b/common/nextpnr.cc index dd1ebc59..f05f4a55 100644 --- a/common/nextpnr.cc +++ b/common/nextpnr.cc @@ -104,13 +104,6 @@ std::string IdStringList::str(const Context *ctx) const return s; } -TimingConstrObjectId BaseCtx::timingWildcardObject() -{ - TimingConstrObjectId id; - id.index = 0; - return id; -} - std::string &StrRingBuffer::next() { std::string &s = buffer.at(index++); @@ -119,76 +112,6 @@ std::string &StrRingBuffer::next() return s; } -TimingConstrObjectId BaseCtx::timingClockDomainObject(NetInfo *clockDomain) -{ - NPNR_ASSERT(clockDomain->clkconstr != nullptr); - if (clockDomain->clkconstr->domain_tmg_id != TimingConstrObjectId()) { - return clockDomain->clkconstr->domain_tmg_id; - } else { - TimingConstraintObject obj; - TimingConstrObjectId id; - id.index = int(constraintObjects.size()); - obj.id = id; - obj.type = TimingConstraintObject::CLOCK_DOMAIN; - obj.entity = clockDomain->name; - clockDomain->clkconstr->domain_tmg_id = id; - constraintObjects.push_back(obj); - return id; - } -} - -TimingConstrObjectId BaseCtx::timingNetObject(NetInfo *net) -{ - if (net->tmg_id != TimingConstrObjectId()) { - return net->tmg_id; - } else { - TimingConstraintObject obj; - TimingConstrObjectId id; - id.index = int(constraintObjects.size()); - obj.id = id; - obj.type = TimingConstraintObject::NET; - obj.entity = net->name; - constraintObjects.push_back(obj); - net->tmg_id = id; - return id; - } -} - -TimingConstrObjectId BaseCtx::timingCellObject(CellInfo *cell) -{ - if (cell->tmg_id != TimingConstrObjectId()) { - return cell->tmg_id; - } else { - TimingConstraintObject obj; - TimingConstrObjectId id; - id.index = int(constraintObjects.size()); - obj.id = id; - obj.type = TimingConstraintObject::CELL; - obj.entity = cell->name; - constraintObjects.push_back(obj); - cell->tmg_id = id; - return id; - } -} - -TimingConstrObjectId BaseCtx::timingPortObject(CellInfo *cell, IdString port) -{ - if (cell->ports.at(port).tmg_id != TimingConstrObjectId()) { - return cell->ports.at(port).tmg_id; - } else { - TimingConstraintObject obj; - TimingConstrObjectId id; - id.index = int(constraintObjects.size()); - obj.id = id; - obj.type = TimingConstraintObject::CELL_PORT; - obj.entity = cell->name; - obj.port = port; - constraintObjects.push_back(obj); - cell->ports.at(port).tmg_id = id; - return id; - } -} - Property::Property() : is_string(false), str(""), intval(0) {} Property::Property(int64_t intval, int width) : is_string(false), intval(intval) @@ -286,30 +209,6 @@ Property Property::from_string(const std::string &s) return p; } -void BaseCtx::addConstraint(std::unique_ptr constr) -{ - for (auto fromObj : constr->from) - constrsFrom.emplace(fromObj, constr.get()); - for (auto toObj : constr->to) - constrsTo.emplace(toObj, constr.get()); - IdString name = constr->name; - constraints[name] = std::move(constr); -} - -void BaseCtx::removeConstraint(IdString constrName) -{ - TimingConstraint *constr = constraints[constrName].get(); - for (auto fromObj : constr->from) { - auto fromConstrs = constrsFrom.equal_range(fromObj); - constrsFrom.erase(std::find(fromConstrs.first, fromConstrs.second, std::make_pair(fromObj, constr))); - } - for (auto toObj : constr->to) { - auto toConstrs = constrsFrom.equal_range(toObj); - constrsFrom.erase(std::find(toConstrs.first, toConstrs.second, std::make_pair(toObj, constr))); - } - constraints.erase(constrName); -} - const char *BaseCtx::nameOfBel(BelId bel) const { const Context *ctx = getCtx(); diff --git a/common/nextpnr.h b/common/nextpnr.h index 549e8e35..ab2f8dca 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -372,14 +372,6 @@ struct ArcBounds }; }; -struct TimingConstrObjectId -{ - int32_t index = -1; - - bool operator==(const TimingConstrObjectId &other) const { return index == other.index; } - bool operator!=(const TimingConstrObjectId &other) const { return index != other.index; } -}; - NEXTPNR_NAMESPACE_END namespace std { @@ -394,15 +386,6 @@ template <> struct hash return seed; } }; - -template <> struct hash -{ - std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX TimingConstrObjectId &obj) const noexcept - { - return hash()(obj.index); - } -}; - } // namespace std #include "archdefs.h" @@ -612,8 +595,6 @@ struct NetInfo : ArchNetInfo std::unique_ptr clkconstr; - TimingConstrObjectId tmg_id; - Region *region = nullptr; }; @@ -629,7 +610,6 @@ struct PortInfo IdString name; NetInfo *net; PortType type; - TimingConstrObjectId tmg_id; }; struct CellInfo : ArchCellInfo @@ -654,7 +634,6 @@ struct CellInfo : ArchCellInfo // parent.[xyz] := 0 when (constr_parent == nullptr) Region *region = nullptr; - TimingConstrObjectId tmg_id; void addInput(IdString name); void addOutput(IdString name); @@ -706,41 +685,6 @@ struct ClockConstraint DelayPair high; DelayPair low; DelayPair period; - - TimingConstrObjectId domain_tmg_id; -}; - -struct TimingConstraintObject -{ - TimingConstrObjectId id; - enum - { - ANYTHING, - CLOCK_DOMAIN, - NET, - CELL, - CELL_PORT - } type; - IdString entity; // Name of clock net; net or cell - IdString port; // Name of port on a cell -}; - -struct TimingConstraint -{ - IdString name; - - enum - { - FALSE_PATH, - MIN_DELAY, - MAX_DELAY, - MULTICYCLE, - } type; - - delay_t value; - - std::unordered_set from; - std::unordered_set to; }; // Represents the contents of a non-leaf cell in a design @@ -768,12 +712,6 @@ struct HierarchicalCell std::unordered_map hier_cells; }; -inline bool operator==(const std::pair &a, - const std::pair &b) -{ - return a.first == b.first && a.second == b.second; -} - struct DeterministicRNG { uint64_t rngstate; @@ -899,11 +837,6 @@ struct BaseCtx IdString::initialize_add(this, "", 0); IdString::initialize_arch(this); - TimingConstraintObject wildcard; - wildcard.id.index = 0; - wildcard.type = TimingConstraintObject::ANYTHING; - constraintObjects.push_back(wildcard); - design_loaded = false; } @@ -1014,30 +947,11 @@ struct BaseCtx // -------------------------------------------------------------- - // Timing Constraint API - - // constraint name -> constraint - std::unordered_map> constraints; - // object ID -> object - std::vector constraintObjects; - // object ID -> constraint - std::unordered_multimap constrsFrom; - std::unordered_multimap constrsTo; - - TimingConstrObjectId timingWildcardObject(); - TimingConstrObjectId timingClockDomainObject(NetInfo *clockDomain); - TimingConstrObjectId timingNetObject(NetInfo *net); - TimingConstrObjectId timingCellObject(CellInfo *cell); - TimingConstrObjectId timingPortObject(CellInfo *cell, IdString port); - NetInfo *getNetByAlias(IdString alias) const { return nets.count(alias) ? nets.at(alias).get() : nets.at(net_aliases.at(alias)).get(); } - void addConstraint(std::unique_ptr constr); - void removeConstraint(IdString constrName); - // Intended to simplify Python API void addClock(IdString net, float freq); void createRectangularRegion(IdString name, int x0, int y0, int x1, int y1);