Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR introduces a new
clash-testbench
framework, which offers extended test bench design capabilities on top of Clash.Test benches created with this framework can either be run naively in Haskell / Clash or with an external simulator via Clash-FFI. To this end, the framework automatically lifts the given Clash circuitry into a wrapping
IO
-monad during test bench design. The test bench is then simulated fully inIO
. This not only provides precise control over the simulation evaluation, but also avoids lazy evaluation effects (unsafePerformIO
is not required due to the lift). Furthermore, anyIO
interface can be plugged to the simulated circuitry providing inputs or processing outputs during simulation.Simulation with external simulators is supported via Clash-FFI. In this case only the type interface of the circuity is used to automatically bind to the interface of corresponding externally provided modules. This allows for easy interaction with blackbox designs that are not available in Clash.
Some first example can be found in the
example
folder. It currently produces two artifacts:The test bench design is shared among both interfaces. The foreign library variant technically can be used to also simulate the Clash-based implementation. This is, however, not supported yet.
The framework is still in a prototype stage and WIP (see the following list for some of the open TODOs).
TODOs