dfflegalize: Fix decision tree for adffe.
authorMarcelina Kościelnicka <mwk@0x04.net>
Thu, 27 Aug 2020 09:58:56 +0000 (11:58 +0200)
committerMarcelina Kościelnicka <mwk@0x04.net>
Thu, 27 Aug 2020 11:17:42 +0000 (13:17 +0200)
When an adffe is being legalized, and is not natively supported,
prioritize unmapping to adff over converting to dffsre if dffsre is not
natively supported itself.

Fixes #2361.

passes/techmap/dfflegalize.cc

index 8ad65493f0fe37ef299d9e6f41652d47b2ab7e57..c1e7e557d927a8f61a5fd586e90bcebc7fd4b98b 100644 (file)
@@ -418,7 +418,8 @@ unmap_enable:
                                        ff_type = has_set ? FF_ADFFE1 : FF_ADFFE0;
                                        break;
                                }
-                               if (supported_dffsr & initmask) {
+                               if (supported_cells[has_en ? FF_DFFSRE : FF_DFFSR] & initmask) {
+adff_to_dffsr:
                                        // Throw in a set/reset, retry in DFFSR/DFFSRE branch.
                                        if (has_set) {
                                                sig_s = sig_r;
@@ -441,6 +442,9 @@ unmap_enable:
                                        ff_type = has_set ? FF_ADFF1 : FF_ADFF0;
                                        goto unmap_enable;
                                }
+                               if (supported_dffsr & initmask) {
+                                       goto adff_to_dffsr;
+                               }
                                log_assert(!((has_set ? supported_adff1 : supported_adff0) & initmask));
                                // Alright, so this particular combination of initval and
                                // resetval is not natively supported.  First, try flipping