27 if (
g->has_location())
29 int lx = (int) floor(
g->get_location_x()+0.5);
30 int ly = (int) floor(
g->get_location_y()+0.5);
33 return fromData(
g->get_data_map());
40 CoordinateFromData CoordinateFromData::fromData(
const std::map<std::tuple<std::string, std::string>,
41 std::tuple<std::string, std::string> >& dc)
45 for(
const auto& [key, value] : dc)
52 if (keyTxt.
toUpper() !=
"_COORDINATE")
continue;
54 int val = valueTxt.
toInt(&ok);
66 : mUndefCount(0), mDoubleCount(0)
69 for (
u32 mid : modules)
78 mPlacedModules.
insert(mid);
98 int n = mPositionHash[cfd]++;
100 if (
n) ++ mDoubleCount;
108 mPositionHash.
clear();
109 mPlacedGates.
clear();
110 mPlacedModules.
clear();
115 return mUndefCount == 0;
129 for (
auto itx = xGrid.
begin(); itx != xGrid.
end(); ++itx)
133 for (
auto ity = yGrid.
begin(); ity != yGrid.
end(); ++ity)
136 for (
auto it =
begin(); it !=
end(); ++it)
138 int px = xGrid.
value(it.value().x());
139 int py = yGrid.
value(it.value().y());
147 log_info(
"gui",
"multiple assignment to same gate coordinate(s)");
150 && mDoubleCount == 0;
Utility class that extracts (if possible) x and y coordinates contained in the netlist.
static CoordinateFromData fromNode(const Node &nd)
CoordinateFromData(int x_=INT_MIN, int y_=INT_MIN)
CoordinateFromDataMap(const QSet< u32 > &modules, const QSet< u32 > &gates)
bool isPlacementComplete() const
const std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string > > & get_data_map() 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.
NodeType type() const
type getter for type information
u32 id() const
id getter for ID information
#define log_info(channel,...)
QChar toUpper() const const
ushort unicode() const const
QHash::iterator insert(const Key &key, const T &value)
QList< T > values() const const
const T value(const Key &key, const T &defaultValue) const const
QSet::iterator insert(const T &value)
bool isEmpty() const const
const QChar at(int position) const const
QString fromStdString(const std::string &str)
bool isEmpty() const const
QString & remove(int position, int n)
int toInt(bool *ok, int base) const const
QString toUpper() const const