-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add arguments to reset() #9
base: master
Are you sure you want to change the base?
Conversation
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.
Nice work! Works rather well
Bugs I encountered:
- Viewing a context that is not actively loaded followed by clicking play causes the simulator to run indefinitely. (cannot switch contexts, cannot reset, cannot pause. All options keep CPU% at 100)
- Disabling a context, loading a new file then playing does not work as intended (i.e. does not run the other enabled context)
- Note: Loading a new file and then disabling that particular context followed by playing does work
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.
- Labels in the dropdown menu change to
"Program1"
and"Program2"
(expected to be"Program 1"
and"Program 2"
) - If you uncheck context 2, then play, the program freezes. (if you change the speed prior to playing, it is fine)
Something else I've noticed that's beside this new feature:
- When reset is clicked, stdout and stderr terminals get cleared, but the underlying buffer is not cleared. (switching contexts will show the previous state of stdout and stderr)
spim/spim.cpp
Outdated
// void reset_sim() { // unsigned int max_contexts, val active_contexts) { | ||
// /* std::vector<unsigned int> arr = emscripten::vecFromJSArray<unsigned int>(active_contexts); */ | ||
// /* std::set<unsigned int> s(arr.begin(), arr.end()); */ | ||
// /* std::set<unsigned int> s({0, 1}); */ | ||
|
||
// /* reset(2, s); */ | ||
// start_simulator(2, std::set<unsigned int>{0, 1}); | ||
// } | ||
|
||
|
||
void reset_sim(unsigned int max_contexts, const emscripten::val& arr) { // unsigned int max_contexts, val active_contexts) { | ||
/* std::vector<unsigned int> arr = emscripten::vecFromJSArray<unsigned int>(active_contexts); */ | ||
/* std::set<unsigned int> s(arr.begin(), arr.end()); */ | ||
/* std::set<unsigned int> s({0, 1}); */ | ||
std::set<unsigned int> ctx_set; | ||
|
||
for (size_t i = 0; i < arr["length"].as<size_t>(); i++) { | ||
ctx_set.insert(arr[i].as<unsigned int>()); | ||
} | ||
|
||
/* reset(2, s); */ | ||
start_simulator(2, std::set<unsigned int>{0, 1}); | ||
// start_simulator(max_contexts, std::set<unsigned int>{0, 1}); | ||
start_simulator(max_contexts, ctx_set); | ||
|
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.
Clean up any unused 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.
Some more bugs:
- The page freezes and CPU % goes to 100% when you either:
- Switch contexts immediately after the page loads
- Turning off all contexts then hitting reset
// Module.reset(); // 2, [0, 1]); | ||
// Module.reset(2, [0, 1]); | ||
// Module.reset(2, [0]); | ||
// Module.reset(2, [1]); |
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.
Remove commented code (not limited to this one instance)
No description provided.