Logic Gate Shapes

One thing I hate is how few designers actually know how to draw a simple logic gate. A NAND2 gate from one library fills a 6x6 grid while another is 5x4. They are all over the map.

The IEEE settled this many years ago with this drawing:

IEEE_Logic_Gates!

A NAND gate is a half circle with a radius of 13 units combined with a three sided box with a width of 19. The inversion bubble is 1/8 the gate width.

So I tried to create a kicad symbol using this spec and found that kicad cannot do it. The inversion bubble on a pin has a diameter of one 50 mil snap grid so that makes the width 8 grids and the height 6.5 grids. This means that you must change your grid settings to 12.5 mil or a submultiple.

KIcad doesn’t support this.

Could we add some more options to kicads grid settings?

------------> What is a unit?

Which one of these gates are you referring to?

The first 3 are from the KiCad lib’s, the quad version from the DigiKey Lib.

FWIW, the pin symbol size is settable in 5.99.

(Note that it’s a property of the schematic, though, not of the symbol. Same for wire widths, bus widths and junction dot sizes.)

Call me a heretic; but I would like to ask whether it matters? Mainly:

  1. Is there any difficulty to draw the symbols in a way which is universally, easily, and clearly understood?
  2. If there is no such difficulty; is there some other problem?

I am just being a pain-in-the-butt academic here. Please do not hesitate to argue. I need the diversion. :slight_smile:

Well as an electronics designer, you get to design units, devices, or maybe even…items.

I think in this context it’s just a unitless value, but “units” is added to make it clearer :slight_smile:

Currently the “default pin distance” (if there is such a thing) is “100” in KiCad, which would make the size of OP’s symbol redicilously small.

I sorted the previous list in decaying preference.

  • The Digikey lib is just ridiculous, I uninstalled it.
  • IEEE. Has anybody ever used those out of free will? It was a thing in the '80s I believe, maybe they still teach those in schools.
  • 74HCT00, KiCad’s default symbol. To big to my liking. Legs too long. Did this slip through the KLC? It’s been some time since I last looked at the KLC.
  • 74LVC1G00, nice compact symbol, which you can put in a small corner of your schematic.

KiCad’s libraries have made tremendous progress over the years. In other schematic programs I’ve used over the last 30 odd years I often had to re-design almost every schematic I used, but since the improvements in KiCad I often just grab the default symbols and they’re usually adequate.

Only for stuff like microcontrollers etc I Usually make custom schematic symbols because I want pin location and names to fit the function, but that’s also extremely easy in KiCad.

The 74HCT00 symbol may have been created before a lot of the KLC rules were made/rigorously enforced (I think the logic library is on of the oldest ones out of the provided libraries). At this point, any major change to bring them up to KLC compliance would be “breaking” and probably require either a new library or a new major release.

Library maintenance is a tedious job and I’m amazed it’s in the good shape it is. Even links for datasheets to external websites tend to work.
From what I understand Library maintenance needs 2 or 3 more people.

I’m longing for KiCad V6.
From what I understand schematic symbols are going to be integrated into the schematic file itself, and projects are therefore independent of external libraries in much the same way as it works in Pcbnew now. It may be best to wait for such library changes untill most of the schematics have been ported to KiCad V6.

I’ve also learned a long time ago to also save schematics in .pdf format.
If you then get the boxes with question marks and have some trouble getting old schematics into the newer KiCad, you at least have a reference to compare with.

2 Likes

Kicad is quite capable of displaying a proper nand gate but the symbol editor is not capable of creating one. You should not have to modify your design to accommodate your tools.

This one is 5 grid wide and 4 grids tall so it has an aspect ratio of 1.25.

The IEEE spec is 32 units wide/26 tall for a ratio of 1.2308 so this one is the closest. It looks like they tried to do it right but had to compromise to fit on a 50 mil grid.

Do not adjust your graphic to fit the grid. Change your grid to fit the graphic

1 Like

I do not understand.

Why would you even care about aspect ratio of a NAND gate?
Schematic symbols are for giving meaning to IC’s, and Ideally conform to some simple rules (Though the KLC is quite extensive). For me:

  • Symbols should (if possible) convey the meaning of the part. (In graphic form if possible).
  • Symbols have to be small to fit many of them on a schematic.
  • Pin attachment must fit the Grid (For KiCad V5. KiCad V6 will improve on this).
    In KiCad’s symbol editor you can easily set the grid to “1” unit, for graphics items, while the default grid you see in Eeschema is “50” so what is a 4 by 5 grid in that NAND example is actually a 200 * 250 grid, which is plenty much for detailed graphics. It is just the attachment points of pins that must be on a “100” grid. (This is also part of the KLC). Uniform pin spacing throughout a schematic is also a good thing.

The exact aspect ratio is totally irrelevant.

In that other post you mentioned a Dewey … system for library management. I was curious to what that was, mainly because you thought it was superior so I looked it up, and found on Wikipedia that it is that numbering system used for flattened dead tree carcasses. Why is that relevant for a library system for an EDA program such as KiCad or LibrePCB? That Dewey system is 150 years old. From way before computers existed and search engines.

KiCad mostly uses search functions to find items in the libraries.
If I press “a” in Eeschema to add a symbol and then type 741, it gets me some 40+ symbols. If I then type a space and start typing “opamp” I have a LM741 in 3 extra keystrokes. Give me a decent search engine any time compared with manually looking up indexes.
The internal structure of KiCad’s libraries is mainly a tool for the Library maintainers, and from the viewpoint of a user it does not interest me much.

But for people who do care:
I kind of suspect that in 2 to 5 years some more levels will be added to the directory structure of KiCad’s Libraries. The current method is partly legacy and changing it now will break to stuff for KiCad users. After KiCad V6 is long enough in use for people to have migrated it may become time to revise such things.

Also, people tend to grow into the tools they use. With a lot of things there is no “better” or “worse”. It’s just “different”. Just recently I wrote a longer article about this in the KiCad section on the EEvblog Forum.
https://www.eevblog.com/forum/kicad/kicad-gui-is-horrific!/msg3053324/#msg3053324

Thanks, Paulvdh

I used to think of Digikey as an island of intelligent sanity in the distribution world, but I am no longer so sure. My guess is that they do not pay enough. I also feel that symbol pin length is often too long. I like my schematics to be clear but compact. My related pet peeve is relatively small symbols on a very large schematic with long wires so that you cannot read the whole schematic in one view, even if it is a relatively simple one.

I have a contrarian view on “common sense” (Recent world events confirm for me that there is little or no such thing) but nevertheless: Common sense tells me that for a visual symbol there ought to be some tolerance window on the ideal size and aspect ratios. So if the width/length ratio is 2% larger or smaller than the IEEE ideal, how can that matter? (2% is an arbitrary figure.) Real-world dimensions are not exact anyway.

Sometimes we have good reasons not to follow our standards but not knowing the standard exists is never one of them.

The reason I chose a NAND gate instead of an NOR is because the standard for a NOR gate is flawed. These were created about 60 years ago to show designers using drafting tables how to draw gates. They were designed for protractors and scales. The NOR gate does not fit onto any reasonable snap grid and is never used in a CAD environment. We adjust it to make it fit.

The only reason not to use the NAND gate is that kicad does not offer a grid setting capable of entering it in the most popular scale used in all the libraries. We could adjust it to make it fit or we could add a scale to kicad that works.

Kicad is trying to morph from a hobbyist tool into a professional grade tool set. This is the type of task that a professional tool is expected to be able to handle.

If there is no good reason either for or against using a standard then the default should be to use it


When I place a part with kicad I am presented with a sorted library list that lets me scroll down to select a library where I can then choose a part. With Kicad,digikey and sparkfun libraries that list is 289 lines long.

When I place a part with librePCB I am presented with the top ten categories from the Dewey Decimal System. It fits nicely on the screen. I select a category and I see the next lower level of choices. I can go down as many levels as it takes before I see all the parts that meet my criteria. Those parts will all be presented together on the same screen even though they all come from different libraries. There is a reason that Libraries all use the Dewey Decimal System.

Kicad’s 2 level system may have worked 30 years ago when there were only 2 dozen libraries but it doesn’t work for today’s selections.


Long pin lengths are bad. I prefer to use hotspots and let the designer make their own pin

To contradict the thesis that ‘all use’ you need is to find 1 opposite example. I found such an example - KiCad library :slight_smile:

Good point. I will correct my statement

There is a reason that all brick and mortar Libraries who know what they are doing all use the Dewey Decimal System

When I visit my local B&M library the only time I use the DDS is for getting the physical location of the resource after getting the results from a web search page. Apparently there are library catalogue systems that show you on your smartphone a map of the library and how to walk to the appropriate shelf. Of course the librarians still catalogue using the DDS, but users don’t really need to know that 914 is European Travel. Who has the time to learn the system and remember those numbers if you are not a librarian, that’s what we have computers for.

They don’t. The the vast majority of university and research libraries in the US use the Library of Congress call number system because it is better for large and expanding collections.

Exactly. I much rather type a (regular expression like) search string in a box, then manually clicking through multiple levels of sub directories.

The only time I ever used the dewy system was to use a computer to do a search and then go walking through the library to match the number I found with a rack with books with the subject I’m interested in.
( First time I did this was somewhere in the late '80s. They had 3 computers in the library back then, and I was thoroughly impressed that al that information from all those books fit into a single computer. )

I’ve also had many misses while searching through the library (with books) and needed multiple iterations. There is also not much improvement to be expected in a 48 year old male. In contradiction, search engine algorithms and interfaces to them are still getting better, and already vastly better then manual lookup.

Also:
I’ve been reading here and there, and one of the reasons for the new file format for Eeschema in V6 is to make it more independent from the library system, and some hints have been dropped that some time after V6, when most users have migrated, (which could well be a few years) the library system may be changed to a more hierarchical system.