10 #include <QTextStream>
24 std::vector<Net*> inputNets;
40 for (Net* n : inputNets)
42 for (
const Endpoint* ep : n->get_sources())
44 Gate* inpGate = ep->get_gate();
45 if (inpGate->is_gnd_gate() || inpGate->is_vcc_gate())
47 u32 inpGateId = inpGate->get_id();
50 mPredecessorSet.insert(inpEntry);
74 int n = mPredecessorSet.size();
78 for (
const QPoint& source : mPredecessorPositions)
82 retval += (n - mPredecessorPositions.size()) * defaultDistance * 4;
88 retval +=
getId() / 1000000.;
94 int dx = abs(source.
x() + 1 - pos.
x());
95 int dy = abs(source.
y() - pos.
y()) - 1;
103 return 5 + 4 * (dx + dy);
121 wtse->setPredecessorIds(mGateMap);
126 wtsePred->mSuccessorSet.insert(wtse);
129 if (wtse->mPredecessorSet.isEmpty())
131 if (wtse->mSuccessorSet.isEmpty())
137 if (mIsolated.
size() > 1)
140 if (mStartpoint.
size() > 1)
143 mSideLength = sqrt(
size());
157 mGateMap.insert(g->get_id(), wtse);
161 mGateMap.insert(wtse->
getId(), wtse);
166 bool isEdge = pos.
x() == 0 || pos.
y() == 0;
167 if (!mIsolated.
isEmpty() && (isEdge || mWaiting.isEmpty()))
171 if (!mStartpoint.
isEmpty() && (isEdge || mWaiting.isEmpty()))
179 if (!mPlaced.contains(wtse))
181 mWaiting.insert(wtse, mPlacementRound);
186 if (!mWaiting.isEmpty())
188 double minDistance = 0;
192 double distance = it.key()->distance(pos, mSideLength) - 0.5 * (mPlacementRound - it.value());
193 if (jt == mWaiting.end() || distance < minDistance)
195 minDistance = distance;
199 Q_ASSERT(jt != mWaiting.end());
210 assert(!mPlaced.contains(wtse));
212 mPlaced.insert(wtse);
215 wtseSucc->mPredecessorPositions.
append(pos);
216 if (!mWaiting.contains(wtseSucc) && !mPlaced.contains(wtseSucc))
217 mWaiting.insert(wtseSucc, mPlacementRound);
225 xout <<
"WaitToBeSeatedList\n";
229 xout << wtse->
getId();
230 xout << (wtse->
isModule() ?
"MOD" :
"GAT");
241 xout.setFieldWidth(0);
244 xout <<
"------------------------\n";
const std::vector< Net * > & get_fan_in_nets() const
const std::vector< Gate * > & get_gates() const
const std::unordered_set< Net * > & get_input_nets() const
Gate * get_gate_by_id(const u32 gate_id) const
Module * get_module_by_id(u32 module_id) const
The Node class object represents a module or a gate.
bool isModule() const
isModule test wheter node is a module
u32 id() const
id getter for ID information
double distance(const QPoint &pos, double defaultDistance) const
WaitToBeSeatedEntry(Node::NodeType t=Node::Module, u32 id=0)
void add(WaitToBeSeatedEntry *wtse)
const WaitToBeSeatedEntry * doPlacement(const QPoint &pos, WaitToBeSeatedEntry *wtse)
const WaitToBeSeatedEntry * nextPlacement(const QPoint &pos)
bool placementDone() const
std::vector< T > to_vector(const Container< T, Args... > &container)
bool compareWaitToBeSeated(const WaitToBeSeatedEntry *a, const WaitToBeSeatedEntry *b)
void append(const T &value)
bool isEmpty() const const
const Key & key() const const
const T value(const Key &key, const T &defaultValue) const const
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
void setFieldWidth(int width)