This PR refactors the tests for Amaranth's RFC 36. It is pretty massive, so thorough reviews are not expected. Let's merge this as quickly as possible and then deal with the possible aftermath later.
Important changes:
In case when synchronization between different processes is actually needed, uses of Settle were replaced with sim.delay().
Other instances of Settle were removed.
Signal sampling (sim.tick().sample()) is used instead of signal value getting where it was reasonably simple to do so. In other cases, sim.get() is used (but we should try to avoid it).
Method mocks work differently:
They consist of multiple processes: a sequential process, which works like before, plus combinational processes for updating the circuit after combinational changes. This helps avoid races in case of combinational dependencies between mocked methods.
Because the method mock can now be called multiple times per cycle, side effects must be guarded by MethodMock.effect. The effects are run once per cycle.
For testbench processes which manipulate multiple methods in synchrony, CallTrigger was added, which allows to call multiple methods in a single clock cycle, together with sampling signals and the state of other methods.
Number of ticks from simulation start can now be accessed by using a counter signal under TicksKey().
This PR refactors the tests for Amaranth's RFC 36. It is pretty massive, so thorough reviews are not expected. Let's merge this as quickly as possible and then deal with the possible aftermath later.
Important changes:
In case when synchronization between different processes is actually needed, uses of
Settle
were replaced withsim.delay()
.Other instances of
Settle
were removed.Signal sampling (
sim.tick().sample()
) is used instead of signal value getting where it was reasonably simple to do so. In other cases,sim.get()
is used (but we should try to avoid it).Method mocks work differently:
MethodMock.effect
. The effects are run once per cycle.For testbench processes which manipulate multiple methods in synchrony,
CallTrigger
was added, which allows to call multiple methods in a single clock cycle, together with sampling signals and the state of other methods.Number of ticks from simulation start can now be accessed by using a counter signal under
TicksKey()
.[x] Update testing abstractions
[x] Refactor tests
[x] Fix documentation
[x] Cleanup