Fixed driver conflict handling (various cmds)
authorClifford Wolf <clifford@clifford.at>
Sat, 24 Oct 2015 17:23:30 +0000 (19:23 +0200)
committerClifford Wolf <clifford@clifford.at>
Sat, 24 Oct 2015 17:23:30 +0000 (19:23 +0200)
kernel/rtlil.cc

index 8332219ae31fd1aae96ed69a0650e1eb6ac6a3ce..6f150c1e2ebbc75834a4874c4c920a312604625a 100644 (file)
@@ -1448,9 +1448,18 @@ void RTLIL::Module::connect(const RTLIL::SigSig &conn)
                for (auto mon : design->monitors)
                        mon->notify_connect(this, conn);
 
-#ifndef NDEBUG
-       log_assert(!conn.first.has_const());
-#endif
+       // ignore all attempts to assign constants to other constants
+       if (conn.first.has_const()) {
+               RTLIL::SigSig new_conn;
+               for (int i = 0; i < GetSize(conn.first); i++)
+                       if (conn.first[i].wire) {
+                               new_conn.first.append(conn.first[i]);
+                               new_conn.second.append(conn.second[i]);
+                       }
+               if (GetSize(new_conn.first))
+                       connect(new_conn);
+               return;
+       }
 
        if (yosys_xtrace) {
                log("#X# Connect (SigSig) in %s: %s = %s (%d bits)\n", log_id(this), log_signal(conn.first), log_signal(conn.second), GetSize(conn.first));