@@ -30,6 +30,7 @@ module Protocols.Hedgehog (
3030
3131-- base
3232import Control.Concurrent (threadDelay )
33+ import Control.Monad (when )
3334import Control.Monad.IO.Class (liftIO )
3435import Data.Proxy (Proxy (Proxy ))
3536import GHC.Stack (HasCallStack )
@@ -119,9 +120,11 @@ propWithModel ::
119120propWithModel eOpts genData model prot prop =
120121 H. property $ maybe id withTimeoutMs (eoTimeoutMs eOpts) $ do
121122 dat <- H. forAll genData
123+ when (eoTrace eOpts) $ liftIO $ putStr " propWithModel: dat: " >> print dat
122124
123125 -- TODO: Different 'n's for each output
124126 n <- H. forAll (Gen. integral (Range. linear 0 (eoSampleMax eOpts)))
127+ when (eoTrace eOpts) $ liftIO $ putStr " propWithModel: n: " >> print n
125128
126129 -- TODO: Different distributions?
127130 let genStall = genSmallInt
@@ -130,13 +133,21 @@ propWithModel eOpts genData model prot prop =
130133 -- whether to stall or not. The second determines how many cycles to stall
131134 -- on each _valid_ cycle.
132135 lhsStallModes <- H. forAll (genVec genStallMode)
136+ when (eoTrace eOpts) $
137+ liftIO $
138+ putStr " propWithModel: lhsStallModes: " >> print lhsStallModes
133139 lhsStalls <- H. forAll (traverse (genStalls genStall n) lhsStallModes)
140+ when (eoTrace eOpts) $ liftIO $ putStr " propWithModel: lhsStalls: " >> print lhsStalls
134141
135142 -- Generate stalls for RHS part of the protocol. The first line determines
136143 -- whether to stall or not. The second determines how many cycles to stall
137144 -- on each _valid_ cycle.
138145 rhsStallModes <- H. forAll (genVec genStallMode)
146+ when (eoTrace eOpts) $
147+ liftIO $
148+ putStr " propWithModel: rhsStallModes: " >> print rhsStallModes
139149 rhsStalls <- H. forAll (traverse (genStalls genStall n) rhsStallModes)
150+ when (eoTrace eOpts) $ liftIO $ putStr " propWithModel: rhsStalls: " >> print rhsStalls
140151
141152 let
142153 simConfig = def{resetCycles = eoResetCycles eOpts}
@@ -157,9 +168,14 @@ propWithModel eOpts genData model prot prop =
157168 -- expectN errors if circuit does not produce enough data
158169 trimmed <- expectN (Proxy @ b ) eOpts sampled
159170
171+ when (eoTrace eOpts) $ liftIO $ putStrLn " propWithModel: before forcing trimmed.."
160172 _ <- H. evalNF trimmed
173+ when (eoTrace eOpts) $ liftIO $ putStrLn " propWithModel: before forcing expected.."
161174 _ <- H. evalNF expected
162175
176+ when (eoTrace eOpts) $
177+ liftIO $
178+ putStrLn " propWithModel: executing property.."
163179 prop expected trimmed
164180
165181{- | Test a protocol against a pure model implementation. Circuit under test will
0 commit comments