Digital circuit simulation


#1

I am not able to use d flip flop in Kicad nightly builds.Can someone tell me which IC to use and which .lib file i must use for a simple D Flip Flop.


#2

Why do you always have such generic questions?
You have already in the past been told we need more details to understand at what exact step you hung up your self.

Post a screenshot. Go into details what you tried to do, what the expected result was, what you got as a result. (Nightlight the differences between expectation and reality.)


#3

His question is not so trivial.

I myself have to crawl several lib files to find a proper symbol.

Currently there are a dozen options from 74xgxx.lib to CMOS4000
with Logic_74xx and Logic_CMOS_4000 also w_logic

There are selections… but ONLY for specific chipsets
YOU DON’T HAVE a SIMPLE GENERIC SYMBOL

Unless you craft one yourself.
Yesterday I have made a very simple CMOS based gates sheet
Just after the post I decided to GLUE that into a GENERIC GATE LIB


#4

so… 10 minutes later a DSPICE.LIB (digital gates spice) library
was created with that basic simple CMOS gates.

From that building blocks all other gates may be derived
XOR and SR-FLIPFLOP were the first two.

Working fine using a SUBCKT with that very same blocks

I think is this kind of simple gate driven logic he is seeking

I was missing that too…
Paul


#5

Here the library has just the very basic 3 necessary gates

  • NAND
  • NOR
  • NOT

All others were instantly derived from that
with the companion dspice.lib subckt MOSFET based models

That is already ready done and works fine


Paul


#6

KiCad is after all a pcb design program. PCB design programs need symbols for real parts. The reason to simulate in kicad is such that you can test your design with said real parts. If he wants a simple digital simulator he should look into things like logisim which specializes on simple digital simulations.
(Which was already suggested in a different thread.)

Just to make it clear. I am in no way against using kicad for this purpose. But if people expect it to be a simple digital simulator, they try it out and find that this feature is not really present the way they expect, then people will get the idea that kicad is worthless. It is an extremly good tool for pcb design and i think the spice integration will add to that functionality. But the core function will remain the pcb design stuff.


#7

Now you have. Things changed

KiCAD has become so intuitive
that in about 20 minutes i crafted that for myself
literally without effort…

Kinda automagically.

I can draft a composite GATE LOGIC in KiCAD now insanely easy


#8

If we add these symbols i guarantee a lot of beginners will use them and expect to make a pcb from them. My main point is: We can not add things that will compromise the core function of kicad. At least not to the official distribution.


#9

Well. They will have to learn …

Exist a difference (wide one) among

  • SIMULATION
  • CAPTURE/DRAFTING (schematic printing)
  • LAYOUT (PCB design)

In fact along the 30/40y all EDA packages struggle trying
to join these interfaces.

OrCAD made a HUGE mess from ver 3.x to 4.x trying to add
FPGA design into this…

All EDA packs more or less now are 3/4 part based

  • SIMULATION
  • SCHEMATIC CAPTURE
  • LAYOUT
  • GERBERs

So far none of them are perfect integrating this
and things are worst with 3D models and CAD design

a 5th category

  • CAD integration

Things are converging but far from perfect
Paul


#10

What is the problem of using real devices in a simulation? After all the reason to simulate is to build the thing and verify it later with a measurement. What reason is there to have a powerful spice simulator and only run some digital approximation. (Which can be done as i said above in simpler tools. That are also open source.)


#11

I suppose you would treat it like how spice gives you ideal op amps, ideal resistors, etc, Having a generic library of functional parts until the simulation library is furthur built up would help people to draft ideas,

Personally I have not had to track down device specific models before, however I am going to guess that its only there for companies that have there own simulation package, or are popular enough that someone else has already made one.

Even trusting the manufacturer spice models will not be 100%, as it was built to simulate certain use cases.


#12

Your question is mixing 2 concepts.

  • THE MODELS
  • THE CIRCUIT

You can have a SINGLE ONE CIRCUIT.

YOU CAN (AND SHOULD) SIMULATE THAT WITH SEVERAL MODELS

Each model vary in degree of complexity and purpose
from TEMPERATURE DRIFT to HARMONICS output

Complete different things and models
Very same circuit layout

That is why
Paul


#13

They are NOT EVEN COMPATIBLE among themselves.

Each one wants to sell their own “SIMULATOR”

A more or less common denominator is PSPICE

which now is integrated some degree into NGSPICE

a huge advance
Paul


#14

I think you are right, if it is a pure digital circuit. For a simple circuit, logisim would be ideal. For more complex circuits, I think they would be implemented in FPGA or a microcontroller. I don’t think there are many people designing with multiple TTL chips apart from nostalgia projects.

However, it is common to have a few gates mixed with analog, I recently worked with such a design. Although, they are probably simple enough to verify with pencil and paper.

I assume the OPs question is for education or learning purposes, in which case giving a ready cooked solution is kinda pointless. However, I would like to make some examples to see what is possible. I don’t have a lot of time right now though.


#15

I think beginners are going to have a similar problem they do now with symbol/footprint split. They will expect atomic symbols that also have the correct simulation for the part, i.e. a BSS138 has the exact model required for the ngspice version in KiCad. They also will expect to press a button and have the complete circuit simulated without further effort! :wink:

I think some tutorials and advice are needed to manage expectations and guide newbies along a productive path. Currently I couldn’t find such advice, I guess being a quite new feature it takes time for these to appear.

It would be useful to have a “Simulation” category or maybe a tag to mark symbols that are “simulation ready”. It might not be obvious that symbols in pspice.lib are for the simulator, but not all of those work correctly anyway. If you need to add a model and node sequence etc anyway, then you can actually use any KiCad symbol, and associate the correct simulation parameters with it.

Manufacturers do supply spice models (of some flavor). I don’t believe copyright applies to engineering models, but manufacturers usually have a “download agreement”… so we end up with the same issues as for 3d models. To be clean we need a FOSS implementation.


#16

There was a discussion on the github repo about that. The first point was that these models are most likely encrypted. And as you already said there is a user (or download) agreement. Wayne said that he is categorically against including such models in kicad. (Which is also my opinion on this.)


#17

There is no debate on that.

  • The downloaded models ARE proprietary
  • Most of them allow use but not blind copy
  • Many of them are indeed encrypted - away from spice3

And if you didn’t realized that already…

  • The models associated with the symbols above ARE SPICE3 only
  • All GATES were defined and are working on SPICE3 only MOS
  • The lib is nothing beyond plain KiCAD and ngspice - nothing else
  • Working out of the box.
  • WITHOUT a single bit of external models
  • REQUIRES NOTHING BEYOND A PAIR OF SPICE3 default NMOS/PMOS

And… last at least …
any user at such low point that can not associate
a model with a symbol will have problems associating
even footprints … once ONE CIRCUIT today may have multiple
layouts (THT SMT or even mixed)

That low point is below consideration

FYI - as asked in the FIRST POST:

  • IT IS PERFECTLY POSSIBLE TO HAVE a FLIP-FLOP SIMULATED
  • YES in KiCAD - USING ONLY SPICE3 MOS devices
  • It took me in gross total about 40 minutes to craft that libs

in just 3 rounds …

It is done - a JK and a D type FLOPS working fine just with MOS gates
( YES standard SPICE3 only default MOS)
Paul


#18

And evidently you don’t even require the GUI

SPICE only MOS models will run WITHOUT ANY
external included model.

YES including GATES AND FLIP-FLOPS


10 minutes to put that FLIP-FLOPS together …

so back to the question:

  • YES you can run your FLIP-FLOP just fine
  • YES you WILL NOT NEED external stuff to do that

just a bit of effort
cheers
Paul


#19

Impressive, but it would be nice if your posts were a little more helpful and informative and a little less boastful. And are the bold caps really necessary?

A little arrogant don’t you think?


#20

NO not at all.

Long time ago I tried to attend a class with some
complicated math which at that time I thought
I would just understand.

I was young and very naive.
Some things just take time to manage.

Facts of life.

The ROAD IS PAVED FOR THOSE WHO WANT.
I have shown the way to do so.

Just get the way… takes some time
You manage

If not … just call for help I will be glad to answer if i can
Exactly like i did here for THE VERY FIRST POST.

And I consider that question properly answered
WITH EXAMPLES AND HELPFUL TIPS
Paul