2018-05-26 16:47:35 +08:00
|
|
|
/*
|
2018-05-26 17:17:50 +08:00
|
|
|
* nextpnr -- Next Generation Place and Route
|
2018-05-26 16:47:35 +08:00
|
|
|
*
|
2018-06-22 22:19:17 +08:00
|
|
|
* Copyright (C) 2018 Clifford Wolf <clifford@symbioticeda.com>
|
2018-05-26 16:47:35 +08:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-06-12 02:12:57 +08:00
|
|
|
#ifndef NEXTPNR_H
|
2018-06-18 20:12:39 +08:00
|
|
|
#error Include "arch.h" via "nextpnr.h" only.
|
2018-06-12 02:12:57 +08:00
|
|
|
#endif
|
|
|
|
|
2018-06-19 18:08:37 +08:00
|
|
|
NEXTPNR_NAMESPACE_BEGIN
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
struct ArchArgs
|
2018-05-26 16:36:33 +08:00
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2018-06-19 18:08:37 +08:00
|
|
|
struct Arch : BaseCtx
|
2018-05-23 17:35:49 +08:00
|
|
|
{
|
2018-06-18 19:35:25 +08:00
|
|
|
Arch(ArchArgs args);
|
2018-06-07 18:56:49 +08:00
|
|
|
|
2018-06-11 00:25:23 +08:00
|
|
|
std::string getChipName();
|
|
|
|
|
2018-06-18 21:53:18 +08:00
|
|
|
virtual IdString id(const std::string &s) const { abort(); }
|
|
|
|
virtual IdString id(const char *s) const { abort(); }
|
|
|
|
|
2018-06-24 20:38:45 +08:00
|
|
|
IdString archId() const { return id("dummy"); }
|
|
|
|
IdString archArgsToId(ArchArgs args) const { return id("none"); }
|
|
|
|
|
2018-06-18 22:08:19 +08:00
|
|
|
IdString belTypeToId(BelType type) const { return type; }
|
|
|
|
IdString portPinToId(PortPin type) const { return type; }
|
|
|
|
|
|
|
|
BelType belTypeFromId(IdString id) const { return id; }
|
|
|
|
PortPin portPinFromId(IdString id) const { return id; }
|
|
|
|
|
2018-06-07 18:56:49 +08:00
|
|
|
BelId getBelByName(IdString name) const;
|
|
|
|
IdString getBelName(BelId bel) const;
|
2018-06-21 21:47:41 +08:00
|
|
|
uint32_t getBelChecksum(BelId bel) const;
|
2018-06-23 21:16:24 +08:00
|
|
|
void bindBel(BelId bel, IdString cell, PlaceStrength strength);
|
2018-06-07 18:56:49 +08:00
|
|
|
void unbindBel(BelId bel);
|
|
|
|
bool checkBelAvail(BelId bel) const;
|
2018-06-23 21:16:24 +08:00
|
|
|
IdString getBoundBelCell(BelId bel) const;
|
|
|
|
IdString getConflictingBelCell(BelId bel) const;
|
2018-06-12 01:56:33 +08:00
|
|
|
const std::vector<BelId> &getBels() const;
|
|
|
|
const std::vector<BelId> &getBelsByType(BelType type) const;
|
2018-06-07 18:56:49 +08:00
|
|
|
BelType getBelType(BelId bel) const;
|
|
|
|
WireId getWireBelPin(BelId bel, PortPin pin) const;
|
|
|
|
BelPin getBelPinUphill(WireId wire) const;
|
2018-06-12 01:56:33 +08:00
|
|
|
const std::vector<BelPin> &getBelPinsDownhill(WireId wire) const;
|
2018-06-07 18:56:49 +08:00
|
|
|
|
|
|
|
WireId getWireByName(IdString name) const;
|
|
|
|
IdString getWireName(WireId wire) const;
|
2018-06-21 21:47:41 +08:00
|
|
|
uint32_t getWireChecksum(WireId wire) const;
|
2018-06-23 21:16:24 +08:00
|
|
|
void bindWire(WireId wire, IdString net, PlaceStrength strength);
|
2018-06-10 00:19:20 +08:00
|
|
|
void unbindWire(WireId wire);
|
|
|
|
bool checkWireAvail(WireId wire) const;
|
2018-06-23 21:16:24 +08:00
|
|
|
IdString getBoundWireNet(WireId wire) const;
|
|
|
|
IdString getConflictingWireNet(WireId wire) const;
|
2018-06-12 01:56:33 +08:00
|
|
|
const std::vector<WireId> &getWires() const;
|
2018-06-07 18:56:49 +08:00
|
|
|
|
|
|
|
PipId getPipByName(IdString name) const;
|
|
|
|
IdString getPipName(PipId pip) const;
|
2018-06-21 21:47:41 +08:00
|
|
|
uint32_t getPipChecksum(PipId pip) const;
|
2018-06-23 21:16:24 +08:00
|
|
|
void bindPip(PipId pip, IdString net, PlaceStrength strength);
|
2018-06-10 00:19:20 +08:00
|
|
|
void unbindPip(PipId pip);
|
|
|
|
bool checkPipAvail(PipId pip) const;
|
2018-06-23 21:16:24 +08:00
|
|
|
IdString getBoundPipNet(PipId pip) const;
|
|
|
|
IdString getConflictingPipNet(PipId pip) const;
|
2018-06-12 01:56:33 +08:00
|
|
|
const std::vector<PipId> &getPips() const;
|
2018-06-07 18:56:49 +08:00
|
|
|
WireId getPipSrcWire(PipId pip) const;
|
|
|
|
WireId getPipDstWire(PipId pip) const;
|
|
|
|
DelayInfo getPipDelay(PipId pip) const;
|
2018-06-12 01:56:33 +08:00
|
|
|
const std::vector<PipId> &getPipsDownhill(WireId wire) const;
|
|
|
|
const std::vector<PipId> &getPipsUphill(WireId wire) const;
|
|
|
|
const std::vector<PipId> &getWireAliases(WireId wire) const;
|
2018-06-07 18:56:49 +08:00
|
|
|
|
2018-06-20 18:57:38 +08:00
|
|
|
void estimatePosition(BelId bel, int &x, int &y, bool &gb) const;
|
2018-06-16 21:23:04 +08:00
|
|
|
delay_t estimateDelay(WireId src, WireId dst) const;
|
2018-06-20 18:50:38 +08:00
|
|
|
delay_t getDelayEpsilon() const { return 0.01; }
|
2018-06-21 20:08:45 +08:00
|
|
|
delay_t getRipupDelayPenalty() const { return 1.0; }
|
2018-06-20 18:50:38 +08:00
|
|
|
float getDelayNS(delay_t v) const { return v; }
|
2018-06-21 21:47:41 +08:00
|
|
|
uint32_t getDelayChecksum(delay_t v) const { return 0; }
|
2018-06-12 01:46:03 +08:00
|
|
|
|
2018-06-13 18:48:58 +08:00
|
|
|
std::vector<GraphicElement> getFrameGraphics() const;
|
2018-06-12 01:56:33 +08:00
|
|
|
std::vector<GraphicElement> getBelGraphics(BelId bel) const;
|
|
|
|
std::vector<GraphicElement> getWireGraphics(WireId wire) const;
|
|
|
|
std::vector<GraphicElement> getPipGraphics(PipId pip) const;
|
2018-06-13 18:48:58 +08:00
|
|
|
|
|
|
|
bool allGraphicsReload = false;
|
|
|
|
bool frameGraphicsReload = false;
|
|
|
|
std::unordered_set<BelId> belGraphicsReload;
|
|
|
|
std::unordered_set<WireId> wireGraphicsReload;
|
|
|
|
std::unordered_set<PipId> pipGraphicsReload;
|
2018-06-20 17:44:28 +08:00
|
|
|
|
2018-06-23 21:28:09 +08:00
|
|
|
bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, delay_t &delay) const;
|
2018-06-20 17:44:28 +08:00
|
|
|
IdString getPortClock(const CellInfo *cell, IdString port) const;
|
|
|
|
bool isClockPort(const CellInfo *cell, IdString port) const;
|
2018-06-25 17:43:59 +08:00
|
|
|
|
|
|
|
bool isValidBelForCell(CellInfo *cell, BelId bel) const;
|
|
|
|
bool isBelLocationValid(BelId bel) const;
|
2018-05-23 17:35:49 +08:00
|
|
|
};
|
|
|
|
|
2018-06-12 20:24:59 +08:00
|
|
|
NEXTPNR_NAMESPACE_END
|