You're reading an pre-release version of this documentation.
For the latest stable release version, please have a look at master.

Thread-full API

In SpinalSim, you can write your testbench by using multiple threads in a similar way to SystemVerilog, and a bit like VHDL/Verilog process/always blocks. This allows you to write concurrent tasks and control the simulation time using a fluent API.

Fork and join simulation threads

// Create a new thread
val myNewThread = fork {
  // New simulation thread body

// Wait until `myNewThread` is execution is done.

Sleep and waitUntil

// Sleep 1000 units of time

// waitUntil the value is bigger than 42 before continuing
waitUntil( > 42)