Re:Show HN: CircuitVerse – Online Digital Circuit Simulator
by compumike on Thursday June 07, 2018 @12:38AM
(#17253339)
It's possible to combine event-driven simulation (for digital) and nonlinear differential equation based simulation (for analog) within the same simulator. The simulation engine can be smart enough to mix the two efficiently. As a toy model, consider this 4-bit counter plus DAC (click "Simulate" at the bottom):
https://www.circuitlab.com/editor/53xa3r/
The simulation loop is both event driven (when CLK1 flips state every 0.5 seconds), propagating those changes through combinatorial gates, and analog, simulating the op-amp to create a simple digital-to-analog converter (DAC). Bridging the analog and digital sides within the simulator is tricky, but not impossible.
You are correct that if there were not both event-driven and analog simulation intermixed, and we simply simulated all the digital gates with their analog implementations in MOSFETs, that simulation would be at least an order of magnitude slower -- probably far worse!
(Disclosure: I built CircuitLab's simulation engine.)
Re:Show HN: CircuitVerse – Online Digital Circuit Simulator
by satu0king on Wednesday June 06, 2018 @11:41PM
(#17253072)
Your analysis is correct with respect to circuitverse. This is just to test the logic correctness of your design after abstracting away the analog and real world nature of electricity.
https://en.wikipedia.org/wiki/Discrete_event_simulation
If you model a circuit in CircuitVerse, how similar would the results be to a real-world version?
As long as the gate delays and fanin/fanout are considered, the results would be logically valid. For simulation of more analogue effects (e.g. what happens if you connect the outputs of two gates together, and one tries to pull it high and the other low?) something like SPICE is necessary:
https://en.wikipedia.org/wiki/SPICE
...and since that involves numerical solutions to nonlinear differential equations, is at least an order of magnitude slower.