Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clash-testbench Framework #2456

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

clash-testbench Framework #2456

wants to merge 9 commits into from

Conversation

kleinreact
Copy link
Contributor

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 in IO. 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, any IO 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:

  • a Haskell compiled executable which runs the simulation based on the given Clash implementation of the circuitry and
  • a foreign library that can be loaded into external simulators.

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

  • Bundle / Unbundle for test bench signals
  • Multiple Clock simulation support
  • More interfaces for providing simulation input
    • Read from a file
    • Hedgehog
  • More interfaces for processing simulation output
    • Golden Test comparison
    • Write to CSV file
    • Write to VCD file
    • Pretty Watching
  • User defined Clock / Reset / Enable signals
  • Test the framework more
    • Blackboxes
    • Combinational Circuitry
  • CLI for FFI based simulation
  • Benchmarking Capabilities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant