Improvements in new SigMap
authorClifford Wolf <clifford@clifford.at>
Tue, 27 Oct 2015 23:39:53 +0000 (00:39 +0100)
committerClifford Wolf <clifford@clifford.at>
Tue, 27 Oct 2015 23:39:53 +0000 (00:39 +0100)
kernel/sigtools.h

index 3e19ac8c876da69b89ac91da17436db9ef522f53..3ef87199e309b22653bdc417b8079198ae7c796a 100644 (file)
@@ -253,18 +253,29 @@ struct SigMap
 
                for (int i = 0; i < GetSize(from); i++)
                {
-                       RTLIL::SigBit &bf = from[i];
-                       RTLIL::SigBit &bt = to[i];
+                       RTLIL::SigBit bf = database.find(from[i]);
+                       RTLIL::SigBit bt = database.find(to[i]);
 
-                       if (bf.wire != nullptr)
+                       if (bf.wire || bt.wire)
+                       {
                                database.merge(bf, bt);
+
+                               if (bf.wire == nullptr)
+                                       database.promote(bf);
+
+                               if (bt.wire == nullptr)
+                                       database.promote(bt);
+                       }
                }
        }
 
        void add(RTLIL::SigSpec sig)
        {
-               for (auto &bit : sig)
-                       database.promote(bit);
+               for (auto &bit : sig) {
+                       RTLIL::SigBit b = database.find(bit);
+                       if (b.wire != nullptr)
+                               database.promote(bit);
+               }
        }
 
        void apply(RTLIL::SigBit &bit) const