Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to dispose of unnecessary Simulator subscriptions #516

Open
mkorbel1 opened this issue Oct 2, 2024 · 1 comment
Open

A way to dispose of unnecessary Simulator subscriptions #516

mkorbel1 opened this issue Oct 2, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@mkorbel1
Copy link
Contributor

mkorbel1 commented Oct 2, 2024

Motivation

When running many tests, it may be necessary to build many versions of the same or different Modules, each with a variety of their own Logics. The _Wires within Logics have automation to re-subscribe to Simulator events after a Simulator.reset so that they still functionally work (e.g. for reusing same hardware between tests/simulator resets). However, if you are "throwing away" the old reference to some DUT, and you don't want to simulate with it anymore, you don't care that the Logics within are properly simulating and triggering events like changed. In this case, each time you throw away hardware, you're paying a penalty for future simulations on Simulator events.

One of the most problematic issues is that Simulator.resetRequested is re-subscribed every time. Then, if you have a tearDown where Simulator.reset() is called, the call will get progressively slower as it has to restart more and more subscriptions each test.

This only really impacts test files with many Simulator.reset calls (many tests, many DUTs, etc.).

Desired solution

Some mechanism to signal that Simulator subscriptions should be disposed of, rather than just restarted. A way to clean up all the old hardware between tests.

Alternatives considered

  • A new event that the Simulator can send out indicating things should be disposed of permanently
  • A way to "trick" things that attempt into resubscribing into actually re-subscribing to the same old event before it is removed (i.e. lying to subscribers about the new subscription being ready to use)
  • Something else?

Additional details

No response

@mkorbel1 mkorbel1 added the enhancement New feature or request label Oct 2, 2024
@mkorbel1
Copy link
Contributor Author

mkorbel1 commented Oct 3, 2024

Maybe, if possible, it would be nice to generate these Simulator subscriptions the first time a signal glitches (after reset)? Then there's no special "dispose" required and hardware that loses references would just go away like one would expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant