diff options
author | whitequark <whitequark@whitequark.org> | 2020-12-02 08:25:27 +0000 |
---|---|---|
committer | whitequark <whitequark@whitequark.org> | 2020-12-02 08:25:27 +0000 |
commit | 5beab5bc17f9fa1f2340b491e073cfb973ad2e2b (patch) | |
tree | 3f1417445d1012a9afeb7b81e6440ea6dc280d8a /backends/cxxrtl/cxxrtl_capi.h | |
parent | 7b0cfd5c36af774ae255459d4ef0fa0934929902 (diff) | |
download | yosys-5beab5bc17f9fa1f2340b491e073cfb973ad2e2b.tar.gz yosys-5beab5bc17f9fa1f2340b491e073cfb973ad2e2b.tar.bz2 yosys-5beab5bc17f9fa1f2340b491e073cfb973ad2e2b.zip |
cxxrtl: provide a way to perform unobtrusive power-on reset.
Although it is always possible to destroy and recreate the design to
simulate a power-on reset, this has two drawbacks:
* Black boxes are also destroyed and recreated, which causes them
to reacquire their resources, which might be costly and/or erase
important state.
* Pointers into the design are invalidated and have to be acquired
again, which is costly and might be very inconvenient if they are
captured elsewhere (especially through the C API).
Diffstat (limited to 'backends/cxxrtl/cxxrtl_capi.h')
-rw-r--r-- | backends/cxxrtl/cxxrtl_capi.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/backends/cxxrtl/cxxrtl_capi.h b/backends/cxxrtl/cxxrtl_capi.h index 385d6dcf3..662bf2c20 100644 --- a/backends/cxxrtl/cxxrtl_capi.h +++ b/backends/cxxrtl/cxxrtl_capi.h @@ -55,6 +55,14 @@ cxxrtl_handle cxxrtl_create(cxxrtl_toplevel design); // Release all resources used by a design and its handle. void cxxrtl_destroy(cxxrtl_handle handle); +// Reinitialize the design, replacing the internal state with the reset values while preserving +// black boxes. +// +// This operation is essentially equivalent to a power-on reset. Values, wires, and memories are +// returned to their reset state while preserving the state of black boxes and keeping all of +// the interior pointers obtained with e.g. `cxxrtl_get` valid. +void cxxrtl_reset(cxxrtl_handle handle); + // Evaluate the design, propagating changes on inputs to the `next` value of internal state and // output wires. // |