mirror of https://github.com/YosysHQ/yosys.git
format fixes in "sat -dump_json"
This commit is contained in:
parent
1ecee6c49c
commit
08c0fe164f
|
@ -758,13 +758,6 @@ struct SatHelper
|
||||||
|
|
||||||
log("Dumping SAT model to WaveJSON file '%s'.\n", json_file_name.c_str());
|
log("Dumping SAT model to WaveJSON file '%s'.\n", json_file_name.c_str());
|
||||||
|
|
||||||
std::string module_fname = "unknown";
|
|
||||||
auto apos = module->attributes.find("\\src");
|
|
||||||
if(apos != module->attributes.end())
|
|
||||||
module_fname = module->attributes["\\src"].decode_string();
|
|
||||||
|
|
||||||
fprintf(f, "// Generated by %s\n", yosys_version_str);
|
|
||||||
|
|
||||||
int mintime = 1, maxtime = 0, maxwidth = 0;;
|
int mintime = 1, maxtime = 0, maxwidth = 0;;
|
||||||
dict<string, pair<int, dict<int, Const>>> wavedata;
|
dict<string, pair<int, dict<int, Const>>> wavedata;
|
||||||
|
|
||||||
|
@ -784,13 +777,19 @@ struct SatHelper
|
||||||
maxwidth = std::max(maxwidth, info.width);
|
maxwidth = std::max(maxwidth, info.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(f, "{ signal: [\n");
|
fprintf(f, "{ \"signal\": [");
|
||||||
for (auto &wd : wavedata) {
|
bool fist_wavedata = true;
|
||||||
|
for (auto &wd : wavedata)
|
||||||
|
{
|
||||||
|
fprintf(f, "%s", fist_wavedata ? "\n" : ",\n");
|
||||||
|
fist_wavedata = false;
|
||||||
|
|
||||||
vector<string> data;
|
vector<string> data;
|
||||||
string name = wd.first.c_str();
|
string name = wd.first.c_str();
|
||||||
while (name.substr(0, 1) == "\\")
|
while (name.substr(0, 1) == "\\")
|
||||||
name = name.substr(1);
|
name = name.substr(1);
|
||||||
fprintf(f, " { name: '%s', wave: '", name.c_str());
|
|
||||||
|
fprintf(f, " { \"name\": \"%s\", \"wave\": \"", name.c_str());
|
||||||
for (int i = mintime; i <= maxtime; i++) {
|
for (int i = mintime; i <= maxtime; i++) {
|
||||||
if (wd.second.second.count(i)) {
|
if (wd.second.second.count(i)) {
|
||||||
string this_data = wd.second.second[i].as_string();
|
string this_data = wd.second.second[i].as_string();
|
||||||
|
@ -809,18 +808,18 @@ struct SatHelper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wd.second.first != 1) {
|
if (wd.second.first != 1) {
|
||||||
fprintf(f, "', data: [");
|
fprintf(f, "\", \"data\": [");
|
||||||
for (int i = 0; i < GetSize(data); i++)
|
for (int i = 0; i < GetSize(data); i++)
|
||||||
fprintf(f, "%s'%s'", i ? ", " : "", data[i].c_str());
|
fprintf(f, "%s\"%s\"", i ? ", " : "", data[i].c_str());
|
||||||
fprintf(f, "] },\n");
|
fprintf(f, "] }");
|
||||||
} else {
|
} else {
|
||||||
fprintf(f, "' },\n");
|
fprintf(f, "\" }");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(f, " ],\n");
|
fprintf(f, "\n ],\n");
|
||||||
fprintf(f, " config: {\n");
|
fprintf(f, " \"config\": {\n");
|
||||||
fprintf(f, " hscale: %.2f,\n", maxwidth / 4.0);
|
fprintf(f, " \"hscale\": %.2f\n", maxwidth / 4.0);
|
||||||
fprintf(f, " },\n");
|
fprintf(f, " }\n");
|
||||||
fprintf(f, "}\n");
|
fprintf(f, "}\n");
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue