From 20ce4118da1a0b14e8307aa0a605101252028757 Mon Sep 17 00:00:00 2001 From: "R. Ou" Date: Sun, 9 Feb 2020 01:01:18 -0800 Subject: [PATCH] json: Change compat mode to directly emit ints <= 32 bits This increases compatibility with certain older parsers in some cases that worked before commit 15fae357 but do not work with the current compat-int mode --- backends/json/json.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backends/json/json.cc b/backends/json/json.cc index 5c67cb857..6c924ff99 100644 --- a/backends/json/json.cc +++ b/backends/json/json.cc @@ -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 @@ -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"); @@ -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");