pass metadata: some more rough work on dumping the parameters and attributes
authorAki Van Ness <aki@yosyshq.com>
Thu, 18 Nov 2021 12:35:14 +0000 (07:35 -0500)
committerJacob Lifshay <programmerjake@gmail.com>
Thu, 26 May 2022 02:36:44 +0000 (19:36 -0700)
(cherry picked from commit ca03fbdc6d156a58a77e3b075d5a9a65964a683d)

backends/metadata/metadata.cc

index 292329d6277500a16e5d42cc7c54659d916bda0d..7b2faa181ef4f9d4f0e1712bff2c6dc08b82c4da 100644 (file)
@@ -185,9 +185,9 @@ struct MetadataWriter
         for (auto& attr : cell->attributes) {
             if (!first_attr)
                 f << stringf(",\n");
-            const auto attr_val = attr.second.decode_string();
-            if (attr_val.size() > 0)
-                f << stringf("                %s: \"%s\"\n", get_string(RTLIL::unescape_id(attr.first)).c_str(), attr_val.c_str());
+            const auto attr_val = attr.second;
+            if (!attr_val.empty())
+                f << stringf("                %s: \"%s\"\n", get_string(RTLIL::unescape_id(attr.first)).c_str(), attr_val.decode_string().c_str());
             else
                 f << stringf("                %s: true\n", get_string(RTLIL::unescape_id(attr.first)).c_str());
 
@@ -201,9 +201,9 @@ struct MetadataWriter
         for (auto& param : cell->parameters) {
             if (!first_param)
                 f << stringf(",\n");
-            const auto param_val = param.second.decode_string();
-            if (param_val.size() > 0)
-                f << stringf("                %s: \"%s\"\n", get_string(RTLIL::unescape_id(param.first)).c_str(), param_val.c_str());
+            const auto param_val = param.second;
+            if (!param_val.empty())
+                f << stringf("                %s: \"%s\"\n", get_string(RTLIL::unescape_id(param.first)).c_str(), param_val.decode_string().c_str());
             else
                 f << stringf("                %s: true\n", get_string(RTLIL::unescape_id(param.first)).c_str());