Skip to content

Commit

Permalink
json: Change compat mode to directly emit ints <= 32 bits
Browse files Browse the repository at this point in the history
This increases compatibility with certain older parsers in some cases
that worked before commit 15fae35 but do not work with the current
compat-int mode
  • Loading branch information
ArcaneNibble committed Feb 9, 2020
1 parent 2e8d6ec commit 20ce411
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backends/json/json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct JsonWriter
if (state < 2)
str += " ";
f << get_string(str);
} else if (compat_int_mode && GetSize(value) == 32 && value.is_fully_def()) {
} else if (compat_int_mode && GetSize(value) <= 32 && value.is_fully_def()) {
if ((value.flags & RTLIL::ConstFlags::CONST_FLAG_SIGNED) != 0)
f << stringf("%d", value.as_int());
else
Expand Down Expand Up @@ -296,7 +296,7 @@ struct JsonBackend : public Backend {
log(" include AIG models for the different gate types\n");
log("\n");
log(" -compat-int\n");
log(" emit 32-bit fully-defined parameter values directly\n");
log(" emit 32-bit or smaller fully-defined parameter values directly\n");
log(" as JSON numbers (for compatibility with old parsers)\n");
log("\n");
log("\n");
Expand Down Expand Up @@ -540,7 +540,7 @@ struct JsonPass : public Pass {
log(" also include AIG models for the different gate types\n");
log("\n");
log(" -compat-int\n");
log(" emit 32-bit fully-defined parameter values directly\n");
log(" emit 32-bit or smaller fully-defined parameter values directly\n");
log(" as JSON numbers (for compatibility with old parsers)\n");
log("\n");
log("See 'help write_json' for a description of the JSON format used.\n");
Expand Down

0 comments on commit 20ce411

Please sign in to comment.