-
Notifications
You must be signed in to change notification settings - Fork 162
Open
Description
The following reproducer
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# OPTIONS_GHC -fconstraint-solver-iterations=20 #-}
module Top where
import Clash.Prelude
import Data.Proxy
import Data.Type.Bool
data T = A
type family TF (t :: T) :: Nat where
TF A = 32
data TFacts (t :: T) where
TFacts :: KnownNat (TF t) => Proxy t -> TFacts t
class KnownT t where knownT :: TFacts t
instance KnownT A where knownT = TFacts Proxy
type RSF t n = If (n <=? TF t) (Div (TF t) n) 1
go ::
forall t n.
( KnownT t, KnownNat n, 1 <= n
, 1 <= If (n <=? (TF t)) (Div (TF t) n) 1
) => BitVector n -> Vec (RSF t n) (BitVector n)
go inp | TFacts{} <- knownT @t = bitCoerce
$ let ext :: BitVector n -> BitVector (n * RSF t n)
ext = extend @_ @_ @(n * RSF t n - n)
in unpack (ext inp) :: Unsigned (n * RSF t n)
topEntity ::
HiddenClockResetEnable System =>
Signal System (Vec (RSF A 8) (BitVector 8))
topEntity = go @A @8 <$> pure 0
produces a
Clash: Compiling Top.topEntity
<no location info>: error:
Clash error call:
zipEqual: left list is longer
CallStack (from HasCallStack):
error, called at src/Data/List/Extra.hs:140:19 in clash-lib-1.9.0-inplace:Data.List.Extra
zipEqual, called at src/Clash/Normalize/Transformations/Case.hs:206:19 in clash-lib-1.9.0-inplace:Clash.Normalize.Transformations.Case
caseCon', called at src/Clash/Normalize/Transformations/Case.hs:154:32 in clash-lib-1.9.0-inplace:Clash.Normalize.Transformations.Case
caseCon, called at src/Clash/Normalize/Transformations/Case.hs:273:23 in clash-lib-1.9.0-inplace:Clash.Normalize.Transformations.Case
caseCon', called at src/Clash/Normalize/Transformations/Case.hs:154:32 in clash-lib-1.9.0-inplace:Clash.Normalize.Transformations.Case
caseCon, called at src/Clash/Normalize/Strategy.hs:91:36 in clash-lib-1.9.0-inplace:Clash.Normalize.Strategy
but only if the debug
flag has been enabled for clash-lib
. Otherwise, it compiles just fine.
I don't think that this one is related to #2376, although producing the same error message, as the example makes no use of unsafeCoerce
at all.
Metadata
Metadata
Assignees
Labels
No labels