Logic.ly – Digital logic simulator for teaching logic gates and digital circuits
1–10 of 24 posts
Re: Logic.ly – Digital logic simulator for teaching logic gates and digital circuits
#2Re: Logic.ly – Digital logic simulator for teaching logic gates and digital circuits
#3If you find it fun to play with digital logic, you should first look at combinational logic, and then add some registers and get clocked logic with memory / registers. Once you've got that down, I'd recommend two next steps:
1. Look at some simple circuits that combine analog and digital. For example, [1] a digital 4-bit counter made up of four half-adders. (It's called a half adder because it only adds two bits A+B, producing a value 0, 1, or 2. In contrast, a full adder adds three bits A+B+C, producing a value 0, 1, 2, or 3.) The four output bits of the 4-bit counter are connected to a simple op-amp and resistor based digital-to-analog converter (DAC). This helps you understand that we have lots of ways of representing signals, and in engineering practice we combine these modalities to useful effect.
2. Instead of merely using software to model circuits, understand that circuits are a great way to model all sorts of real-world problems. You may have heard of "analog computers" [2] which predate digital ones, and were used for modeling all sorts of engineering problems. You may now use a circuit simulator to model mechanical systems, thermal systems, or even the spread of COVID-19. I've done the latter here [3], using a few capacitors and current sources to implement the differential equations of an epidemic. Because you can define current sources algebraically (i.e. the current can be proportional to other currents and voltages in the circuit), you can easily take advantage of the simulator's underlying ability to simulate arbitrary systems of differential equations. I've explained the COVID-19 model here [4] as previously discussed on HN.
[1] https://www.circuitlab.com/editor/53xa3r/
[2] https://en.wikipedia.org/wiki/Analog_computer
[3] https://www.circuitlab.com/editor/zubfhu8p3q3v/
[4] https://www.circuitlab.com/blog/2020/05/28/surprising-covid-...
Re: Logic.ly – Digital logic simulator for teaching logic gates and digital circuits
#4How is this implemented?
Is there like a metamodel behind it? is the editor completly selfmade? etc..
Re: Logic.ly – Digital logic simulator for teaching logic gates and digital circuits
#5I love it. How is this implemented? Is there like a metamodel behind it? is the editor completly selfmade? etc..
Writing software to do digital logic simulation is quite simple. Everything is event-driven: if a signal "A" changes from 0->1 at time t_0, and this signal is an input to some gate "X", then at time t_0 + t_p (propagation delay) the output of that gate will update with the new value, as defined by that particular gate/register/whatever. So events can originate from (1) external signals (such as buttons/switches), (2) clocks, (3) the output of an earlier gate updating its output after a propagation delay. You can then just propagate changes throughout the digital circuit, looking at what's connected to the signal that just changed state.
It gets a bit more tricky once you combine analog and digital simulations simultaneously. :)
Re: Logic.ly – Digital logic simulator for teaching logic gates and digital circuits
#6Re: Logic.ly – Digital logic simulator for teaching logic gates and digital circuits
#7Show HN thread from a couple of years ago: https://news.ycombinator.com/item?id=17508151
Re: Logic.ly – Digital logic simulator for teaching logic gates and digital circuits
#8Re: Logic.ly – Digital logic simulator for teaching logic gates and digital circuits
#9I played with it while reading the excellent book Code: Hidden Language of computers by Charles Petzold.
Re: Logic.ly – Digital logic simulator for teaching logic gates and digital circuits
#10I love it. How is this implemented? Is there like a metamodel behind it? is the editor completly selfmade? etc..
(Disclosure: I wrote the simulation engine behind CircuitLab, a mixed-mode [i.e. analog+digital combined] circuit simulation engine.) Writing software to do digital logic simulation is quite simple. Everything is event-driven: if a signal "A" changes from 0->1 at time t_0, and this signal is an input to some gate "X", then at time t_0 + t_p (propagation delay) the output of that gate will update with the new value, a…