Skip to content

Commit 86fdaba

Browse files
committed
docs/simulator: improve explanation for resetting the simulation.
1 parent 6a2e789 commit 86fdaba

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

amaranth/sim/core.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,8 @@ class Simulator:
5757
5858
.. note::
5959
60-
Resetting the simulator can also be used to amortize the startup cost while validating
61-
a large design with many short test. In this case, instead of adding new testbenches,
62-
the behavior of the already added testbenches would be modified for each of the tests.
63-
64-
It can also be used to capture waveforms only for simulations that encounter an error.
60+
Resetting the simulator can also be used to amortize the startup cost of repeatedly
61+
simulating a large design.
6562
6663
Arguments
6764
---------

docs/simulator.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ The captured data is saved to a :abbr:`VCD` file :file:`example1.vcd`, which can
8888
]
8989
}
9090

91+
The :meth:`Simulator.reset` method reverts the simulation to its initial state. It can be used to speed up tests by capturing the waveforms only when the simulation is known to encounter an error:
92+
93+
.. testcode::
94+
95+
try:
96+
sim.run()
97+
except:
98+
sim.reset()
99+
with sim.write_vcd("example1_error.vcd"):
100+
sim.run()
101+
91102

92103
Testing synchronous circuits
93104
++++++++++++++++++++++++++++

0 commit comments

Comments
 (0)