-
Notifications
You must be signed in to change notification settings - Fork 162
Closed
Labels
Description
In Clash master
and 1.6
, there is a bug when generating HDL under very specific conditions. Only with GHC 9.0.2 (out of the versions we test in CI), with multiple hidden enabled, an annotation from Clash.Annotations.SynthesisAttributes
and the following reproducer:
topEntity ::
Signal System Bit ->
Signal System Bit `Annotate` 'StringAttr "break" "me"
topEntity dIn =
exposeClockResetEnable (register 0) clk rst en dIn
where
clk = clockGen
rst = resetGen
en = enableGen
VHDL generation will produce the error:
<no location info>: error:
Clash error call:
Clash.Netlist.BlackBox.Util(585): IsActiveEnable: Expected Bool or Enable, not: Void Nothing
CallStack (from HasCallStack):
error, called at src/Clash/Netlist/BlackBox/Util.hs:585:13 in clash-lib-1.7.0-inplace:Clash.Netlist.BlackBox.Util
renderElem, called at src/Clash/Netlist/BlackBox/Util.hs:319:15 in clash-lib-1.7.0-inplace:Clash.Netlist.BlackBox.Util
Verilog and SystemVerilog instead say:
<no location info>: error:
Clash error call:
Clash.Netlist.BlackBox(290): Forced to evaluate untranslatable type: (resetGenN
@(IfStuck
TryDomainResult
[...]
(TryDomain (Signal "System" Bit -> Signal "System" Bit) (Signal "System" Bit -> Signal "System" Bit))))))
CallStack (from HasCallStack):
error, called at src/Clash/Netlist/BlackBox.hs:290:21 in clash-lib-1.7.0-inplace:Clash.Netlist.BlackBox
Each of the following is enough to make the code produce HDL again:
- Disable multiple-hidden
- Remove
Annotate
- Add type application/signature to either
clk
,rst
oren
- Add type application to
exposeClockResetEnable
- Eta-reduce
topEntity
(topEntity = exposeClockResetEnable ...
)
Type-applying register
, though, does not help.
I created a branch issue-2593 which tests the reproducer in CI. The full file with the reproducer is T2593.hs
For 1.6, the branch is issue-2593-1.6.