AMF-Placer
2.0
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
|
Go to the documentation of this file.
37 #define CELLTYPESTRS \
38 "LUT1", "LUT2", "LUT3", "LUT4", "LUT5", "LUT6", "LUT6_2", "FDCE", "FDPE", "FDRE", "FDSE", "LDCE", "AND2B1L", \
39 "CARRY8", "DSP48E2", "MUXF7", "MUXF8", "SRL16E", "SRLC32E", "RAM32M16", "RAM64M", "RAM64X1D", "RAM32M", \
40 "RAM32X1D", "RAM32X1S", "RAM64X1S", "RAM64M8", "RAM256X1D", "FIFO36E2", "FIFO18E2", "RAMB18E2", "RAMB36E2", \
41 "BUFGCE", "BUFG_GT", "BUFG_GT_SYNC", "BUFGCE_DIV", "BUFGCTRL", "GTHE3_CHANNEL", "GTHE3_COMMON", "IOBUF", \
42 "IBUF", "IBUFDS", "IOBUFDS", "IBUFDS_GTE3", "IBUF_ANALOG", "IOBUFE3", "MMCME3_ADV", "OBUF", "OBUFT", \
43 "PCIE_3_1", "BSCANE2", "SYSMONE1", "RXTX_BITSLICE", "BITSLICE_CONTROL", "TX_BITSLICE_TRI", "OSERDESE3", \
44 "RIU_OR", "PLLE3_ADV", "HPIO_VREF", "OBUFDS_DUAL_BUF"
165 assert(AClass != -1);
175 assert(BClass != -1);
176 return AClass == BClass;
190 assert(AClass != -1);
229 name = std::to_string(
id);
236 name = _name +
"(" + std::to_string(
id) +
")";
539 if (
name ==
"<const0>" ||
name ==
"<const1>")
609 inline void enhance(
int pinIdInNetA,
int pinIdInNetB,
float ratio)
611 std::pair<int, int> tmpPair(pinIdInNetA, pinIdInNetB);
632 std::pair<int, int> tmpPair(pinIdInNetA, pinIdInNetB);
1184 if (inputPin->isUnconnected() &&
CLK)
1186 if (inputPin->getNet() !=
CLK)
1191 if (inputPin->isUnconnected() &&
CE)
1193 if (inputPin->getNet() !=
CE)
1198 if (inputPin->isUnconnected() &&
SR)
1200 if (inputPin->getNet() !=
SR)
1209 assert(
false &&
"undefined FF input pin type.");
1228 if (inputPin->isUnconnected())
1230 CLK = inputPin->getNet();
1234 if (inputPin->isUnconnected())
1236 CE = inputPin->getNet();
1240 if (inputPin->isUnconnected())
1242 SR = inputPin->getNet();
1250 assert(
false &&
"undefined FF input pin type.");
1290 FFs.push_back(curFF);
1298 inline std::vector<DesignInfo::DesignCell *> &
getFFs()
1306 std::cout <<
"CLK: " <<
CLK->
getName() <<
"\n";
1308 std::cout <<
"SR: " <<
SR->
getName() <<
"\n";
1310 std::cout <<
"CE: " <<
CE->
getName() <<
"\n";
1320 std::vector<DesignInfo::DesignCell *>
FFs;
1437 for (
auto cell :
cells)
1465 DesignCell *
addCell(DesignCell *curCell);
1477 assert(curFF->
isFF());
1485 if (!inputPin->isUnconnected())
1486 CLKId = inputPin->getNet()->getElementIdInType();
1490 if (!inputPin->isUnconnected())
1491 CEId = inputPin->getNet()->getElementIdInType();
1495 if (!inputPin->isUnconnected())
1496 SRId = inputPin->getNet()->getElementIdInType();
1504 assert(
false &&
"undefined FF input pin type.");
1519 assert(curFF->
isFF());
1527 if (!inputPin->isUnconnected())
1528 *CLK = inputPin->getNet();
1532 if (!inputPin->isUnconnected())
1533 *CE = inputPin->getNet();
1537 if (!inputPin->isUnconnected())
1538 *SR = inputPin->getNet();
1546 assert(
false &&
"undefined FF input pin type.");
1588 assert(curFF->
isFF());
1602 return cells.size();
1629 net->resetEnhanceRatio();
1638 std::cout <<
"cannot find cell:" << tmpName <<
"\n";
1648 std::cout <<
"cannot find net:" << tmpName <<
"\n";
std::map< std::string, DesignNet * > name2Net
static bool isBRAM(DesignCellType cellType)
int getFFControlSetId(DesignCell *curFF)
get the id of the control set of a given FF
DesignInfo::DesignNet * CLK
std::string driverPinName
void printStat(bool verbose=false)
@ CellType_TX_BITSLICE_TRI
void setDeterminedOccupation(int cellId, int occupation)
Set the Determined Occupation of a specific cell.
void connectToNetName(std::string &_netName)
bind the pin to the net by the net name
DesignInfo::DesignNet * CE
std::set< DesignNet * > clockSet
std::map< std::string, int > aliasNet2AliasNetId
void setControlSetInfoAs(DesignInfo::DesignCell *curFF)
Set the control set information accoridng to a given FF.
~DesignCell()
Destroy the Design Cell object and its binded DesignPin objects.
float getOffsetXInCell()
Get the offset X of the pin In the cell.
std::vector< DesignPin * > pins
std::vector< std::string > pinNames
bool isTimingEndPoint()
check whether the cell is an endpoint in timing graph
void addNetForPin(DesignPin *_pinPtr, DesignNet *_netPtr)
add a net and assign it into output/input net list
void connectToPinVariable(DesignPin *_pinPtr)
bind the net to a pin's pointer
bool isUnconnected()
check if the attribute unconnected is true
std::map< DesignNet *, std::set< DesignCell * > > clock2Cells
the mapping from clocks to their corresponding cells driven by the clock net
std::vector< DesignNet * > inputNetPtrs
DesignElement(bool isVirtual, const std::string &_name, DesignElementType type, int id)
void addPinToNet(DesignPin *curPin)
bind a pin to an existing net. If the net does not exist, new one.
std::vector< DesignPin * > & getOutputPins()
int getDeterminedOccupation(int cellId)
void enhanceOverallTimingNetEnhancement(float r)
increase the Overall Net Enhancement (the entire net can be enhanced to a pre-defined extent....
bool isLogicRelated()
check whether the cell is related to logic computation
void setVirtualType(DesignCellType NewCellType)
Set the Virtual Type object which might override the actual type in later processing.
float getOverallEnhanceRatio()
Get the Overall Enhance Ratio (the entire net can be enhanced to a pre-defined extent....
DesignElement(const std::string &name, DesignElement *parentPtr, DesignElementType type, int id)
std::vector< DesignNet * > & getNets()
DesignElementType
types of the elements in a design
DesignNet(std::string &name, int id, bool virtualNet=false)
Construct a new Design Net object.
a DesignCell in design netlist, DesignPin objects of which might connect to DesignNet objects
std::set< DesignCell * > & getCellsUnderClock(DesignNet *clock)
Get the cells driven by a given clock net.
std::vector< DesignPin * > pinPtrs
std::vector< DesignInfo::DesignCell * > FFs
std::set< DesignNet * > clockNetPtrs
a design net (hyperedge) defined in the design, connecting to pins of cells
bool checkContainFixedPins()
std::map< DesignCellType, std::vector< DesignCell * > > & getType2Cells()
void loadUserDefinedClusterNets()
for user-defined-cluster-based optimization, load the nets in a user-defined cluster for later proces...
bool isLogicRelated(DesignCellType cellType)
check whether the cell is related to logic computation
std::vector< DesignPin * > inputPinPtrs
DesignCell * getCell(std::string &tmpName)
std::vector< ControlSetInfo * > controlSets
std::vector< DesignPin * > driverPinPtrs
std::vector< DesignNet * > netlist
std::vector< DesignPin * > & getPins()
Get the vector reference of the pins.
DesignPinType pinType
pin type could be:
DesignInfo::DesignNet * getCE() const
std::vector< DesignPin * > outputPinPtrs
bool isDesignClock(DesignNet *tmpNet)
check if a net is a global clock indicated by input design files
std::vector< std::string > pinNames
DesignCellType
design cell types
A design pin on a design cell connected to a net.
DesignElement * getParentPtr()
static bool isCarry(DesignCellType cellType)
void setTimingLength(int _timingLength)
void getCLKSRCENet(DesignInfo::DesignCell *curFF, DesignNet **CLK, DesignNet **SR, DesignNet **CE)
extract the pointers of CLK, SR, and CE for a given FF
void addFF(DesignInfo::DesignCell *curFF)
add a FF into the set of FFs which are compatible to this control set
static bool FFSRCompatible(DesignCellType typeA, DesignCellType typeB)
DesignCellType getCellType()
static bool isLUTRAM(DesignCellType cellType)
DesignInfo::DesignCellType getFFType() const
std::string & getRefPinName()
Get the reference pin name of the pin.
static bool isDSP(DesignCellType cellType)
std::vector< DesignNet * > & getClocksInDesign()
Get the all the clock nets in the design.
DesignCell(const std::string &name, DesignElement *parentPtr, DesignCellType cellType, int id)
Construct a new Design Cell object.
void updateFFControlSets()
go through the FF cells to extract control sets for later processing
DesignElementType getElementType()
void enhance(int pinIdInNetA, int pinIdInNetB, float ratio)
placer can customize some 2-pin interconnections to make their weights enhanced during wirelength opt...
basic class of element in a design.
DesignInfo::DesignNet * getCLK() const
static bool isIO(DesignCellType cellType)
std::vector< DesignCell * > cells
bool compatibleWith(DesignInfo::DesignCell *curFF)
check if a FF is compatible with the control set
bool isShifter(DesignCellType cellType)
This header file contains the classes of data for a standalone device.
DesignNet * getNet(std::string &tmpName)
std::vector< std::string > netNames
void setContainFixedPins()
void getCLKSRCENetId(DesignInfo::DesignCell *curFF, int &CLKId, int &SRId, int &CEId)
extract the ids of CLK, SR, and CE for a given FF
std::vector< ControlSetInfo * > & getControlSets()
Get the control sets in the design.
DesignInfo(std::map< std::string, std::string > &JSONCfg, DeviceInfo *deviceInfo)
Construct a new Design Info object based on user-defined settings and device information.
DesignInfo::DesignNet * SR
bool checkIsGlobalClock()
check the attribute isGlobalClock
DesignCellType getOriCellType()
Get the Original Cell Type object defined in the design netlist.
void resetLUTFFDeterminedOccupation()
reset the LUTFFDeterminedOccupation object
DesignPinType getPinType()
Get the Pin Type of the pin.
@ CellType_OBUFDS_DUAL_BUF
std::vector< DesignPin * > pinPtrs
void enhanceFFControlSetNets()
intend to enhance the nets between FFs in a control set to make later packing easier
DesignCell(const std::string &name, DesignCellType cellType, int id)
Construct a new Design Cell object.
std::vector< DesignPin * > & getPinsBeDriven()
Get the vector reference of the pins driven by the net.
A control set is a combination of CLK, CE and SR signal. It could be nullptr (not related to control ...
DesignInfo::DesignNet * getSR() const
std::vector< std::vector< DesignCell * > > & getPredefinedClusters()
Get the predefined clusters which are defined in design configuration files.
static bool isFF(DesignCellType cellType)
std::vector< DesignPin * > & getDriverPins()
Get the vector reference of the driver pins of the net.
void setControlSetInfo(ControlSetInfo *_controlSetInfo)
Set the Control Set Info object of this cell.
std::vector< DesignInfo::DesignCell * > & getFFs()
get the set of FFs which are compatible to this control set
DesignElement * parentPtr
DesignPin * getDriverPin()
Get the driver pin of the pin (nullptr indicates that the pin connects to some global signal like VGG...
ControlSetInfo(DesignInfo::DesignCell *curFF, int id)
Construct a new Control Set Info object with signals of a given FF and a given ID.
std::vector< int > FFId2ControlSetId
the mapping from FF IDs to a unique defined control set id
const std::string & getName() const
std::map< std::string, std::string > & JSONCfg
void connectToNetVariable(DesignNet *_netPtr)
bind the pin to the net's pointer for later processing
DesignCell(bool isVirtual, const std::string &name, DesignCellType cellType, int id)
Construct a new Design Cell object.
std::map< std::tuple< int, int, int, int >, int > CLKSRCEFFType2ControlSetInfoId
the mapping from the tuple of CLK/SR/CE ids and FF type to a unique defined control set id
void setOverallClusterNetEnhancement(float r)
Set the Overall Net Enhancement (the entire net can be enhanced to a pre-defined extent....
std::ostream & operator<<(std::ostream &os, DesignInfo::DesignCell *cell)
bool originallyIsLUTRAM()
int getCellId()
Get the Cell Id in the cell list.
std::vector< std::string > DesignCellTypeStr
DesignCell(bool isVirtual, DesignCellType cellType, int id)
Construct a new Design Cell object without given name. The cell name will be its id string.
ControlSetInfo * getControlSetInfo()
Get the Control Set Info object of this cell.
void setDriverPinName(std::string &_driverPinName)
Set the driver Pin Name of the pin.
void resetNetEnhanceRatio()
disable enhancement of all the nets in the design (reset extra weight to be 1)
float getOverallTimingEnhanceRatio()
Get the Overall Enhance Ratio (the entire net can be enhanced to a pre-defined extent....
std::set< std::pair< DesignPin *, DesignPin * > > connectedPinsWithSmallNet
connected pin pairs by nets with a small number of pins
void setUnconnected()
Set the attribute unconnected to be true, indicating the pin connect to no net.
ControlSetInfo * controlSetInfo
float getOffsetYInCell()
Get the offset Y of the pin In the cell.
std::vector< DesignNet * > netPtrs
void setDriverPin(DesignPin *_driverPinPtr)
Set the Driver Pin object.
void connectToPinName(const std::string &_pinName)
bind the net to a pin by name
std::vector< DesignCell * > & getCells()
DesignInfo::DesignCellType FFType
std::map< std::pair< int, int >, float > pinIdPinIdInNet2EnhanceRatio
std::vector< DesignNet * > & getInputNets()
float overallClusterEnhanceRatio
std::map< std::string, DesignCell * > name2Cell
std::vector< int > LUTFFDeterminedOccupation
LUTFFDeterminedOccupation is used to record the final resource demand of a LUT/FF after final packing...
Information class related to FPGA device, including the details of BEL/Site/Tile/ClockRegion.
std::vector< DesignPin * > & getPins()
void addClockNet(DesignNet *aClockNet)
add a clock net which is connected to this cell for later legalization
std::vector< DesignPin * > BeDrivenPinPtrs
void setHasDSPReg(bool _hasDSPReg)
const int getId() const
Get the Id of the control set (each control set will have a unique Id)
float getPinPairEnhanceRatio(int pinIdInNetA, int pinIdInNetB)
Get the Pin Pair Enhance Ratio (placer can customize some 2-pin interconnections to make their weight...
std::string & getNetName()
Get the name of the net which the pin connects to.
void enhanceOverallClusterNetEnhancement(float r)
increase the Overall Net Enhancement (the entire net can be enhanced to a pre-defined extent....
void setOverallTimingNetEnhancement(float r)
Set the Overall Net Enhancement (the entire net can be enhanced to a pre-defined extent....
bool isClockBuffer(DesignCellType cellType)
DesignCell * addCell(DesignCell *curCell)
add a cell into the design information
DesignCellType fromStringToCellType(std::string &cellName, std::string &typeName)
translate a string into a DesignCellType for a cell
static bool isLUT(DesignCellType cellType)
void updateParentCellNetInfo()
let the parent cell know that one of its pin connects to a specific net
std::vector< DesignPin * > & getInputPins()
std::string designArchievedTextFileName
std::set< DesignNet * > & getClockNets()
Get the clock nets connected to this cell for later legalization.
DesignCell * getCell()
Get the Cell object of the pin.
float getOverallClusterEnhanceRatio()
Get the Overall Enhance Ratio (the entire net can be enhanced to a pre-defined extent....
std::vector< DesignNet * > & getOutputNets()
DesignElement(bool isVirtual, DesignElementType type, int id)
std::vector< DesignNet * > clocks
std::vector< DesignNet * > outputNetPtrs
void loadClocks(std::string clockFileName)
load the global clock signals from a design information file
float overallTimingEnhanceRatio
std::vector< std::vector< DesignCell * > > predefinedClusters
the predefined clusters which are defined in design configuration files
Information related to FPGA designs, including design cells and their interconnections.
void setGlobalClock()
Set the attribute isGlobalClock to be true.
std::map< DesignCellType, std::vector< DesignCell * > > type2Cells
bool checkIsPowerNet()
check whether the net is VCC or GND
void setOffsetInCell(float x, float y)
Set the Offset of the pin relative to the cell.
static bool isMux(DesignCellType cellType)
DesignPin(std::string &name, std::string &refpinname, DesignPinType pinType, bool inputOrNot, DesignElement *parentPtr, int id)
Construct a new Design Pin object.
std::vector< DesignPin * > & getPins()
void addPin(DesignPin *_pinPtr)
bind a pin to the cell
@ CellType_BITSLICE_CONTROL
static DesignPinType checkPinType(DesignCell *cell, std::string &refpinname, bool isInput)
get the pin type based on its reference name
DesignElement(const std::string &name, DesignElementType type, int id)
DesignCellType oriCellType
void setAliasNetId(int _aliasNetId)
static bool getFFSRType(DesignCellType typeA)