Software I'm working on requires simulation of logic circuits, both combination and sequential.

Now the simulation doesn't need to be too detailed, in fact it could be detrimental to the function of software, it only needs to simulate the logic itself and not properties of individual transistors, other elements and their respective voltages, current, resistance etc.

The primary concern is accuracy and secondary is performance.

This leads to interesting issue.

On one hand I could use existing SPICE solution, build an abstraction on top of it and ignore every aspect of circuits I don't care about. That would ensure the accuracy, but it would require me to familiarize, in depth, with the library in question. It could also lead to issues with license, depending on library used.

Not to mention the performance hit, caused by simulating things I don't need.

Or I could write my own simulation solution, doing only things I want, with no licensing issues and optimized for performance. The trouble is, that I'm not an electrical engineer. And I'm afraid that I might overlook some critical aspect of the matter.

And obviously, implementing my own solution could very well take more time than building abstraction layer on top of existing one.

So the question is which one should I use? Is there any other angle I should consider?

  • Are you just simulating the combinations of AND/OR/NOT etc gates? Do you need to care about timing? – GoatInTheMachine Aug 17 '18 at 12:47
  • Since I'm working with sequential circuits the timing does play a role, yes. – user1561358 Aug 17 '18 at 12:54
  • Do you need to propogate just true/false from one component to the next, or levels? What components do you need to consider? – GoatInTheMachine Aug 17 '18 at 14:35
  • 1
    Just use LTSpice like everyone else – whatsisname Aug 17 '18 at 17:56
  • @user1561358: define timing. Does timing mean "this block happens after this other one" or does it mean "this gate takes 5ns to change state and this other one takes 3ns, and it takes 4ns for the signal to move down the wire, etc"? – whatsisname Aug 17 '18 at 21:12

From the sound of it you dont seem to quite know what it is that you want/need. In one sentence you talk about only caring about the functions of the pièces and not the physical properties and the such, but in the next segment you begin to say that you believe you might need an electrical engineer to cover all edge cases.

If all you need is the basic logic of the pieces you want to simulate then you don't even need to abstract very far at all, a simple "piping" of outputs for one piece to the inputs of others. If you need more detail than that, say the timing that certain pieces may take to activate, or what have you then the pre-built solution is likely better as you won't need to do all the research required to get the timing correctly.

| improve this answer | |
  • >you might need an electrical engineer to cover all edge cases Well that's the thing, I don't know for sure. Since I'm not an electrical engineer. – user1561358 Aug 17 '18 at 13:52
  • 1
    You dont need an electrical engineer to know what your requirements are. Do you need to only emulate the functionality or the physicality as well? – TurtleKwitty Aug 17 '18 at 13:56
  • "a simple "piping" of outputs for one piece to the inputs of others" - your system will explode when you attempt to include flip-flops. – whatsisname Aug 18 '18 at 0:52
  • @whatisname If you only calculate upon a change of state then no, it would not break at all. Of course it all depends on how things are programmed but either way a simple system is always a good starting point – TurtleKwitty Aug 18 '18 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.