cxxrtl: don't assert on edge sync rules tied to a constant.
authorwhitequark <whitequark@whitequark.org>
Sun, 7 Mar 2021 14:29:30 +0000 (14:29 +0000)
committerwhitequark <whitequark@whitequark.org>
Sun, 7 Mar 2021 14:29:30 +0000 (14:29 +0000)
These are commonly the result of tying an async reset to an inactive
level.

backends/cxxrtl/cxxrtl_backend.cc

index b6cc4bb6dc739b30e3820f60455c9649c1ceba2a..0071bda7f6552e91f525356e8c575f74646dcd69 100644 (file)
@@ -1518,6 +1518,8 @@ struct CxxrtlWorker {
                        if (!sync->signal.empty()) {
                                sync_bit = sync->signal[0];
                                sync_bit = sigmaps[sync_bit.wire->module](sync_bit);
+                               if (!sync_bit.is_wire())
+                                       continue; // a clock, or more commonly a reset, can be tied to a constant driver
                        }
 
                        pool<std::string> events;
@@ -2285,6 +2287,8 @@ struct CxxrtlWorker {
        void register_edge_signal(SigMap &sigmap, RTLIL::SigSpec signal, RTLIL::SyncType type)
        {
                signal = sigmap(signal);
+               if (signal.is_fully_const())
+                       return; // a clock, or more commonly a reset, can be tied to a constant driver
                log_assert(is_valid_clock(signal));
                log_assert(type == RTLIL::STp || type == RTLIL::STn || type == RTLIL::STe);