-
Notifications
You must be signed in to change notification settings - Fork 241
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
Error in timertool example #80
Comments
I just fixed the naming error the unresponsive problem is still here, and maybe it's a more complex problem in the way Rars manage label and internal names. |
Thanks for making a pull request to update the example. I didn't notice i broke it when I introduced the time control and status register in f0d67c2. I am not sure I see the same unresponsiveness as you do, but I have seen some behavior that is not correct and will investigate. @zacharyselk, this breaking is probably my fault, but if you want to investigate your help would be appreciated. |
An error log from my terminal:
|
It seems that these two assertions are wrong, and are the reason this doesn't work. Running rars without assertions enabled or fixing these to test for rars/src/rars/simulator/Simulator.java Lines 292 to 296 in 30a8ed4
Ideally, an assertion failure should not make the UI only partially stop working though. |
This should be fixed. Check out the release, and let me know if this fixes the problem for you. |
Thanks sorry for the delay I got caught by the work but maybe next time for sure I would ask to be mentored for fixing a bug. :) I will try the reproduction steps today I post the result here. |
The handler is set to be called when a timer interrupt is triggered. For me it is called periodically.
timeNow is a memory mapped address that the Timertool tool updates. You cannot actually change it and expect the value to not get overwritten. I suspect you are not using the Timertool tool correctly. RARS does not by default support timer interrupts or MMIO without a tool providing extra logic. This information should probably be added to the example in the form of a comment at the top. |
Hello, thanks! I forgot to enable the timer tool in the tools settings. After setting the timer the program seems to hang strangely: Like if doing all the heavy printing of the time is saturating something. Here a glance at a htop view of rars while stuck in the example: If I remove the printing of the time and replace the loop by
It's OK and no more hanging. Edit: Sorry if my English is imperfect, it's not my mother tongue. :) |
In my testing it doesn't actually hang. Instead it is not super responsive, but you can manage to pause execution if you spam-click the pause button. If you change the execution speed to be below maximum, there isn't any weirdness.
It does seem like the printing results in the weirdness. This is probably because the UI thread is spending time updating the log rather than handling click events well. It might be possible to optimize the Run I/O to minimize issues. Alternatively, adding a
Your English is certainly good enough. Misspelling "do" as "du" in the was a little bit of a clue if someone was trying to guess your native language (which I would guess is French). And your English is definitely better than I would be writing in your mother tongue. :) |
Look like a hack with backfire. At the pedagogical lvl I think printing time in timer ? In my humble opinion, if the main purpose of the example is showing that timer exist in user mode maybe the best is to do like a real world timer and sleep in main loop. The actual printing of time in each loop pass also hide the "hello" message at full speed. On mars we always used full speed at Université Pierre et Marie Curie (Paris now Sorbonne Université) and In Rars my students use always full speed or step by step. I can make a PR with a message on stdout or comment about |
It probably is appropriate to add a sleep into the example. That would certainly solve the problem. However, I would like to make sure that RARS handles poorly behaved programs as well. In this case the example reveals that RARS can't handle lots of small prints to the console. I suspect this is because the GUI tries to update whenever input happens rather than wait for a new frame to repaint. I came up with a simple fix for that which is to keep a small buffer so that system calls don't access the GUI directly, but can all add to a buffer that dumps to the GUI every tenth of a second. This makes the experience much better for this example and shouldn't affect other code much at all. Making it send it every hundredth doesn't quite fix the unresponsiveness for me, but definitely makes it better. I'll give myself a week to see if anything better comes to mind, but after that I plan to add the code below to make sure there aren't performance problems with the GUI console.
If you want to add a comment to the top of the example, I would be willing to merge a PR. Rather than a nop loop, I would accept a call to the sleep (32) system call. |
It looks like you have broken something in printing in the 41fff8f.
Assemble, go:
Reset, go:
Expected result:
|
I understand why this is happening. The print buffering does not allow the buffered output through until the next message is sent. There are a few possible solutions to this for @cypok's example program:
(1) on its own has problems with long running programs that have some initial output. (2) mostly just masks the problems. However the two together should mostly solve this except for pathological cases where a program switches from little output to lots. (3) is probably the most correct, but is somewhat technically challenging. |
@TheThirdOne (triaging my own issues) maybe it's closable? :) |
Last tool that needed modification for dark mode ( issue TheThirdOne#61 ) was the memory reference visualization that is updated here.
Hello, thanks for the work I used it for an processor and assembler introduction course it's great. :)
PR: #79
I got an error while trying to execute
example/timertool.s
So I fixed the example at least the syntax error. The error may be du to the fact that a CSR is called time.
But after that the example seems to make rars unresponsive.
Here a small contribution for at least fixing the name issue
The text was updated successfully, but these errors were encountered: