You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it's quite unclear how best to observe internal signal of a design's HDL (e.g. via logic analyser core or simulation). For instance, consider a simple design:
blink::foralldom.HiddenClockResetEnabledom=>SignaldomBool
blink =let n ::Signaldom (BitVector32)
n = register 0 (n+1)
ineven<$> n
In order to observe the value of n, ideally one would want a function
debug::SSymbolname->Signaldoma->Signaldoma
such that one could write:
let n = debug (SSymbol@"n") $ register 0 (n+1)
ineven<$> n
However, it's not at all clear how to implement debug with the tools currently provided by Clash.
Clash.Annotations.SynthesisAttributes.markDebug would appear to be part of the answer since it ensures that the signal is visible after synthesis; however, the name given to the signal by Clash is almost always unhelpful. To fix this, one might think to use nameHint, e.g.
debug::SSymbolname->Signaldoma->Signaldoma
debug name = nameHint name . markDebug
However, in non-trivial cases one still gets an unexpected name. Perhaps there is a combination of inlining properties to make this more robust? Has anyone else encountered this? It feels like this would be a valuable addition to clash-prelude.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently it's quite unclear how best to observe internal signal of a design's HDL (e.g. via logic analyser core or simulation). For instance, consider a simple design:
In order to observe the value of
n
, ideally one would want a functionsuch that one could write:
However, it's not at all clear how to implement
debug
with the tools currently provided by Clash.Clash.Annotations.SynthesisAttributes.markDebug
would appear to be part of the answer since it ensures that the signal is visible after synthesis; however, the name given to the signal by Clash is almost always unhelpful. To fix this, one might think to usenameHint
, e.g.However, this labels the wrong signal:
If one inverts the
nameHint
andmarkDebug
one finds that sometimes the output is sensible:However, in non-trivial cases one still gets an unexpected name. Perhaps there is a combination of inlining properties to make this more robust? Has anyone else encountered this? It feels like this would be a valuable addition to
clash-prelude
.Beta Was this translation helpful? Give feedback.
All reactions