Cleanup
authorEddie Hung <eddie@fpgeh.com>
Tue, 17 Dec 2019 08:25:08 +0000 (00:25 -0800)
committerEddie Hung <eddie@fpgeh.com>
Tue, 17 Dec 2019 08:25:08 +0000 (00:25 -0800)
passes/memory/memory_bram.cc

index e0970d19214f19234eea3f16782162b554149686..24478f2eecb556ad37fbf3cce4e6823c88e07717 100644 (file)
@@ -330,7 +330,7 @@ struct rules_t
 
                        if (GetSize(tokens) >= 2 && tokens[0] == "attribute") {
                                data.attributes.emplace_back();
-                               for (int idx = 1; idx <= GetSize(tokens)-1; idx++) {
+                               for (int idx = 1; idx < GetSize(tokens); idx++) {
                                        size_t c1 = tokens[idx][0] == '!' ? 1 : 0;
                                        size_t c2 = tokens[idx].find("=");
                                        bool exists = (c1 == 0);
@@ -854,12 +854,10 @@ grow_read_ports:;
                                if (!exists)
                                        ss << "!";
                                IdString key = std::get<1>(sums.front());
-                               ss << key.str();
+                               ss << log_id(key);
                                const Const &value = std::get<2>(sums.front());
-                               if (exists)
-                                       ss << "=";
-                               if (value != Const(1))
-                                       ss << "\"" << value.decode_string() << "\"";
+                               if (exists && value != Const(1))
+                                       ss << "=\"" << value.decode_string() << "\"";
 
                                log("    Rule for bram type %s rejected: requirement 'attribute %s ...' not met.\n",
                                                log_id(match.name), ss.str().c_str());
@@ -1180,12 +1178,10 @@ void handle_cell(Cell *cell, const rules_t &rules)
                                        if (!exists)
                                                ss << "!";
                                        IdString key = std::get<1>(sums.front());
-                                       ss << key.str();
+                                       ss << log_id(key);
                                        const Const &value = std::get<2>(sums.front());
-                                       if (exists)
-                                               ss << "=";
-                                       if (value != Const(1))
-                                               ss << "\"" << value.decode_string() << "\"";
+                                       if (exists && value != Const(1))
+                                               ss << "=\"" << value.decode_string() << "\"";
 
                                        log("    Rule for bram type %s (variant %d) rejected: requirement 'attribute %s ...' not met.\n",
                                                        log_id(bram.name), bram.variant, ss.str().c_str());