From 5beab5bc17f9fa1f2340b491e073cfb973ad2e2b Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 2 Dec 2020 08:25:27 +0000 Subject: 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). --- backends/cxxrtl/cxxrtl_capi.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backends/cxxrtl/cxxrtl_capi.cc') diff --git a/backends/cxxrtl/cxxrtl_capi.cc b/backends/cxxrtl/cxxrtl_capi.cc index b77e4c491..1c3c63e3e 100644 --- a/backends/cxxrtl/cxxrtl_capi.cc +++ b/backends/cxxrtl/cxxrtl_capi.cc @@ -43,6 +43,10 @@ void cxxrtl_destroy(cxxrtl_handle handle) { delete handle; } +void cxxrtl_reset(cxxrtl_handle handle) { + handle->module->reset(); +} + int cxxrtl_eval(cxxrtl_handle handle) { return handle->module->eval(); } -- cgit v1.2.3