Support ecp5 read write additional cell info
This commit is contained in:
parent
82ed1803c7
commit
44d6f16b66
@ -28,6 +28,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <fstream>
|
||||
@ -317,15 +318,27 @@ int CommandHandler::executeMain(std::unique_ptr<Context> ctx)
|
||||
auto constr_child = c->attrs.find(ctx->id("NEXTPNR_CONSTR_CHILDREN"));
|
||||
if (constr_main!=c->attrs.end())
|
||||
{
|
||||
std::vector<std::string> val = split(constr_main->second.str.c_str(),";");
|
||||
std::vector<std::string> val;
|
||||
boost::split(val,constr_main->second.str,boost::is_any_of(";"));
|
||||
c->constr_x = std::stoi(val[0]);
|
||||
c->constr_y = std::stoi(val[1]);
|
||||
c->constr_z = std::stoi(val[2]);
|
||||
c->constr_abs_z = val[3]=="1" ? true : false;
|
||||
c->constr_abs_z = val[3]=="1";
|
||||
c->constr_parent = nullptr;
|
||||
if (val.size()==5)
|
||||
if (!val[4].empty())
|
||||
c->constr_parent = ctx->cells.find(ctx->id(val[4].c_str()))->second.get();
|
||||
|
||||
#ifdef ARCH_ECP5
|
||||
c->sliceInfo.using_dff = val[5]=="1";
|
||||
c->sliceInfo.has_l6mux = val[6]=="1";
|
||||
c->sliceInfo.is_carry = val[7]=="1";
|
||||
c->sliceInfo.clk_sig = ctx->id(val[8]);
|
||||
c->sliceInfo.lsr_sig = ctx->id(val[9]);
|
||||
c->sliceInfo.clkmux = ctx->id(val[10]);
|
||||
c->sliceInfo.lsrmux = ctx->id(val[11]);
|
||||
c->sliceInfo.srmode = ctx->id(val[12]);
|
||||
c->sliceInfo.sd0 = std::stoi(val[13]);
|
||||
c->sliceInfo.sd1 = std::stoi(val[14]);
|
||||
#endif
|
||||
}
|
||||
if (constr_child!=c->attrs.end())
|
||||
{
|
||||
|
@ -89,6 +89,19 @@ void write_constraints(std::ostream &f, Context *ctx, CellInfo *cell, bool first
|
||||
constr += std::to_string(cell->constr_z) + ";";
|
||||
constr += std::to_string(cell->constr_abs_z ? 1:0) + ";";
|
||||
constr += cell->constr_parent!=nullptr ? cell->constr_parent->name.c_str(ctx) : "";
|
||||
#ifdef ARCH_ECP5
|
||||
constr += ";";
|
||||
constr += std::to_string(cell->sliceInfo.using_dff ? 1:0) + ";";
|
||||
constr += std::to_string(cell->sliceInfo.has_l6mux ? 1:0) + ";";
|
||||
constr += std::to_string(cell->sliceInfo.is_carry ? 1:0) + ";";
|
||||
constr += std::string(cell->sliceInfo.clk_sig.c_str(ctx)) + ";";
|
||||
constr += std::string(cell->sliceInfo.lsr_sig.c_str(ctx)) + ";";
|
||||
constr += std::string(cell->sliceInfo.clkmux.c_str(ctx)) + ";";
|
||||
constr += std::string(cell->sliceInfo.lsrmux.c_str(ctx)) + ";";
|
||||
constr += std::string(cell->sliceInfo.srmode.c_str(ctx)) + ";";
|
||||
constr += std::to_string(cell->sliceInfo.sd0) + ";";
|
||||
constr += std::to_string(cell->sliceInfo.sd1) + ";";
|
||||
#endif
|
||||
f << stringf("%s\n", first ? "" : ",");
|
||||
f << stringf(" \"NEXTPNR_CONSTRAINT\": ");
|
||||
f << get_string(constr);
|
||||
|
Loading…
Reference in New Issue
Block a user