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 allow to write concurant tasks of your testbench and to move/wait in the simulation time with a fluant API.
Fork and join simulation threads
//Create a new thread
val myNewThread = fork{
//New simulation thread body
}
//Wait until `myNewThread` is execution is done.
myNewThread.join()
Sleep and waitUntil
//Sleep 1000 units of time
sleep(1000)
//waitUntil the dut.io.a value is bigger than 42 before continuing
waitUntil(dut.io.a > 42)