Skip to content

Conversation

@alanzyt311
Copy link
Contributor

No description provided.

@Nydauron Nydauron self-requested a review April 4, 2023 04:23
Copy link
Contributor

@Nydauron Nydauron left a 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

@Nydauron Nydauron linked an issue Apr 7, 2023 that may be closed by this pull request
Copy link
Contributor

@Nydauron Nydauron left a 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
Comment on lines 262 to 285
// 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);

Copy link
Contributor

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

@Nydauron Nydauron self-requested a review April 24, 2023 20:57
Copy link
Contributor

@Nydauron Nydauron left a 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]);
Copy link
Contributor

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add arguments to JS to C++ reset() bind

3 participants