Hacker Newsnew | past | comments | ask | show | jobs | submit | satu0king's commentslogin

Really sorry, fixed the issue.


Thank you! but we are from IIIT Bangalore xD


Thanks for the tips! 1) Feature 4 definitely is a must. 2) Feature 5, not sure what would work well. 3) Feature 6, No idea what is Rube golberg style! 4) Feature 7, not sure what you mean but there are LEDs - analog, digital and RGB LEDs


Thank you, yes the team is working on this. Idea is a full documentation for people who don't have much knowledge of individual elements + community blog where community write stuff


Wow, that's great to hear! I hope you post something here when that becomes available. Cheers.


Can we post it? I heard you cannot post the same thing again ?


Or circuitVerse


Yep! It was inspired by all these simulators :)


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.


Please look at the examples to see what the simulator engine is capable off. As for designing the simulator engine to solve these kind of cyclic circuits, and advice on how to do it?


As for designing the simulator engine to solve these kind of cyclic circuits, and advice on how to do it?

The general idea is to iterate while changes are still propagating through the circuit; here's some pseudocode:

    changedNets.add(initial stimulus)
    for each net in changedNets
        changedNets.remove(net)
        for each node in nodes(net)
            for each output in outputs(node)
                evaluate output
                if output changed
                    changedNets.add(output)
        if state cycle detected
            break
The above algorithm reasonably accurately models what happens in a real digital circuit: changes propagate through each node until the whole circuit reaches a steady state. You can even add visualisations to show each step of the propagation as it takes place, and more elaborate versions can take into account different propagation delays (i.e. the output of each node can change at a different time relative to its input, so you process them in a queue ordered by that.)

To use my example circuit, with both inputs low initially: when one of the inputs of one NOR is set high, in the next step the output goes low, then the other NOR's output goes high, and the input of the first NOR goes high. This doesn't change anything else, so the circuit reaches equilibrium. When you set that input back down, the NOR already has the other input high, so it doesn't change state and equilibrium is already reached.

Cycle detection can be as simple as a hardcoded iteration count, or something a bit more accurate and useful:

https://en.wikipedia.org/wiki/Cycle_detection

Interesting fact: A true cycle-detection algorithm will theoretically let you simulate a whole CPU running any Turing-complete program, if you clock it with an "inherently unstable" ring oscillator...


Thank you! Not sure if this is within my ability to implement but will give a definite try


You probably have to model the fact that gates need time to change their output. You can use a data-structure like this ([1]) to keep an ordered list of events (ordered by the virtual time), and you just work your way down the list, generating new events, until the network is stable.

[1] https://en.wikipedia.org/wiki/Priority_queue


Its really meant to be used on a computer. Mobile compatibility coming soon.


Yes, the storage loop doesn't work yet. However you can simply use a d-flipflop to do what you need.


However you can simply use a d-flipflop to do what you need.

The point of my exercise was to test a basic functionality. If you cannot simulate that, the feedback loops which arise naturally in more complex circuit designs won't work either. It's like the "fizzbuzz" of logic simulation.


If you have a flip-flop atom then you can do some meaningful stuff; IIRC the gate-level circuit simulator that the Nand To Tetris course uses can't handle this stuff, and you can still build a CPU. I guess it just depends at what level you want to think about the circuit.

Edit: maybe it should be called a "logic circuit" instead of a "digital circuit".


Edit: maybe it should be called a "logic circuit" instead of a "digital circuit".

I will take this advice and discuss with my mentors, Thank you :)


Yeah, I saw 'timing' mentioned, and also tried to create a flip-flop for yucks.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: