-
Notifications
You must be signed in to change notification settings - Fork 72
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
Refactored tick() in simulator.dart #475
Conversation
- added phase methods, some of which are awaited. - all phase methods update _phase and add an event to their controller - some phases add functionality before or after the phase update - made the actual requirements for injected actions more explicit in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks like a reasonable change and makes the code look cleaner, thank you for taking the time on this!
injected action scheduling. See extended comment in Simulator.tick() for detailed explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good to me, thank you again for the contribution!
I ran it against the rohd-cosim test suite and all passes. I filed a separate issue (#479) tracking adding more testing here.
Just need to fix up the failing CI error(s)
Checks now pass but build dev tools fails, not sure why or what to do about that. |
Yes I think the lint is saying that, but I also read somewhere that while you can do that with an ordinary function you can’t do it with a constructor.I have to admit I didn’t do the experiment, and I just used the ignore statement. On 3 Apr 2024, at 18:06, Max Korbel ***@***.***> wrote:
@mkorbel1 commented on this pull request.
In lib/src/simulator.dart:
// Either way, the end result is that a whole new tick gets scheduled for
// _currentTimestamp and any outstanding injected actions get executed.
+
+ // ignore: unnecessary_lambdas
I think this lint is saying you could have done ListQueue.new instead of () => ListQueue(), which seems fair but not a big deal. Better to avoid the lint rather than waive, since it's probably a better way
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Description & Motivation
Refactored tick() method in simulator.dart.
The high level motivation is to move towards a common scheduler shared by the Rohd and Rohm simulators. This is preparatory refactoring with that in mind.
Concretely, I have added a method for each phase.
- all phase methods update _phase and add an event to their controller to let listeners know the new phase is now in progress
- some phases are synchronous and not awaited
- other phases are asychronous and are awaited
- the asynchronous phases do something important before or after transitioning to the phase in question
The tick method now looks like this:
The justification is as follows:
Testing
All Rohme and Rohd tests pass using this code.
Backwards-compatibility
The user facing API has not changed and tool integrations should be unaffected.
Documentation
Documentation is inline ( including for the new private methods ).