Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clash-spec-limit needs to grow exponentially #2832

Open
kleinreact opened this issue Oct 23, 2024 · 0 comments
Open

clash-spec-limit needs to grow exponentially #2832

kleinreact opened this issue Oct 23, 2024 · 0 comments

Comments

@kleinreact
Copy link
Member

It seems like the following recursive structure causes an exponential unfolding of the generated structure, such that clash won't terminate in a reasonable amount of time.

f :: forall n. SNat n -> Unsigned 4
f n@SNat = case compareSNat n (SNat @15) of
  SNatLE -> at @n @(80 - n - 1) SNat (repeat @80 0)
  SNatGT -> f (SNat @(n - 2)) + f (SNat @(n - 7))

topEntity ::
  HiddenClockResetEnable System =>
  Signal System (Unsigned 4)
topEntity = pure $ f d77

Note that the code above also suffers from #2831, when choosing some constant that is smaller than 80.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant