summaryrefslogtreecommitdiff
path: root/passes/sat/sat.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-02-19 13:19:04 +0100
committerClifford Wolf <clifford@clifford.at>2015-02-19 13:19:04 +0100
commit08c0fe164fefb28dc209d35e7bd757538311d2e6 (patch)
tree68ab4ccb50ccdd74622da87178e98594e1458ce8 /passes/sat/sat.cc
parent1ecee6c49cf18f4acec7ae942d36db7370c92071 (diff)
format fixes in "sat -dump_json"
Diffstat (limited to 'passes/sat/sat.cc')
-rw-r--r--passes/sat/sat.cc35
1 files changed, 17 insertions, 18 deletions
diff --git a/passes/sat/sat.cc b/passes/sat/sat.cc
index a7a510d7..b9535f49 100644
--- a/passes/sat/sat.cc
+++ b/passes/sat/sat.cc
@@ -758,13 +758,6 @@ struct SatHelper
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;;
dict<string, pair<int, dict<int, Const>>> wavedata;
@@ -784,13 +777,19 @@ struct SatHelper
maxwidth = std::max(maxwidth, info.width);
}
- fprintf(f, "{ signal: [\n");
- for (auto &wd : wavedata) {
+ fprintf(f, "{ \"signal\": [");
+ bool fist_wavedata = true;
+ for (auto &wd : wavedata)
+ {
+ fprintf(f, "%s", fist_wavedata ? "\n" : ",\n");
+ fist_wavedata = false;
+
vector<string> data;
string name = wd.first.c_str();
while (name.substr(0, 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++) {
if (wd.second.second.count(i)) {
string this_data = wd.second.second[i].as_string();
@@ -809,18 +808,18 @@ struct SatHelper
}
}
if (wd.second.first != 1) {
- fprintf(f, "', data: [");
+ fprintf(f, "\", \"data\": [");
for (int i = 0; i < GetSize(data); i++)
- fprintf(f, "%s'%s'", i ? ", " : "", data[i].c_str());
- fprintf(f, "] },\n");
+ fprintf(f, "%s\"%s\"", i ? ", " : "", data[i].c_str());
+ fprintf(f, "] }");
} else {
- fprintf(f, "' },\n");
+ fprintf(f, "\" }");
}
}
- fprintf(f, " ],\n");
- fprintf(f, " config: {\n");
- fprintf(f, " hscale: %.2f,\n", maxwidth / 4.0);
- fprintf(f, " },\n");
+ fprintf(f, "\n ],\n");
+ fprintf(f, " \"config\": {\n");
+ fprintf(f, " \"hscale\": %.2f\n", maxwidth / 4.0);
+ fprintf(f, " }\n");
fprintf(f, "}\n");
fclose(f);
}