clash-lang / clash-compiler

Haskell to VHDL/Verilog/SystemVerilog compiler
https://clash-lang.org/
Other
1.4k stars 147 forks source link

Pragma changes don't invalidate clash cache #2709

Open leonschoorl opened 2 months ago

leonschoorl commented 2 months ago
module Test where
import Clash.Prelude

topEntity = foo

foo :: Bool -> Bool
foo _ = True

Compiling this produces two .vhdl files:

$ cabal run -- clash --vhdl Test.hs; ls vhdl/Test.topEntity/
[...]
Clash: Compiling Test.topEntity
[...]
clash-manifest.json  Test_topEntity_types.vhdl  topEntity.vhdl

Now I add the line {-# NOINLINE foo #-}, and I'd expect clash to generate a separate file for foo, but:

$ cabal run -- clash --vhdl Test.hs; ls vhdl/Test.topEntity/
[...]
Clash: Compiling Test.topEntity
Clash: Using cached result for: Test.topEntity
[...]
clash-manifest.json  Test_topEntity_types.vhdl  topEntity.vhdl

Only when I ask clash the ignore the cache, or otherwise invalidate it, do I get the expected result:

$ cabal run -- clash --vhdl Test.hs -fclash-no-cache; ls vhdl/Test.topEntity/
[...]
Clash: Ignoring previously made caches
Clash: Compiling Test.topEntity
[...]
clash-manifest.json  foo.vhdl  Test_topEntity_types.vhdl  topEntity.vhdl