CircuitVerse
CircuitVerse copied to clipboard
🐞 Bug - Circuit State Resets on Switching Between SubCircuits and Waiting after Constant Change
Is there an existing issue for this?
- [X] I have searched the existing issues
Describe the bug
The state of a subcircuit is reset when you switch away to another subcircuit and then switch back. Also, by doing some zoom/pan fiddling, it can also reset.
Steps To Reproduce
Steps to reproduce are in text below, and also in the video below. Example project is linked.
Reproduction 1:
- Create a project with multiple subcircuits (or try posted one)
- Switch between subcircuits and see state lost
Reproduction 2:
- Create a project with multiple subcircuits (or try posted one)
- While on one of the subcircuits, change a constant value
- ~Zoom in and out and pan~ Wait a few seconds
- See state lost on currently viewed subcircuit
https://github.com/CircuitVerse/CircuitVerse/assets/19422826/a5d555a0-0e6b-4fd0-ace8-effa84996db3
https://circuitverse.org/users/191705/projects/dflipfloptest-80dfc9a8-f1d4-4b4a-87ad-4f72ca4c8062
Expected Behavior
Expected behavior is that the state of a subcircuit is not reset between viewing different subcircuits, and also that it is not reset by waiting a few seconds ~zooming in and out and panning~ after changing a constant.
However, it may expected that if one of the dependent subcircuits changed, that the state of the subcircuit using it may be reset.
Screenshots
No response
Device Information [optional]
- OS: Arch Linux
- Browser: Firefox 121.0
- version: CircuitVerse Public Site on 2024-01-10
Additional context
No response
Are you working on this issue?
No
After messing with it some more, the scrolling may be a red herring. I think that even just waiting a few seconds after changing a constant, the state resets.
cc @Arnabdaz @Prerna-0202
If approved I interested to work on
I would like to work on this issue.
hi @nametable @tanmoysrt can you assign this issue to me
Just jumping in here to confirm this behavior, and that it also happens after updating inputs for certain circuits, with a random-seeming delay.
A reliable way that I can reproduce it on both Firefox and Chrome (on Windows) plus probably 5-6 of my students ran into it:
- Load the attached circuit, and select the "Program Counter" sub-circuit.
- Toggle the "Advance" input on the left to 1 and then back to 0, which updates the PC. With "Branch" on it should throw a bunch of ones into the Address output at the top.
- Wait a few seconds, and the address output will reset back to 0. It seems to do this no matter what other inputs to the circuit are doing.
I found similar resetting behavior with a few different sub-circuits here, but some were more stable than others. For example, the Register File and Register sub-circuits sometimes reset during my testing, but don't seem to be doing it now (unless I go to another tab and back, which is also bad but more tolerable). There may be some correlation with how long the browser tab has been running, although I'm not confident on that.
My guess might be that sequential sub-circuits are implicated somehow, but that's not a very educated guess. The circuit I have here builds up from a NOR-based D latch to almost a full CPU, and the Program Counter sub-circuit where the reset is the most reliable contains a Register which contains 16 D flip-flops which each contain 2 D latches, so there's a lot of nesting there...