diff options
Diffstat (limited to 'common/nextpnr.cc')
-rw-r--r-- | common/nextpnr.cc | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/common/nextpnr.cc b/common/nextpnr.cc index a026b60d..d4cc4917 100644 --- a/common/nextpnr.cc +++ b/common/nextpnr.cc @@ -18,8 +18,8 @@ */ #include "nextpnr.h" -#include "log.h" #include <boost/algorithm/string.hpp> +#include "log.h" NEXTPNR_NAMESPACE_BEGIN @@ -465,23 +465,23 @@ void BaseCtx::archInfoToAttributes() ci->attrs[id("NEXTPNR_BEL")] = getCtx()->getBelName(ci->bel).c_str(this); ci->attrs[id("BEL_STRENGTH")] = std::to_string((int)ci->belStrength); } - if (ci->constr_x!= ci->UNCONSTR) + if (ci->constr_x != ci->UNCONSTR) ci->attrs[id("CONSTR_X")] = std::to_string(ci->constr_x); - if (ci->constr_y!= ci->UNCONSTR) + if (ci->constr_y != ci->UNCONSTR) ci->attrs[id("CONSTR_Y")] = std::to_string(ci->constr_y); - if (ci->constr_z!= ci->UNCONSTR) { + if (ci->constr_z != ci->UNCONSTR) { ci->attrs[id("CONSTR_Z")] = std::to_string(ci->constr_z); ci->attrs[id("CONSTR_ABS_Z")] = std::to_string(ci->constr_abs_z ? 1 : 0); } - if (ci->constr_parent!= nullptr) + if (ci->constr_parent != nullptr) ci->attrs[id("CONSTR_PARENT")] = ci->constr_parent->name.c_str(this); if (!ci->constr_children.empty()) { std::string constr = ""; - for(auto &item : ci->constr_children) - { - if (!constr.empty()) constr += std::string(";"); + for (auto &item : ci->constr_children) { + if (!constr.empty()) + constr += std::string(";"); constr += item->name.c_str(this); - } + } ci->attrs[id("CONSTR_CHILDREN")] = constr; } } @@ -490,7 +490,8 @@ void BaseCtx::archInfoToAttributes() std::string routing; bool first = true; for (auto &item : ni->wires) { - if (!first) routing += ";"; + if (!first) + routing += ";"; routing += getCtx()->getWireName(item.first).c_str(this); routing += ";"; if (item.second.pip != PipId()) @@ -501,7 +502,7 @@ void BaseCtx::archInfoToAttributes() ni->attrs[id("ROUTING")] = routing; } } - + void BaseCtx::attributesToArchInfo() { for (auto &cell : cells) { @@ -512,7 +513,7 @@ void BaseCtx::attributesToArchInfo() PlaceStrength strength = PlaceStrength::STRENGTH_USER; if (str != ci->attrs.end()) strength = (PlaceStrength)std::stoi(str->second.str); - + BelId b = getCtx()->getBelByName(id(val->second.str)); getCtx()->bindBel(b, ci, strength); } @@ -525,12 +526,12 @@ void BaseCtx::attributesToArchInfo() ci->constr_y = std::stoi(val->second.str); val = ci->attrs.find(id("CONSTR_Z")); - if (val != ci->attrs.end()) + if (val != ci->attrs.end()) ci->constr_z = std::stoi(val->second.str); val = ci->attrs.find(id("CONSTR_ABS_Z")); if (val != ci->attrs.end()) - ci->constr_abs_z = std::stoi(val->second.str)==1; + ci->constr_abs_z = std::stoi(val->second.str) == 1; val = ci->attrs.find(id("CONSTR_PARENT")); if (val != ci->attrs.end()) { @@ -541,11 +542,10 @@ void BaseCtx::attributesToArchInfo() val = ci->attrs.find(id("CONSTR_CHILDREN")); if (val != ci->attrs.end()) { std::vector<std::string> strs; - boost::split(strs,val->second.str,boost::is_any_of(";")); - for(auto val : strs) - { + boost::split(strs, val->second.str, boost::is_any_of(";")); + for (auto val : strs) { ci->constr_children.push_back(cells.find(id(val.c_str()))->second.get()); - } + } } } for (auto &net : getCtx()->nets) { @@ -553,12 +553,11 @@ void BaseCtx::attributesToArchInfo() auto val = ni->attrs.find(id("ROUTING")); if (val != ni->attrs.end()) { std::vector<std::string> strs; - boost::split(strs,val->second.str,boost::is_any_of(";")); - for(size_t i=0;i<strs.size()/3;i++) - { - std::string wire = strs[i*3]; - std::string pip = strs[i*3 + 1]; - PlaceStrength strength = (PlaceStrength)std::stoi(strs[i*3 + 2]); + boost::split(strs, val->second.str, boost::is_any_of(";")); + for (size_t i = 0; i < strs.size() / 3; i++) { + std::string wire = strs[i * 3]; + std::string pip = strs[i * 3 + 1]; + PlaceStrength strength = (PlaceStrength)std::stoi(strs[i * 3 + 2]); if (pip.empty()) getCtx()->bindWire(getCtx()->getWireByName(id(wire)), ni, strength); else |