Skip to content

Commit 77b2844

Browse files
committed
emit $scopeinfo cells by default
1 parent dab7905 commit 77b2844

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

backends/json/json.cc

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ struct JsonWriter
193193
for (auto c : module->cells()) {
194194
if (use_selection && !module->selected(c))
195195
continue;
196-
// Eventually we will want to emit $scopeinfo, but currently this
197-
// will break JSON netlist consumers like nextpnr
198196
if (!scopeinfo_mode && c->type == ID($scopeinfo))
199197
continue;
200198
f << stringf("%s\n", first ? "" : ",");
@@ -357,8 +355,8 @@ struct JsonBackend : public Backend {
357355
log(" -selected\n");
358356
log(" output only select module\n");
359357
log("\n");
360-
log(" -scopeinfo\n");
361-
log(" include $scopeinfo cells in the output\n");
358+
log(" -noscopeinfo\n");
359+
log(" don't include $scopeinfo cells in the output\n");
362360
log("\n");
363361
log("\n");
364362
log("The general syntax of the JSON output created by this command is as follows:\n");
@@ -605,7 +603,7 @@ struct JsonBackend : public Backend {
605603
bool aig_mode = false;
606604
bool compat_int_mode = false;
607605
bool use_selection = false;
608-
bool scopeinfo_mode = false;
606+
bool scopeinfo_mode = true;
609607

610608
size_t argidx;
611609
for (argidx = 1; argidx < args.size(); argidx++)
@@ -622,8 +620,8 @@ struct JsonBackend : public Backend {
622620
use_selection = true;
623621
continue;
624622
}
625-
if (args[argidx] == "-scopeinfo") {
626-
scopeinfo_mode = true;
623+
if (args[argidx] == "-noscopeinfo") {
624+
scopeinfo_mode = false;
627625
continue;
628626
}
629627
break;
@@ -657,8 +655,8 @@ struct JsonPass : public Pass {
657655
log(" emit 32-bit or smaller fully-defined parameter values directly\n");
658656
log(" as JSON numbers (for compatibility with old parsers)\n");
659657
log("\n");
660-
log(" -scopeinfo\n");
661-
log(" include $scopeinfo cells in the output\n");
658+
log(" -noscopeinfo\n");
659+
log(" don't include $scopeinfo cells in the output\n");
662660
log("\n");
663661
log("See 'help write_json' for a description of the JSON format used.\n");
664662
log("\n");
@@ -668,7 +666,7 @@ struct JsonPass : public Pass {
668666
std::string filename;
669667
bool aig_mode = false;
670668
bool compat_int_mode = false;
671-
bool scopeinfo_mode = false;
669+
bool scopeinfo_mode = true;
672670

673671
size_t argidx;
674672
for (argidx = 1; argidx < args.size(); argidx++)
@@ -685,8 +683,8 @@ struct JsonPass : public Pass {
685683
compat_int_mode = true;
686684
continue;
687685
}
688-
if (args[argidx] == "-scopeinfo") {
689-
scopeinfo_mode = true;
686+
if (args[argidx] == "-noscopeinfo") {
687+
scopeinfo_mode = false;
690688
continue;
691689
}
692690
break;

tests/various/json_scopeinfo.ys

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ flatten -scopename
2626
prep
2727

2828
write_json json_scopeinfo.out
29-
!grep -qvF '$scopeinfo' json_scopeinfo.out
30-
31-
write_json -scopeinfo json_scopeinfo.out
3229
!grep -qF '$scopeinfo' json_scopeinfo.out
3330

34-
json -o json_scopeinfo.out
31+
write_json -noscopeinfo json_scopeinfo.out
3532
!grep -qvF '$scopeinfo' json_scopeinfo.out
3633

37-
json -scopeinfo -o json_scopeinfo.out
34+
json -o json_scopeinfo.out
3835
!grep -qF '$scopeinfo' json_scopeinfo.out
36+
37+
json -noscopeinfo -o json_scopeinfo.out
38+
!grep -qvF '$scopeinfo' json_scopeinfo.out

0 commit comments

Comments
 (0)