2
\$\begingroup\$

I have two components in my top-level schematic and noticed that the schematics of these components are actually the same. To avoid any duplication of changes done to these subcircuits, it would be nice to just keep one of them and have the other component just use a different symbol but actually point to the same schematic.

I tried changing the Type field of one of the components to have the same name as the other component, but by doing that, LTspice doesn't open the schematic on double-click any more and the "Navigate/Edit Schematic Block" dialog that pops up when right-clicking on a component is now the generic "Component Attribute Editor" for that component.

Note that I need to keep different symbols for that shared schematic for readability reasons at the top-level.

Edit 1:

Just tried to generate a netlist with the changed Type string, it causes an...

>>> ERROR: Couldn't find schematic for symbol: alternative_symbol_name
\$\endgroup\$
1
\$\begingroup\$

You can make one symbol without any names, that is, no "hardcoded" edits from within the symbol editor. Edit the attributes but not the names. Then, when placing that symbol in the schematic, simply rename its instance name to whatever subcircuit you have. Then place the other and do the same for the other subcircuit, while adding proper .inc or .lib cards on the schematic. Of course, this implies the same number of pins in both cases, but there can be a cheat for this: if thte 1st subcircuit has 3 pins and the other 4, then simply add a dummy pin to the 3 pin subcircuit.

If you need to have two symbols at the and of it, no problem, just use only one symbol and change the instance name, the other symbol will be there, ready to be used. The greatest hint for hierarchical schematics (by your words I'm guessing this is what you have) is not to make the name of the symbol hardcoded -- that makes it unique to a certain subcircuit --, unless that is your purpose from the beginning.


Edit: Just to be sure I spell it all out, using two symbols for the same subcircuit, or hierarchical schematic, means simply placing a symbol on the schematic, renaming its instance name, then placing the other (or the same) symbol and doing the same renaming reflecting the desired subcircuit's, or hierarchical schematic's name. All these while taking care that the symbol itself doesn't have a builtin (edited, hardcoded) instance name -- easily taken care of when editing the symbol.


Edit 2: I got home and I realized I omitted another possibility, that deals with hierarchical schematics. The symbols and the schematics can only share one name, case insensitive, so, if you need two symbols pointing to the same schematic (avoiding duplicates of the schematic but keeping more than one symbol), you can simply make the second symbol with a similar name as the first (say hierarchical.asy and hierarchical2.asy), and make a symlink to the lower level schematic (say hierarchical.asc and the symlink hierarchical2.asc). It should be a fairly simple task whether you're in Linux, Mac, or Widows. I'm on Linux -- ln -s file link --, never been on a Mac -- I understand it's about the same thing --, and used a small freeware utility in Windows -- hard link shell ext or something like that, but you can use command prompt, too.

\$\endgroup\$
  • \$\begingroup\$ Thanks for your contribution, you are correct in that I am talking about hierarchical schematics. Unfortunately, I don't understand what you mean by "hardcoded" edits. Since my LTspice schematics and symbols are all ASCII text files, I had a look into them (using a text editor) and could not find any references to the schematic they "belong to". Also, since I use version control that treats file-system symbolic links as files, I cannot use them (I work across Windows and GNU/Linux platforms). \$\endgroup\$ – FriendFX Sep 14 '16 at 3:59
  • \$\begingroup\$ Then I'm afraid your only other option is to use a subcircuit. You can use a hierarchical schematic with a symbol, but not with two, they would have to have the same name. For the other symbol, you'll need a subcircuit (with a "block" symbol). By "hardcoded" I mean, when inside the symbol editor, do not edit the SpiceModel line, or add its instance name in any field, let it be empty and only add the instance name from within the schematic. Think of it as a blank symbol, where you place it in the schematic and add its name, value, etc on the fly, but this is more for subcircuits. \$\endgroup\$ – a concerned citizen Sep 14 '16 at 6:01
  • \$\begingroup\$ One other bad example with "hardcoding" is adding the library/model, with or without path. That will cause errors for anyone using the symbol and not on your computer. Not everyone has the same paths and/or libraries as you do. In general, the safest way to handle projects, hierarchical or not, is to put all the relevant schematics, models, libraries, symbols, etc inside one folder, and use the .inc or .lib directives without paths, simply names (LTspice will look first in the current directory). Tis way, exporting the folder will work on everyone's computer. \$\endgroup\$ – a concerned citizen Sep 14 '16 at 6:06
0
\$\begingroup\$

This is a common thing done with Virtuoso (for example, a logic gate symbol may represent itself and its DeMorgan equivalent representation). I am not completely familiar with LTSpice but expect they are similar.

Assume the original symbol is saved as cellname.symbol

Copy the original symbol to cellname.symbol_alt1 (in same folder as original) and modify accordingly.

Now when you instantiate the symbol, select the cellname.symbol_alt1. If this doesn't work, then once cellname.symbol is instantiated, select it and go to Properties.
Here modify the symbol path to point to cellname.symbol_alt1.

\$\endgroup\$
  • \$\begingroup\$ This doesn't seem to work with LTspice, I cannot edit a placed symbol's target schematic within the program. So far it looks like I have to copy the schematic as well, just to match the new symbol's name... which is exactly what I am trying to avoid. \$\endgroup\$ – FriendFX Sep 14 '16 at 4:20

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.