Commit Graph

55 Commits

Author SHA1 Message Date
Tim Edwards 43bb499bcf Corrected an issue with the limited bitfield dedicated to port numbers;
this limited ports to 16384, which seemed reasonable at the time.
However, the sky130_sram_macro layouts connect power and ground in a
way that when coupled with "extract unique" can generate tens of
thousands of ports and overrun the bit field, showing that automation
can do the unexpected.  The solution was to split out the port number
from the label record as its own 32-bit value.
2021-12-12 22:09:31 -05:00
Tim Edwards f68c2c7657 One small change to the ext2spice topVisit code to ignore nodes that
have already been output;  i.e., that have EF_PORT set.  However,
since EF_PORT is now set on all implicit ports, it is likely that
this part of the code is no longer exercised at all, and may be
removed.
2021-12-06 09:52:59 -05:00
Tim Edwards 5913643ad0 Reverted most of yesterday's modifications. Instead located the
issue at the change made in revision 214.  This was done incorrectly
in two ways, one being a set of statements inside an if() block that
should have been executed always, and the other an incorrect use of
the EF_DEVTERM flag, setting it when it should not have been set.
2021-12-03 12:29:02 -05:00
Tim Edwards 6a8f1226d1 Corrected a problem with implicit substrate ports and connections;
implicit substrate connections under some conditions were not added
to the subcircuit pin list.  When this was corrected, the call to
the subcircuit was missing the implicit substrate port.  When that
was corrected, the implicit substrate port printed was the subcircuit's
local node name, not the connection from above in the hierarchy.  The
underlying problem was that the substrate was marked as a port in a
node record that was in another (flattened and unused) def and so not
seen when enumerating the def's node list.  It's possible that the
better solution is that the efNodeHashTable() should be enumerated to
write subcircuit ports, not def->def_nodes.  However, now, by using
EFHNLook(), the corresponding entry in efNodeHashTable() is found and
used.
2021-12-02 11:38:46 -05:00
Tim Edwards 6b1365708d Made another correction to the recent change in ext2spice.c where
an out-of-bounds array access occurs that can cause bad output at
best and a crash condition at worst.
2021-10-07 10:58:21 -04:00
Tim Edwards ff49ba4d2e Another correction with a line that should have been removed in a
previous commit and can cause ports in the SPICE netlist to have
names other than what the port label declared.  Expected not to be
fatal to the netlist, but it's a bit difficult to work with a
subcircuit that doesn't have the expected pin names.
2021-10-05 16:02:21 -04:00
Tim Edwards ff08df0eed Fix to new ext2spice code to prevent a crash condition when
multiple instances of a port name are present.
2021-10-05 13:25:39 -04:00
Tim Edwards c4221889ed Correction to yesterday's commit (minor issue with line length in
the SPICE netlist output of ext2spice).
2021-10-05 08:50:45 -04:00
Tim Edwards 09f335862b Added a check for interrupt in "extresist". Modified the output of
ports in SPICE so that ports are first ordered by index into a
string array, and then output.  This avoids executing an expensive
double loop.
2021-10-04 19:52:22 -04:00
Tim Edwards 73929a0bcc One more round of edits on that issue. . . 2021-09-20 20:14:25 -04:00
Tim Edwards 597ef4857a Corrected an issue caused by the commit to version 8.3.190. Although
that commit claimed to correct an issue with implicit ports not being
output, the solution often failed to properly assign the port number,
so while the implicit ports were added to the subcircuit definition,
they were often missing from the subcircuit call.
2021-08-04 13:54:08 -04:00
Tim Edwards cc16b82a79 Corrected a problem in ext2spice which has been in the code for a
very long time but never discovered;  in which any implicit port
connection into a subcell (that is otherwise labeled with ports) that
appears at the end of the node list (i.e., after all the declared
ports), will not be output, either in the subcircuit definition or
calls.
2021-07-25 13:49:13 -04:00
Tim Edwards d4a09bbc45 Correction to prior commit to remove collision between defined
flag bits for name trimming and short handling method in the
ext2spice options.
2021-07-10 21:27:19 -04:00
Tim Edwards 6136d3ff0f Implemented a command option "ext2spice short voltage|resistor|none" that
implements a method for handling ports in a subcircuit that have different
port names and indexes but are shorted together.  "none" is the default
and backwards-compatible behavior that merges ports together, which will
often cause one of the ports to be optimized out of the netlist.  "resistor"
will separate the port names with a 0-ohm ideal resistor.  "voltage" will
separate the port names with a 0-volt voltage source.  This should work
well for simulation and potentially for LVS, although its impact on LVS
has not been fully investigated.
2021-07-10 21:13:24 -04:00
Tim Edwards 1c0dbc907a Recast all uses of resist-class and device class in routines using
code from extflat from type unsigned long to type TileTypeBitMask.
This increases the number of types of each to 256 and tracks the
number of types, so it should be difficult to exceed this amount.
2021-05-27 16:13:06 -04:00
Tim Edwards cde90bb4a7 Corrected a bad typo, "==" instead of "="; can cause a crash
condition when doing ext2spice.
2021-03-18 11:52:56 -04:00
Tim Edwards feddffcf45 Modified the handling of subcircuit names beginning with non-alphanumeric
characters.  Instead of removing the non-alphanumeric characters, magic
now prepends an "x" to the name.  Since this naming restriction does not
necessarily impact, say, LVS, it would probably be better to let this
behavior be enabled or disabled by a command.
2021-03-06 19:39:34 -05:00
Tim Edwards 4cc09afeac Corrected some errors relating to distributed allocation of node
area and perimeter across devices.  The distributed allocation
was missing for hierarchical output, and the function that
accumulates values per resistance class was initializing by
iterating over device classes, not resistance classes, leading
to a segfault if the number of device classes is larger than the
number of resistance classes.
2021-02-25 17:51:12 -05:00
Tim Edwards a61026588c Revert "Modified the .ext file reading and the .spice file writing so that"
This reverts commit 46baae0ce6.

Reverting the last commit, as it does not work completely the way it
is supposed to, and will most likely have to be done in a different
way.
2021-02-24 12:35:06 -05:00
Tim Edwards 46baae0ce6 Modified the .ext file reading and the .spice file writing so that
array delimiters and hierarchy separators (characters '/', '[', and ']')
that are part of instances or labels passed to magic, are preserved
from input to output, but internally marked (with a backslash escape)
so that they are not misinterpreted my magic when running ext2spice.
2021-02-23 13:46:12 -05:00
Tim Edwards 15fe4d2d29 Merged pull request #35 from Jan Belohoubek 2021-02-17 21:08:10 -05:00
Tim Edwards ba77257afa Several changes and updates: (1) Added a new keyword "required" to the
tech file format "version" section.  This can be used to specify the
version of magic that must be used to be compatible with the tech file.
This effectively supercedes the technology version number.  (2) Changed
the behavior of "make" to set the version and revision numbers on doing
"make" instead of "configure".  This allows the version to update
correctly after doing a "git pull" followed by "make" without doing
"configure" in between.  (3) Fixed a couple of issues that were flagged
as compile-time warnings.
2020-12-16 11:49:24 -05:00
Tim Edwards f343863ce3 Corrected two annoying errors: (1) SPICE netlist output subcircuits
could have multiple ports of the same name.  This problem had been
worked over before, but there was an indpendent mechanism producing
the same result for a completely different reason, caused by subcells
being much larger than the cookie-cutter extraction method's extraction
regions.  Solved by tracking port names in a hash table and preventing
re-use.  (2) ext2spice was producing "no such node" errors;  like (1)
this had been previously worked on, and like (1) this mechanism was
independent.  Problem came from not passing -1 to extHierSubstrate for
the non-arrayed dimension of a 1-dimensional array.  Also:  Removed
the word "fatal" from extraction error reporting, as nearly all
extraction errors are entirely benign.  This should clear up confusion
among alarmed end-users.
2020-11-24 15:30:49 -05:00
Tim Edwards 8da47b6e84 Made a change to the way ext2sim determines if a FET type is an n or
p device;  this was previously dependent only on the first character
of the extracted device model name.  Since the tech file has control
over what the device layer names are but not the extracted model
names, the device layer type name is used as a backup way to determine
if the type is n or p, if that cannot be determined from the extracted
model name.
2020-10-20 12:22:02 -04:00
Tim Edwards 32ec962535 Separated drain and source records for the esFetInfo array, to
support asymmetric FETs and other devices like bipolars that have
three distinct terminals.  This does not go as far as it should to
make the array independent of the number of declared terminals of
the device.  However, it suffices to make, e.g., parameter "a2=area"
work for a bipolar device, and to generate the right drain and source
areas and perimeters for asymmetric (e.g., extended-drain) devices.
2020-09-11 17:29:12 -04:00
Tim Edwards 18131e26b3 Pulled merge request from Jan Belohoubek, but corrected the problem
of needing to revert parameter definitions after swapping them
during a device source/drain swap.
2020-08-09 13:11:38 -04:00
Jan Belohoubek 6c508c25b9 swapDrainSource moved into a function to encapsulate swap-related tasks; area parameters swapped according to the D/S attributes; SPICE attribute comment printf moved to the end of export function as it allows to add more device types 2020-08-09 17:34:24 +02:00
Tim Edwards ae3c3d7baf Corrected ext2spice, which was reversing source and drain for the
"msubcircuit" extraction model, which would normally not make any
difference except that when source and/or drain are tagged with
terminal attributes, then the source and drain are swapped with
respect to what is expected in the output SPICE netlist.
2020-07-29 14:13:23 -04:00
Dan Moore 99a0575501 Changed the end-of-line comment character from ';' to '$' when
formatting a SPICE netlist for NGSPICE.  This is the documented
character as described in the NGSPICE User Manual, section 2.2.4
End-of-line comments
2020-06-27 19:50:12 -04:00
Tim Edwards 01966d594e Additional modification to the devVisit routine in extflat to
change from passing the HierName to passing the HierContext (of which
HierName is a part) so that more information from HierContext (such
as the cell use being visited) can be passed to the callback
procedure (largely for diagnostic purposes).
2020-06-01 17:14:22 -04:00
Tim Edwards 2af38a4191 Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
Tim Edwards ad13e48a07 Corrected ext2spice for the case where a port has been given more
than one name, because in that case one of the port records ends
up with a null pointer to a node, and causes a crash condition.
This can happen inadvertently, as when a connected node is not
specifically designated a port, but is forced to be a port
because of the connection.
2020-03-20 14:50:56 -04:00
Tim Edwards b6cb1fb54a Modified the LEF VIAGEN reading such that it can accomodate a different
order of layers than specified in the LEF/DEF spec.  It is not clear
whether this is common practice, or a bug in the tool that produced the
DEF file that prompted this change.  NOTE:  The "grow" function applied
in this case should be replaced by the actual GDS input rule sequence,
that includes the grow and shrink merge.  Otherwise, vias read from
DEF files do not match the layout from those read from GDS, even though
the mask layers represented by the layouts are the same.
2020-03-03 17:13:37 -05:00
Tim Edwards afe38c55c8 Resolved some issues with working with ext2spice using abstract
views.  Because the abstract view does not necessarily represent
actual connectivity, rely on the port indexes in the .ext file
to determine the number of ports and port order.  Do not use
SpiceNodeName() to look up the node name, or unique ports that
are deemed shorted will go missing.  Also:  Modified the read-in
of .ext files so that use names may contain backslashes.  Only
backslashes that end a line will be handled differently.
2020-01-13 12:58:04 -05:00
Tim Edwards ecfdb66417 Corrected one error in the recent fix for port enumeration in
ext2spice (hierarchy on), where the port index was not checked for
value -1 (no port) before indexing into the port list.
2019-10-31 15:19:30 -04:00
Tim Edwards fc86f44bb1 Again revisited the problem of duplicate nodes. This time, I think
I understand the problem, which is that nodes are ordered according
to precedence of EFHNBest() within a circuit, but there is no
concept of ordering between circuits.  So ports end up listing nodes
in arbitrary order, and the only way to resolve the order is to use
EFHNBest() as is done within a subcircuit.  Appears to work for
different edge cases tested.
2019-10-29 13:55:28 -04:00
Tim Edwards c342178458 Made some changes to the way that ext2spice generates subcircuit
ports, to avoid creating ports for node names that are redundant.
It would probably be better to avoid creating the redundant node
names in the first place;  however, I am less certain why these
are generated.  The incorrect additional ports all have hierarchical
names in the cell, which is a sign that they are incorrect, as the
cell itself should not have any parents.  The level of certainty
about this fix is definitely not 100%, but it was tested on a
hierarchical analog design, and setting levels of parasitic caps
caused new nodes to appear in subcircuits and in no cases did
information appear to be lost.
2019-10-29 09:44:28 -04:00
Tim Edwards 7a42b5b6ad Fixed a long-standing error in which "ext2spice merge" fails when
used with "ext2spice hierarchy on" because the device index is not
reset between calls to output cells in the hierarchy, leading to
a mismatch of the index for all cells after the first one output.
2019-10-23 09:33:37 -04:00
Tim Edwards 46f3f44849 Corrected EFArgs() so that "ext2spice run -help" works as advertised;
e.g., "-h" or "-help" is now recognized as a valid option instead of
printing a usage message by way of throwing an error.
2019-10-16 09:17:58 -04:00
Tim Edwards e9f3dcadef Added substitution for commas in SPICE output, because commas in
instance names and node names are basically fatal to running
ngspice.
2019-10-14 21:46:07 -04:00
Tim Edwards 58c4c8a32e Corrected problem in which using "ext2spice -d" (distributed
junctions) causes magic to crash.
2019-10-14 13:49:41 -04:00
Tim Edwards b0719384e4 Modified the new extraction method with multiple records for each
device type so that it is now properly backwards compatible with
the old-style "fet" records.  Also corrected the record matching
such that it properly matches according to the number of terminals
while allowing the traditional interpretation that there may be
fewer S/D type records than terminals if the S/D types are the
same for all terminals.
2019-10-14 11:09:58 -04:00
Tim Edwards 6d5d370e8c Corrected a few additional uninitialized variable situations that
had been shadowed by the previous set of fixes.
2019-06-07 15:00:39 -04:00
Tim Edwards 547f0448d9 Cleanup of a number of uninitialized variable issues flagged by
the compiler.  Some are obscure functions (plot verstatec hasn't
been used in years) but others (like SPICE distributed junctions)
are potentially significant sources of unexpected crashes on
systems that don't zero uninitialized memory.
2019-06-07 14:13:50 -04:00
Tim Edwards 53078588ae Changed the size of argv[] in efReadLine() to be 128 instead of
64 because I overran the 64 array with too many resistclasses in
a techfile.  This really should be dynamically allocated;  this
requires parsing the line to count tokens and reallocating as
needed (to be done).
2019-06-06 14:53:07 -04:00
Tim Edwards f3a95c74fe Corrected hierarchical SPICE extraction to reset the subcircuit
name-to-number mapping used for the HSPICE format between
subcircuits.  Otherwise, subcircuits with the same instance ID
remain in the table and may cause nodes to be output with a name
that collides with other names in the same subcircuit.  This only
affects output in HSPICE format.
2018-12-12 17:23:35 -05:00
Tim Edwards 648b9e54e6 Corrected "ext2spice lvs" to add "global off" as a setting, which
is normal for top level designs (no implicit label connections
should be made at the top level).
2018-10-31 15:41:22 -04:00
Tim Edwards 6f8ec21a11 Two improvements: (1) Command extension "ext2spice lvs" sets up
all the settings normally used for LVS (hierarchy on, cthresh
infinite, subcircuit top auto, etc.).  (2) Extract and extract
unique ignore cells marked as abstract views (property LEFview
is set) when checking for unconnected nets with the same name
label.
2018-10-31 14:33:24 -04:00
Tim Edwards fa17436fef Corrected a few errors in the implementation of "csubcircuit",
now fully tested and verified.
2018-10-30 21:56:05 -04:00
Tim Edwards 7dc15a7d28 Added extraction device type "csubcircuit", which should have been
added a long time ago, since capacitors use a different method for
calculating width and length than either transistors or resistors,
so subcircuits need a special class designator or else the extraction
may calculate the wrong dimensions for device width by totalling the
perimeter between the device and terminal types, as it would for a
MOSFET.
2018-10-30 16:19:20 -04:00