diff options
author | Clifford Wolf <clifford@clifford.at> | 2016-07-13 09:39:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-13 09:39:27 +0200 |
commit | 2afc72cae31720d7eacb0423a0dc87d4eccb1aa1 (patch) | |
tree | 26c11b3e8bb1b2b024c86d37835e1cdd97aaa4df | |
parent | 9e5c9471e366e1abaad62525e783eb549274d951 (diff) | |
parent | 546233f0e154cca0bacb4960faf54ba8d206c1fd (diff) | |
download | yosys-2afc72cae31720d7eacb0423a0dc87d4eccb1aa1.tar.gz yosys-2afc72cae31720d7eacb0423a0dc87d4eccb1aa1.tar.bz2 yosys-2afc72cae31720d7eacb0423a0dc87d4eccb1aa1.zip |
Merge pull request #191 from whitequark/json-module-attributes
write_json: also write module attributes
-rw-r--r-- | backends/json/json.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/backends/json/json.cc b/backends/json/json.cc index 05530ee69..4baffa33e 100644 --- a/backends/json/json.cc +++ b/backends/json/json.cc @@ -83,12 +83,12 @@ struct JsonWriter return str + " ]"; } - void write_parameters(const dict<IdString, Const> ¶meters) + void write_parameters(const dict<IdString, Const> ¶meters, bool for_module=false) { bool first = true; for (auto ¶m : parameters) { f << stringf("%s\n", first ? "" : ","); - f << stringf(" %s: ", get_name(param.first).c_str()); + f << stringf(" %s%s: ", for_module ? "" : " ", get_name(param.first).c_str()); if ((param.second.flags & RTLIL::ConstFlags::CONST_FLAG_STRING) != 0) f << get_string(param.second.decode_string()); else if (GetSize(param.second.bits) > 32) @@ -111,6 +111,10 @@ struct JsonWriter f << stringf(" %s: {\n", get_name(module->name).c_str()); + f << stringf(" \"attributes\": {"); + write_parameters(module->attributes, /*for_module=*/true); + f << stringf("\n },\n"); + f << stringf(" \"ports\": {"); bool first = true; for (auto n : module->ports) { |