kansas-lava-0.2.4.3: Kansas Lava is a hardware simulator and VHDL generator.

Safe HaskellNone
LanguageHaskell2010

Language.KansasLava.Probes

Contents

Description

Probes log the shallow-embedding signals of a Lava circuit in the | deep embedding, so that the results can be observed post-mortem.

Synopsis

Probes

probeS :: Rep a => String -> Signal c a -> Signal c a Source

probeS adds a named probe to the front of a signal.

unpackedProbe :: forall c a p. (Rep a, Pack c a, p ~ Unpacked c a) => String -> p -> p Source

unpackedProbe is an unpacked version of probeS.

Setting up the debugging mode for probes

setProbesAsTrace :: (String -> IO ()) -> IO () Source

A simplified API, where each internal probe event is represented as a newline-terminated String, and can be printed, or appended to a file.

To append to a debugging file, use

ghci> setProbesAsTrace $ appendFile "DEBUG.out"

To write to the screen, use

ghci> setProbesAsTrace $ putStr

You will need to re-execute your program after calling any probe function, so typically this done on the command line, or by puting setProbeAsTrace inside main.

setShallowProbes :: (forall a. Rep a => String -> Integer -> X a -> X a) -> IO () Source

The callback is called for every element of every probed value, in evaluation order. The arguments are fully evaluted (so printing them will not cause any side-effects of evaluation.

setProbes :: (forall a i. Rep a => String -> Signal i a -> Signal i a) -> IO () Source

Used internally for initializing debugging hooks, replaces all future calls to probe with the given function.