Skip to content

Commit

Permalink
vioProbe uses its clock lazily (#2551)
Browse files Browse the repository at this point in the history
Fixes #2532
  • Loading branch information
christiaanb authored Aug 18, 2023
1 parent 3a2d320 commit a02d6a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions clash-cores/clash-cores.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ library
build-depends:
clash-lib,
infinite-list ^>= 0.1,
ghc-prim >= 0.3.1.0 && < 1.0,
mtl >= 2.1.1 && < 2.4,
pretty-show,
prettyprinter >= 1.2.0.1 && < 1.8,
Expand Down
8 changes: 7 additions & 1 deletion clash-cores/src/Clash/Cores/Xilinx/VIO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import Clash.Explicit.Prelude
import Clash.Annotations.Primitive (Primitive (InlineYamlPrimitive))

import Data.String.Interpolate (__i)
import GHC.Magic (lazy)

import Clash.Cores.Xilinx.VIO.Internal.BlackBoxes

Expand Down Expand Up @@ -123,7 +124,12 @@ vioProbe# ::
o ->
Clock dom ->
a
vioProbe# !_inputNames !_outputNames !_initialOutputProbeValues !_clk = vioX @dom @a @o
vioProbe# !_inputNames !_outputNames !_initialOutputProbeValues clk =
lazy clk `seq` -- Ensure clk is considered used, but not marked "used once".
-- This makes makes GHC not inline the clock argument.
--
-- Fixes #2532
vioX @dom @a @o
-- See: https://github.com/clash-lang/clash-compiler/pull/2511
{-# CLASH_OPAQUE vioProbe# #-}
{-# ANN vioProbe# (
Expand Down

0 comments on commit a02d6a3

Please sign in to comment.