Skip to content
New issue

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

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

Already on GitHub? # to your account

Circuit plugin is not picked up by Clash from the OPTIONS pragma #2771

Open
gergoerdi opened this issue Jul 25, 2024 · 1 comment
Open

Circuit plugin is not picked up by Clash from the OPTIONS pragma #2771

gergoerdi opened this issue Jul 25, 2024 · 1 comment
Labels

Comments

@gergoerdi
Copy link
Contributor

gergoerdi commented Jul 25, 2024

See https://github.com/gergoerdi/clash-protocols-issue-93

I have this in src/Main.hs:

{-# OPTIONS -fplugin=Protocols.Plugin #-}

This is picked up by GHC when building simulations via Stack.

But when I run Clash via Clash.Main.defaultMain (see Build.hs in the repo), the plugin is not loaded.

Note that adding "-fplugin=Protocols.Plugin" to the Clash.Main.defaultMain invocation does work.

@leonschoorl leonschoorl transferred this issue from clash-lang/clash-protocols Jul 25, 2024
@leonschoorl
Copy link
Member

leonschoorl commented Jul 25, 2024

This a bug in clash.
It seems to ignore specifically the -fplugin flag in OPTIONS/OPTIONS_GHC pragmas.

Example:

{-# OPTIONS -fplugin=MissingPlugin -ddump-ds #-}
module Test2771 where
import Clash.Prelude
topEntity = False

This compiles fine in clash, and you see the effect of the -ddump-ds.
But it should be failing with an error Could not find module ‘MissingPlugin’.

We do some manipulation of the plugin flags, because we make sure the trio ghc-typelits-extra,ghc-typelits-known,ghc-typelits-natnormalise get loaded automatically.
There is likely a bug there, where we override the previous settings, instead of amending them.

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

No branches or pull requests

3 participants