clash-lang/clash-compiler

Unmatchable constant as case subject

Opened this issue · 0 comments

As we are separating clash-cores from clash-compiler, I tried to support not just Clash master but also Clash 1.8. But there are several cores in clash-cores that fail their test suite on Clash 1.8.1 on several GHC versions.

These cores work fine on Clash master, and with Clash 1.8.1 they also pass the test suite on some GHC's, but on other GHC's, they give the error below. The error below was created with GHC 9.6.6.

These combinations work fine: Clash 1.8.1 and GHC 8.10.7, 9.0.2, 9.2.8.

These combinations error out: Clash 1.8.1 and GHC 9.4.8, 9.6.6, 9.8.2

The tests for XpmCdcArraySingle, XpmCdcPulse, XpmCdcSingle and XpmCdcSyncRst all fail with an error like the following:

        XpmCdcSingle
          VHDL
            clash (gen): FAIL (11.11s)
              Program /home/peter/.cabal/store/ghc-9.6.6/clash-ghc-1.8.1-e-clash-68ff2c36ae3563cc68aeabf6f0365435a854e632e34a6de5521bc73c1c132393/bin/clash
               failed with error-code 1.
              
              Full invocation:
              
                /home/peter/.cabal/store/ghc-9.6.6/clash-ghc-1.8.1-e-clash-68ff2c36ae3563cc68aeabf6f0365435a854e632e34a6de5521bc73c1c132393/bin/clash
                 --vhdl -i/home/peter/src/clash/clash-cores/./test-suite/shouldwork/Xilinx XpmCdcSingle -fclash-hdldir /tmp/clash-test_XpmCdcSingle-1c536e9532a5982f/hdl -odir /tmp/clash-test_XpmCdcSingle-1c536e9532a5982f -hidir /tmp/clash-test_XpmCdcSingle-1c536e9532a5982f -fclash-debug DebugSilent -DCLASH_OPAQUE=OPAQUE
                
              
              Stderr was:
              
                Unmatchable constant as case subject: >=#
                  (word2Int#
                     (popCnt64#
                        (xor64#
                           (or64#
                              (xor64#
                                 (timesWord64#
                                    (xor64#
[...]

This error message goes on for more than 26,000 lines for VHDL and more than 24,000 lines for Verilog.

An easy to work with repository can be found at clash-cores repro-1.8-issues. You can just do cabal run clash-cores-test-suite -- -p XpmCdcSingle.VHDL (although investigating the bug obviously needs more).