clangformat run
This commit is contained in:
parent
ec47ce2320
commit
be47fc3e9a
@ -27,8 +27,8 @@
|
|||||||
#include "pybindings.h"
|
#include "pybindings.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/algorithm/string/join.hpp>
|
||||||
#include <boost/filesystem/convenience.hpp>
|
#include <boost/filesystem/convenience.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
|
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "nextpnr.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "nextpnr.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
#include "log.h"
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@ -477,9 +477,9 @@ void BaseCtx::archInfoToAttributes()
|
|||||||
ci->attrs[id("CONSTR_PARENT")] = ci->constr_parent->name.c_str(this);
|
ci->attrs[id("CONSTR_PARENT")] = ci->constr_parent->name.c_str(this);
|
||||||
if (!ci->constr_children.empty()) {
|
if (!ci->constr_children.empty()) {
|
||||||
std::string constr = "";
|
std::string constr = "";
|
||||||
for(auto &item : ci->constr_children)
|
for (auto &item : ci->constr_children) {
|
||||||
{
|
if (!constr.empty())
|
||||||
if (!constr.empty()) constr += std::string(";");
|
constr += std::string(";");
|
||||||
constr += item->name.c_str(this);
|
constr += item->name.c_str(this);
|
||||||
}
|
}
|
||||||
ci->attrs[id("CONSTR_CHILDREN")] = constr;
|
ci->attrs[id("CONSTR_CHILDREN")] = constr;
|
||||||
@ -490,7 +490,8 @@ void BaseCtx::archInfoToAttributes()
|
|||||||
std::string routing;
|
std::string routing;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto &item : ni->wires) {
|
for (auto &item : ni->wires) {
|
||||||
if (!first) routing += ";";
|
if (!first)
|
||||||
|
routing += ";";
|
||||||
routing += getCtx()->getWireName(item.first).c_str(this);
|
routing += getCtx()->getWireName(item.first).c_str(this);
|
||||||
routing += ";";
|
routing += ";";
|
||||||
if (item.second.pip != PipId())
|
if (item.second.pip != PipId())
|
||||||
@ -542,8 +543,7 @@ void BaseCtx::attributesToArchInfo()
|
|||||||
if (val != ci->attrs.end()) {
|
if (val != ci->attrs.end()) {
|
||||||
std::vector<std::string> strs;
|
std::vector<std::string> strs;
|
||||||
boost::split(strs, val->second.str, boost::is_any_of(";"));
|
boost::split(strs, val->second.str, boost::is_any_of(";"));
|
||||||
for(auto val : strs)
|
for (auto val : strs) {
|
||||||
{
|
|
||||||
ci->constr_children.push_back(cells.find(id(val.c_str()))->second.get());
|
ci->constr_children.push_back(cells.find(id(val.c_str()))->second.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -554,8 +554,7 @@ void BaseCtx::attributesToArchInfo()
|
|||||||
if (val != ni->attrs.end()) {
|
if (val != ni->attrs.end()) {
|
||||||
std::vector<std::string> strs;
|
std::vector<std::string> strs;
|
||||||
boost::split(strs, val->second.str, boost::is_any_of(";"));
|
boost::split(strs, val->second.str, boost::is_any_of(";"));
|
||||||
for(size_t i=0;i<strs.size()/3;i++)
|
for (size_t i = 0; i < strs.size() / 3; i++) {
|
||||||
{
|
|
||||||
std::string wire = strs[i * 3];
|
std::string wire = strs[i * 3];
|
||||||
std::string pip = strs[i * 3 + 1];
|
std::string pip = strs[i * 3 + 1];
|
||||||
PlaceStrength strength = (PlaceStrength)std::stoi(strs[i * 3 + 2]);
|
PlaceStrength strength = (PlaceStrength)std::stoi(strs[i * 3 + 2]);
|
||||||
|
@ -299,20 +299,23 @@ struct Property
|
|||||||
|
|
||||||
bool isString() const { return is_string; }
|
bool isString() const { return is_string; }
|
||||||
|
|
||||||
void setNumber(int val) { is_string = false; num = val; str = std::to_string(val); }
|
void setNumber(int val)
|
||||||
void setString(std::string val) { is_string = true; str = val; }
|
{
|
||||||
|
is_string = false;
|
||||||
|
num = val;
|
||||||
|
str = std::to_string(val);
|
||||||
|
}
|
||||||
|
void setString(std::string val)
|
||||||
|
{
|
||||||
|
is_string = true;
|
||||||
|
str = val;
|
||||||
|
}
|
||||||
|
|
||||||
const char *c_str() const { return str.c_str(); }
|
const char *c_str() const { return str.c_str(); }
|
||||||
operator std::string() const { return str; }
|
operator std::string() const { return str; }
|
||||||
|
|
||||||
bool operator==(const std::string other) const
|
bool operator==(const std::string other) const { return str == other; }
|
||||||
{
|
bool operator!=(const std::string other) const { return str != other; }
|
||||||
return str == other;
|
|
||||||
}
|
|
||||||
bool operator!=(const std::string other) const
|
|
||||||
{
|
|
||||||
return str != other;
|
|
||||||
}
|
|
||||||
|
|
||||||
Property &operator=(std::string other)
|
Property &operator=(std::string other)
|
||||||
{
|
{
|
||||||
|
@ -374,7 +374,8 @@ class SAPlacer
|
|||||||
assign_budget(ctx, true /* quiet */);
|
assign_budget(ctx, true /* quiet */);
|
||||||
}
|
}
|
||||||
require_legal = false;
|
require_legal = false;
|
||||||
} else if (cfg.budgetBased && ctx->setting<int>("slack_redist_iter") > 0 && iter % ctx->setting<int>("slack_redist_iter") == 0) {
|
} else if (cfg.budgetBased && ctx->setting<int>("slack_redist_iter") > 0 &&
|
||||||
|
iter % ctx->setting<int>("slack_redist_iter") == 0) {
|
||||||
assign_budget(ctx, true /* quiet */);
|
assign_budget(ctx, true /* quiet */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#ifndef PLACE_H
|
#ifndef PLACE_H
|
||||||
#define PLACE_H
|
#define PLACE_H
|
||||||
|
|
||||||
#include "nextpnr.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "nextpnr.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
#ifndef PLACER_HEAP_H
|
#ifndef PLACER_HEAP_H
|
||||||
#define PLACER_HEAP_H
|
#define PLACER_HEAP_H
|
||||||
#include "nextpnr.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "nextpnr.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
#ifndef ROUTER1_H
|
#ifndef ROUTER1_H
|
||||||
#define ROUTER1_H
|
#define ROUTER1_H
|
||||||
|
|
||||||
#include "nextpnr.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "nextpnr.h"
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
struct Router1Cfg
|
struct Router1Cfg
|
||||||
|
@ -658,7 +658,8 @@ void assign_budget(Context *ctx, bool quiet)
|
|||||||
{
|
{
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
log_break();
|
log_break();
|
||||||
log_info("Annotating ports with timing budgets for target frequency %.2f MHz\n", ctx->setting<float>("target_freq") / 1e6);
|
log_info("Annotating ports with timing budgets for target frequency %.2f MHz\n",
|
||||||
|
ctx->setting<float>("target_freq") / 1e6);
|
||||||
}
|
}
|
||||||
|
|
||||||
Timing timing(ctx, ctx->setting<int>("slack_redist_iter") > 0 /* net_delays */, true /* update */);
|
Timing timing(ctx, ctx->setting<int>("slack_redist_iter") > 0 /* net_delays */, true /* update */);
|
||||||
@ -686,7 +687,8 @@ void assign_budget(Context *ctx, bool quiet)
|
|||||||
// currently achieved maximum
|
// currently achieved maximum
|
||||||
if (ctx->setting<bool>("auto_freq") && ctx->setting<int>("slack_redist_iter") > 0) {
|
if (ctx->setting<bool>("auto_freq") && ctx->setting<int>("slack_redist_iter") > 0) {
|
||||||
delay_t default_slack = delay_t((1.0e9 / ctx->getDelayNS(1)) / ctx->setting<float>("target_freq"));
|
delay_t default_slack = delay_t((1.0e9 / ctx->getDelayNS(1)) / ctx->setting<float>("target_freq"));
|
||||||
ctx->settings[ctx->id("target_freq")] = std::to_string(1.0e9 / ctx->getDelayNS(default_slack - timing.min_slack));
|
ctx->settings[ctx->id("target_freq")] =
|
||||||
|
std::to_string(1.0e9 / ctx->getDelayNS(default_slack - timing.min_slack));
|
||||||
if (ctx->verbose)
|
if (ctx->verbose)
|
||||||
log_info("minimum slack for this assign = %.2f ns, target Fmax for next "
|
log_info("minimum slack for this assign = %.2f ns, target Fmax for next "
|
||||||
"update = %.2f MHz\n",
|
"update = %.2f MHz\n",
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nextpnr.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "nextpnr.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
12
ecp5/main.cc
12
ecp5/main.cc
@ -101,10 +101,14 @@ void ECP5CommandHandler::customBitstream(Context *ctx)
|
|||||||
static std::string speedString(ArchArgs::SpeedGrade speed)
|
static std::string speedString(ArchArgs::SpeedGrade speed)
|
||||||
{
|
{
|
||||||
switch (speed) {
|
switch (speed) {
|
||||||
case ArchArgs::SPEED_6: return "6";
|
case ArchArgs::SPEED_6:
|
||||||
case ArchArgs::SPEED_7: return "7";
|
return "6";
|
||||||
case ArchArgs::SPEED_8: return "8";
|
case ArchArgs::SPEED_7:
|
||||||
case ArchArgs::SPEED_8_5G: return "8";
|
return "7";
|
||||||
|
case ArchArgs::SPEED_8:
|
||||||
|
return "8";
|
||||||
|
case ArchArgs::SPEED_8_5G:
|
||||||
|
return "8";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,8 @@ bool Arch::place()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Arch::route() {
|
bool Arch::route()
|
||||||
|
{
|
||||||
bool retVal = router1(getCtx(), Router1Cfg(getCtx()));
|
bool retVal = router1(getCtx(), Router1Cfg(getCtx()));
|
||||||
getCtx()->settings[getCtx()->id("route")] = "1";
|
getCtx()->settings[getCtx()->id("route")] = "1";
|
||||||
archInfoToAttributes();
|
archInfoToAttributes();
|
||||||
|
@ -421,8 +421,7 @@ void BaseMainWindow::updateActions()
|
|||||||
else if (ctx->settings.find(ctx->id("place")) == ctx->settings.end()) {
|
else if (ctx->settings.find(ctx->id("place")) == ctx->settings.end()) {
|
||||||
actionAssignBudget->setEnabled(true);
|
actionAssignBudget->setEnabled(true);
|
||||||
actionPlace->setEnabled(true);
|
actionPlace->setEnabled(true);
|
||||||
}
|
} else if (ctx->settings.find(ctx->id("route")) == ctx->settings.end())
|
||||||
else if (ctx->settings.find(ctx->id("route"))==ctx->settings.end())
|
|
||||||
actionRoute->setEnabled(true);
|
actionRoute->setEnabled(true);
|
||||||
|
|
||||||
onUpdateActions();
|
onUpdateActions();
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
#ifndef BASEMAINWINDOW_H
|
#ifndef BASEMAINWINDOW_H
|
||||||
#define BASEMAINWINDOW_H
|
#define BASEMAINWINDOW_H
|
||||||
|
|
||||||
|
#include "command.h"
|
||||||
#include "nextpnr.h"
|
#include "nextpnr.h"
|
||||||
#include "worker.h"
|
#include "worker.h"
|
||||||
#include "command.h"
|
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
@ -164,7 +164,8 @@ void MainWindow::onDisableActions()
|
|||||||
actionSaveConfig->setEnabled(false);
|
actionSaveConfig->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onUpdateActions() {
|
void MainWindow::onUpdateActions()
|
||||||
|
{
|
||||||
if (ctx->settings.find(ctx->id("pack")) == ctx->settings.end())
|
if (ctx->settings.find(ctx->id("pack")) == ctx->settings.end())
|
||||||
actionLoadLPF->setEnabled(true);
|
actionLoadLPF->setEnabled(true);
|
||||||
if (ctx->settings.find(ctx->id("route")) != ctx->settings.end())
|
if (ctx->settings.find(ctx->id("route")) != ctx->settings.end())
|
||||||
|
@ -186,7 +186,8 @@ void MainWindow::onDisableActions()
|
|||||||
actionSaveAsc->setEnabled(false);
|
actionSaveAsc->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onUpdateActions() {
|
void MainWindow::onUpdateActions()
|
||||||
|
{
|
||||||
if (ctx->settings.find(ctx->id("pack")) == ctx->settings.end())
|
if (ctx->settings.find(ctx->id("pack")) == ctx->settings.end())
|
||||||
actionLoadPCF->setEnabled(true);
|
actionLoadPCF->setEnabled(true);
|
||||||
if (ctx->settings.find(ctx->id("route")) != ctx->settings.end())
|
if (ctx->settings.find(ctx->id("route")) != ctx->settings.end())
|
||||||
|
@ -694,7 +694,8 @@ bool Arch::place()
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Arch::route() {
|
bool Arch::route()
|
||||||
|
{
|
||||||
bool retVal = router1(getCtx(), Router1Cfg(getCtx()));
|
bool retVal = router1(getCtx(), Router1Cfg(getCtx()));
|
||||||
getCtx()->settings[getCtx()->id("route")] = "1";
|
getCtx()->settings[getCtx()->id("route")] = "1";
|
||||||
archInfoToAttributes();
|
archInfoToAttributes();
|
||||||
|
@ -342,8 +342,7 @@ static void pack_constants(Context *ctx)
|
|||||||
gnd_cell->ports.at(ctx->id("O")).net = gnd_net.get();
|
gnd_cell->ports.at(ctx->id("O")).net = gnd_net.get();
|
||||||
|
|
||||||
NetInfo *gnd_net_info = gnd_net.get();
|
NetInfo *gnd_net_info = gnd_net.get();
|
||||||
if (ctx->nets.find(ctx->id("$PACKER_GND_NET"))!=ctx->nets.end())
|
if (ctx->nets.find(ctx->id("$PACKER_GND_NET")) != ctx->nets.end()) {
|
||||||
{
|
|
||||||
gnd_net_info = ctx->nets.find(ctx->id("$PACKER_GND_NET"))->second.get();
|
gnd_net_info = ctx->nets.find(ctx->id("$PACKER_GND_NET"))->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,8 +355,7 @@ static void pack_constants(Context *ctx)
|
|||||||
vcc_cell->ports.at(ctx->id("O")).net = vcc_net.get();
|
vcc_cell->ports.at(ctx->id("O")).net = vcc_net.get();
|
||||||
|
|
||||||
NetInfo *vcc_net_info = vcc_net.get();
|
NetInfo *vcc_net_info = vcc_net.get();
|
||||||
if (ctx->nets.find(ctx->id("$PACKER_VCC_NET"))!=ctx->nets.end())
|
if (ctx->nets.find(ctx->id("$PACKER_VCC_NET")) != ctx->nets.end()) {
|
||||||
{
|
|
||||||
vcc_net_info = ctx->nets.find(ctx->id("$PACKER_VCC_NET"))->second.get();
|
vcc_net_info = ctx->nets.find(ctx->id("$PACKER_VCC_NET"))->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,8 +385,7 @@ static void pack_constants(Context *ctx)
|
|||||||
}
|
}
|
||||||
// Vcc cell always inserted for now, as it may be needed during carry legalisation (TODO: trim later if actually
|
// Vcc cell always inserted for now, as it may be needed during carry legalisation (TODO: trim later if actually
|
||||||
// never used?)
|
// never used?)
|
||||||
if (vcc_net_info == vcc_net.get())
|
if (vcc_net_info == vcc_net.get()) {
|
||||||
{
|
|
||||||
ctx->cells[vcc_cell->name] = std::move(vcc_cell);
|
ctx->cells[vcc_cell->name] = std::move(vcc_cell);
|
||||||
ctx->nets[vcc_net->name] = std::move(vcc_net);
|
ctx->nets[vcc_net->name] = std::move(vcc_net);
|
||||||
}
|
}
|
||||||
@ -1239,7 +1236,8 @@ static void pack_special(Context *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto feedback_path = packed->params[ctx->id("FEEDBACK_PATH")];
|
auto feedback_path = packed->params[ctx->id("FEEDBACK_PATH")];
|
||||||
std::string fbp_value = feedback_path == "DELAY"
|
std::string fbp_value =
|
||||||
|
feedback_path == "DELAY"
|
||||||
? "0"
|
? "0"
|
||||||
: feedback_path == "SIMPLE"
|
: feedback_path == "SIMPLE"
|
||||||
? "1"
|
? "1"
|
||||||
|
@ -352,8 +352,7 @@ void json_import_net_attrib(Context *ctx, string &modname, NetInfo *net, JsonNod
|
|||||||
} else if (param->type == 'S')
|
} else if (param->type == 'S')
|
||||||
(*dest)[pId].setString(param->data_string);
|
(*dest)[pId].setString(param->data_string);
|
||||||
else
|
else
|
||||||
log_error("JSON parameter type of \"%s\' of net \'%s\' not supported\n", pId.c_str(ctx),
|
log_error("JSON parameter type of \"%s\' of net \'%s\' not supported\n", pId.c_str(ctx), net->name.c_str(ctx));
|
||||||
net->name.c_str(ctx));
|
|
||||||
if (json_debug)
|
if (json_debug)
|
||||||
log_info(" Added parameter \'%s\'=%s to net \'%s\' "
|
log_info(" Added parameter \'%s\'=%s to net \'%s\' "
|
||||||
"of module \'%s\'\n",
|
"of module \'%s\'\n",
|
||||||
@ -377,8 +376,8 @@ void json_import_top_attrib(Context *ctx, string &modname, JsonNode *param_node,
|
|||||||
else
|
else
|
||||||
log_error("JSON parameter type of \"%s\' of module not supported\n", pId.c_str(ctx));
|
log_error("JSON parameter type of \"%s\' of module not supported\n", pId.c_str(ctx));
|
||||||
if (json_debug)
|
if (json_debug)
|
||||||
log_info(" Added parameter \'%s\'=%s module \'%s\'\n",
|
log_info(" Added parameter \'%s\'=%s module \'%s\'\n", pId.c_str(ctx), (*dest)[pId].c_str(),
|
||||||
pId.c_str(ctx), (*dest)[pId].c_str(), modname.c_str());
|
modname.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static int const_net_idx = 0;
|
static int const_net_idx = 0;
|
||||||
@ -902,7 +901,8 @@ void json_import(Context *ctx, string modname, JsonNode *node)
|
|||||||
|
|
||||||
JsonNode *attr_node = here->data_dict.at("attributes");
|
JsonNode *attr_node = here->data_dict.at("attributes");
|
||||||
if (attr_node->type != 'D')
|
if (attr_node->type != 'D')
|
||||||
log_error("JSON attribute list of \'%s\' is not a data dictionary\n", this_net->name.c_str(ctx));
|
log_error("JSON attribute list of \'%s\' is not a data dictionary\n",
|
||||||
|
this_net->name.c_str(ctx));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Loop through all attributes, adding them into the
|
// Loop through all attributes, adding them into the
|
||||||
@ -911,7 +911,6 @@ void json_import(Context *ctx, string modname, JsonNode *node)
|
|||||||
for (int attrid = 0; attrid < GetSize(attr_node->data_dict_keys); attrid++) {
|
for (int attrid = 0; attrid < GetSize(attr_node->data_dict_keys); attrid++) {
|
||||||
json_import_net_attrib(ctx, modname, this_net, attr_node, &this_net->attrs, attrid);
|
json_import_net_attrib(ctx, modname, this_net, attr_node, &this_net->attrs, attrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -993,7 +992,6 @@ bool load_json_settings(std::istream &f, std::string &filename, std::unordered_m
|
|||||||
values[pId].setString(param->data_string);
|
values[pId].setString(param->data_string);
|
||||||
else
|
else
|
||||||
log_error("JSON parameter type of \"%s\' of module not supported\n", pId.c_str());
|
log_error("JSON parameter type of \"%s\' of module not supported\n", pId.c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
extern bool parse_json_file(std::istream &, std::string &, Context *);
|
extern bool parse_json_file(std::istream &, std::string &, Context *);
|
||||||
extern bool load_json_settings(std::istream &f, std::string &filename, std::unordered_map<std::string,Property> &values);
|
extern bool load_json_settings(std::istream &f, std::string &filename,
|
||||||
|
std::unordered_map<std::string, Property> &values);
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,12 +43,10 @@ std::string get_string(std::string str)
|
|||||||
return newstr + "\"";
|
return newstr + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string get_name(IdString name, Context *ctx)
|
std::string get_name(IdString name, Context *ctx) { return get_string(name.c_str(ctx)); }
|
||||||
{
|
|
||||||
return get_string(name.c_str(ctx));
|
|
||||||
}
|
|
||||||
|
|
||||||
void write_parameters(std::ostream &f, Context *ctx, const std::unordered_map<IdString, Property> ¶meters, bool for_module=false)
|
void write_parameters(std::ostream &f, Context *ctx, const std::unordered_map<IdString, Property> ¶meters,
|
||||||
|
bool for_module = false)
|
||||||
{
|
{
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto ¶m : parameters) {
|
for (auto ¶m : parameters) {
|
||||||
@ -81,7 +79,8 @@ void write_module(std::ostream &f, Context *ctx)
|
|||||||
auto &c = pair.second;
|
auto &c = pair.second;
|
||||||
f << stringf("%s\n", first ? "" : ",");
|
f << stringf("%s\n", first ? "" : ",");
|
||||||
f << stringf(" %s: {\n", get_name(c.name, ctx).c_str());
|
f << stringf(" %s: {\n", get_name(c.name, ctx).c_str());
|
||||||
f << stringf(" \"direction\": \"%s\",\n", c.type == PORT_IN ? "input" : c.type == PORT_INOUT ? "inout" : "output");
|
f << stringf(" \"direction\": \"%s\",\n",
|
||||||
|
c.type == PORT_IN ? "input" : c.type == PORT_INOUT ? "inout" : "output");
|
||||||
f << stringf(" \"bits\": [ %d ]\n", pair.first.index);
|
f << stringf(" \"bits\": [ %d ]\n", pair.first.index);
|
||||||
f << stringf(" }");
|
f << stringf(" }");
|
||||||
first = false;
|
first = false;
|
||||||
@ -154,7 +153,8 @@ void write_module(std::ostream &f, Context *ctx)
|
|||||||
void write_context(std::ostream &f, Context *ctx)
|
void write_context(std::ostream &f, Context *ctx)
|
||||||
{
|
{
|
||||||
f << stringf("{\n");
|
f << stringf("{\n");
|
||||||
f << stringf(" \"creator\": %s,\n", get_string( "Next Generation Place and Route (git sha1 " GIT_COMMIT_HASH_STR ")").c_str());
|
f << stringf(" \"creator\": %s,\n",
|
||||||
|
get_string("Next Generation Place and Route (git sha1 " GIT_COMMIT_HASH_STR ")").c_str());
|
||||||
f << stringf(" \"modules\": {\n");
|
f << stringf(" \"modules\": {\n");
|
||||||
write_module(f, ctx);
|
write_module(f, ctx);
|
||||||
f << stringf("\n }");
|
f << stringf("\n }");
|
||||||
|
Loading…
Reference in New Issue
Block a user