Commit Graph

679 Commits

Author SHA1 Message Date
Tim Edwards 8b3bb1ae77 Updated the version to go along with pull request #256 from Proppy. 2023-07-11 16:52:03 -04:00
Tim Edwards 081058a41b Corrected an issue in which ports which have the same name under
the assumption of case insensitivity (e.g., VSS, Vss, and vss)
are kept separate even when writing SPICE netlists, which are
case insensitive.  The code fix both avoids flagging these ports
when running ext2spice, and more importantly, allows the use of
"ext2spice short" without these ports ending up separate in the
output netlist.
2023-07-08 12:14:57 -04:00
Tim Edwards b899a500d5 Added a new method to the extraction which allows parameter limits
to be declared for each device model, so that different models can
be specified for different parameter ranges.  For example, this
will simplify the definition of the high-sheet-rho poly resistors
and the bipolar transistors in sky130 by removing the need for ID
marker layers;  it also allows the correct device model to be
extracted when reading data from GDS that does not contain the
extra (and not foundry-approved) ID markers.
2023-07-06 12:35:47 -04:00
Tim Edwards cc4eef4eb1 Added a (obvious, in retrospect) additional automatic handling of
nets to be avoided for running antenna gate and diffusion area
checks when doing "lef write", which is to check if the pin of
the net is flagged with use "power" or use "ground".  This avoids
the need to use the (recently added) "lef nocheck" option (although
that still exists as an additional way to control which nets do and
do not get checked).
2023-07-05 12:37:56 -04:00
Tim Edwards c8a2d06e08 Finally got around to fixing the "logcommands" command, which has
been broken ever since moving to the Tcl/Tk wrapped version.  Added
some new features that allow background commands from the window
handling (like pointer tracking) to be omitted from the log file
via a suspend/resume function.  Added a header file and a few
commands at the top of the log file that align the log file contents
with the screen and box state at the start of logging.  This makes
a log file which can be "played back" by sourcing it from the magic
console prompt.  Per request from Harald Pretl.
2023-06-28 21:31:24 -04:00
Tim Edwards ca469510d5 Found that extNodeName() prefers the first name in a region's label
list for output, but that the code in ExtRegion.c does not sort a
region's label list to keep ports at the beginning of the list.  So
any net with multiple labels may end up with a non-port label as
the name of the node, which eventually becomes the name of the port.
A quick fix keeps these lists sorted.
2023-06-27 15:35:57 -04:00
Tim Edwards 60a378842f Corrected one array overrun error caused by using the command
"drc printrules".  Implemented a new "drc" command option called
"drc ignore", which can be used to suppress reporting of specific
rules, for both "drc why" and "drc find".  This can help with
finding an error buried among a large number of other errors.
2023-06-26 20:47:37 -04:00
Tim Edwards ca985edbd0 Corrected a typo in the previous commit that causes parameters to
be output twice for scaled devices (such as diodes in the sky130
process).  Above and beyond the typo, though, the implementation
of offsets is not very well thought out and needs to be revised.
For one, the +/- notation can be confused with signs in the
parameter expression;  that is also fixed in this commit.  But
there is currently no way to express both a scale and an offset
for a device parameter.
2023-06-23 08:39:59 -04:00
Tim Edwards 07267dc126 Extended the device parameter notation to include offsets using
'+' and '-' in the same way that '*' is currently used for specifying
a parameter scaling.  The combination of a scale and offset for the
same parameter has not (yet) been implemented.
2023-06-21 20:44:38 -04:00
Tim Edwards 482d7534a2 Reimplemented the "extract do local" option as "extract path <name>"
with "extract do local" now being equivalent to "extract path .".
This allows extraction files to be put in a subdirectory and not
clog up the current working directory.  Also:  Fixed some behavior
around the use of "ext2spice -p <path>" so that it (1) works, and
(2) is compatible with the new "extract path".  Since the ext2spice
and ext2sim commands are effectively independent of the primary
extraction, the "-p" option is needed to correspond to the use of
"extract path".  Hopefully this is seen as only a minor inconvenience.
2023-06-14 13:55:59 -04:00
Tim Edwards 31b3c0d8b4 Extended the "lef" command to include a new option "lef nocheck"
to create a list of net names to ignore for antenna gate and
diffusion area checks.  This allows the nets not to have to be
selected in their entirity but selected by chunk only.  This
reduces the time to write LEF on a large layout back to approximately
what it was before the change to include the hidden area from "-hide"
in the antenna area checks.  Plus, it greatly reduces the time to
generate LEF for large layouts when not using the "-hide" option.
2023-06-13 11:28:46 -04:00
Tim Edwards 5300f322de Added code to calculate area and perimeter of layers that are not
on the same plane as a device identifier layer.  This (finally!)
allows proper calculation of area and perimeter of diodes and
bipolars, for example.
2023-06-09 15:31:58 -04:00
Tim Edwards 6caab5da37 (1) Corrected an error with extraction in which terminal area and
perimeter are not initialized, and if a terminal perimeter/area
calculation is missed (which is happening on devices with terminals
in planes other than the plane of the identifying type), then the
perimeter/area of a previously handled device will get output.
(2) Corrected an error with "flatten -inplace" in which the command
fails to deal with instance arrays.
2023-06-07 08:06:18 -04:00
Tim Edwards 666c3c2c97 Corrected an issue in which the device merging routine can generate
NaN results for devices which are not FETs (specifically, devices
that are declared using "msubckt" but are not FETs, although there
may have been a related issue with non-FET devices not getting the
correct M count), due to the device having zero measured width or
length.  NOTE:  This may need more investigation.  If a subcircuit
device's method of merging cannot be understood, then such devices
should never extract with "merge aggressive", and should always
merge conservatively if and only if all parameters match.
2023-05-21 12:13:01 -04:00
Tim Edwards c514f5ce0b Apparently forgot to push the last set of changed. Fixes a null
return value in EFbuild.c and adds a couple of sanity checks.
2023-05-18 09:25:37 -04:00
Tim Edwards 44b269e037 Modified the handling of substrate ports so that an existing port
number for a substrate port does not get reassigned, which will
cause port ordering issues.
2023-05-08 09:51:13 -04:00
Tim Edwards 79dc621626 Added a warning message if attempting to extract an empty cell,
so that it is not so mysterious as to why no output was generated.
2023-04-28 09:24:04 -04:00
Tim Edwards c4124b033f Corrected a potential crash condition in extflat which can show up
when reading .ext files with "equiv" statements in them.  The
generation of "equiv" statements was expanded recently, making it
more likely for this issue to show up.  There may be devices in
a file that have a terminal node pointing to the node that gets
removed, and these must be updated to point to the node that
remains after merging.  This requires a full loop over all
devices and so could have a potentially large impact;  but in
general there are not many equiv statements (implying multiple
different labels attached to the same node) and so it is unlikely
that there would be a noticeable performance hit in practice.
2023-04-27 20:47:55 -04:00
Tim Edwards e66b2e1338 Rearranged the "lef write" routine so that the search for antenna
gate and diffusion area on each pin is done before erasing parts
of the cell that are to be hidden by obstruction layers.  That
preserves the antenna information even when "-hide" is used.  This
corrects the issue raised by Kareem Farid in the github issue
tracker #236.
2023-04-26 10:24:13 -04:00
Tim Edwards a33d7b78b5 Corrected an error in search for substrate under a device. If
"space" is considered part of the substrate, then the check for
planes to search should exclude "space" from the type mask
first.  Otherwise, all planes get searched, not just the substrate.
Also:  The same routine can falsely flag a device terminal as
substrate if a split tile is marked as the device's region.  This
was also fixed.
2023-04-24 17:30:40 -04:00
Tim Edwards bf7f1ab39e Updated version with the merge of pull request #235 from Brad Smith. 2023-04-22 14:14:20 -04:00
Tim Edwards c1f4555ba0 Corrected behavior of "load ... -dereference" to bring back a
previous behavior that had inadvertently been changed.  In recent
versions, "load <absolute_path> -dereference" would incorrectly
apply the dereferencing to <absolute_path> rather than just its
subcells.  Cleaned up the code around DBCellRead() in the process,
so everything is more straightforward (although probably more
could be done in that regard).
2023-04-18 11:01:58 -04:00
Tim Edwards cff2b97678 Changed the default extraction options to include "do aliases" by
default, since not setting it can have unfortunate consequences
for cells that don't declare ports and have multiple conflicting
labels on a node.
2023-04-16 12:18:16 -04:00
Tim Edwards adf9a7703f Added a statement for every file load that prints the file path
of the cell.  This will greatly help in diagnosing issues when
reading cells from multiple locations including cwd, relative
paths, PDK libraries, and the search path.  Also:  Reworked
the timestamp update message so that it prints all at once at
the end of processing, not printing output for every cell
processed as it is being processed.  That prevents output from
the file read routine from getting interleaved with the
timestamp processing output.
2023-04-15 10:44:50 -04:00
Tim Edwards 1d8fcca09b Implemented a change to differentiate between "sticky" labels and
labels that are not connected to their declared layers.  It's the
latter type that need additional processing in ExtSubtree.
Limiting this processing significantly cuts down on processing
time when there are many labels in a layout, as happens with the
"def read -labels" command option.
2023-04-06 12:26:18 -04:00
Tim Edwards fc62a63d41 Corrected errors in the extresist code and in extflat, both of which
can result in negative resistors due to integer overflow.  In all
cases, the target was floating-point and it was only necessary to
recast everything to float first.
2023-03-25 11:01:52 -04:00
Tim Edwards 30184cb506 Finally tracked down several bugs in the sidewall walking routines
that had been causing negative capacitances to substrate to be
generated for certain complex geometries.
2023-03-24 09:51:22 -04:00
Tim Edwards f0c94d59f3 Minor adjustment to output from esSIvalue() to avoid round-off error
causing the SI suffix not to be the expected one.  Adjusted the
bounds where each SI suffix is used to keep output in the range of
0.1 to 100, although the boundary is very subjective.  Made a
correction to the extresist code to scan through all device records
for a tile type.  However, (1) there are cases being missed, and (2)
this should not be necessary since all device types should be able
to be known exactly from the contents of the .sim file.  Needs more
work.
2023-03-23 15:38:31 -04:00
Tim Edwards 6dd5f4d7e3 Corrected problem caused by adding a scrollbar to the parameters
window in the toolkit, which was to the "tkwait" command, which
waits for a change in state.  What was intended was to wait for
a change in state to visible only;  once visible, the "tkwait"
command should not invoked or else the process will block.
2023-03-22 15:28:00 -04:00
Tim Edwards 58c6a32a6c Applied patch from Donn that converts strcpy() calls in ext2spice
to "safer" strncpy() calls to prevent string buffer overflow.
Also:  Reimplemented the loop in the GDS write routine that counts
ports and then outputs them in order.  It was possible to hang
magic for a long time by giving a port a very, very large index
number.  The new implementation uses qsort() to sort the ports
by index, which is obviously much more efficient for the worst
case (and efficient enough for all normal cases).
2023-03-21 22:04:30 -04:00
Tim Edwards d8f926865d Modified the behavior of cell reading, mainly with respect to
dereferencing, and making the behavior of "load" on the command
line (i.e., loading a cell from a file) the same as the
behavior of loading a cell as a result of expanding an unloaded
instance.  In both cases, if "load -dereference" is used, and
a cell does not exist in any search path but does exist in the
original location, without dereferencing, then the cell will be
loaded from the original location.  Also:  Corrected an error
that has existed since adding the capability to read compressed
files, which causes magic to crash when attempting to run the
"crash recover" command (because that routine was mixing
compressed and regular file stream calls).
2023-03-20 21:00:35 -04:00
Tim Edwards edb05fb3d1 More corrections to the method of calculating fringe capacitance
inside a halo area.  The previous implementation used a linear
accounting of error to determine the amount of shielding, but
since the shielding is nonlinear, this is a poor approximation
and regularly overestimates the shielding and leads to negative
capacitances.  The corrected method makes many more calls to
the atan() function and the performance impact for extraction
will need to be evaluated.
2023-03-17 13:51:33 -04:00
Tim Edwards e9d434597a Corrected issue with the commit of version 8.3.378, which can
cause a crash when extracting some devices like bipolars with
terminals on different plance.
2023-03-15 14:36:15 -04:00
Tim Edwards a2687d4385 Corrected an issue from the last commit, which is that the default
ground node name (which is static) gets put on the node list and
is improperly deallocated.  Corrected by simply allocating the
string for the default substrate node instead of using the static
string.
2023-03-14 12:53:22 -04:00
Tim Edwards c077e1acef Removed from the "lef" HTML document some mentions of property names
that aren't actually handled by the "lef write" command.  The three
mentions are "LEFsource", "LEFuse", and "LEFshape", all of which
refer to names of pin properties, not macro properties.  These
mentions were probably left over from early work.
2023-03-13 10:18:17 -04:00
Tim Edwards 913c830dee Corrected the extraction of length and width of devices that are
(truly) missing a terminal (such as a MOSCAP made with a gate
extending into but not crossing a diffusion region).  Added the
most requested GUI feature, which is a vertical scrollbar on the
parameterized device window (could be improved by maximizing
window height without exceeding display height).
2023-03-12 16:57:47 -04:00
Tim Edwards e10901e32b Updated the version to go along with the merge of pull request
222 from Sean Cross.  Corrected a few places where the blanket
conversion "Region"->"ExtRegion" picked up some comment lines
that were unrelated to the structure name.
2023-03-10 11:14:23 -05:00
Tim Edwards 5e5879c53d Made a simple but important change to "readspice.tcl" to unexpand
the cell being reworked for port numbering.  Otherwise *all*
labels are selected, which can take a very long time depending on
how many labels are in the layout.  Note:  Need a "select area
ports" function, and better yet, rework the whole label database
so that magic no longer has to run compute-intensive routines
like DBEraseLabelsByContent().
2023-03-08 11:14:22 -05:00
Tim Edwards a8c3117020 Implemented and revised the "CIFhier" property to override the
"cif *hier write disable" and "cif *array write disable" commands
for a specific cell def and its descendents.  The revision ensures
that all descendents apply the override.  The "cif write" command
uses a stack instead of recursion, which makes it difficult to
apply the same method.  Currently the method only works for the
"gds write" command, and implementing the feature for "cif write"
is deemed not worth the effort.
2023-03-07 11:16:49 -05:00
Tim Edwards 73398e7e0b Corrected a buffer overrun situation in ExtBasic.c when printing
the "connected other node to. . ." message when terminals of a
device are shorted.  A long enough node name, especially one
created by concatenating hierarchy when flattening a cell, can
easily overrun the short 256-byte string buffer.  Fixed by
changing strcat() to strncat().
2023-03-05 16:39:58 -05:00
Tim Edwards eb36edf35a Corrected the ext2spice device output for device length, which
somehow acquired a typo which made it write "w=".  Resolves
issue #223 from Mitch Bailey.
2023-02-28 09:34:25 -05:00
Tim Edwards 3da6172706 Modified the "port renumber" command to use (case-insensitive)
natural sort instead of ASCII-based sorting, so that ports that
are numbered arrays will be indexed properly by count.  Also:
Modified the "extresist" handling of substrate to draw the default
substrate type over the entire cell area (less areas of nwell or
other conflicting type).  This allows extresist to extract the
entire substrate as a resistive network.  The result is ugly and
may warrant some aggressive network simplification, but it should
at least be realistic.
2023-02-27 22:22:09 -05:00
Tim Edwards e72f85fd10 Corrected the ext2sim output and extresist to properly handle
2-terminal devices without complaining.  The previous handling
seemed to be technically correct other than spitting out warnings
about missing terminals.
2023-02-24 12:58:46 -05:00
Tim Edwards 7b485efa9b Added code to handle string overflows in property strings. It
might be better to flag a warning, as property strings longer than
the original buffer size of 2048 are probably a bad idea.
2023-02-23 16:44:58 -05:00
Tim Edwards be577d4318 Corrected the reading of the "defaultsidewall" statement in the
tech file "extract" section to work correctly when the offset is
negative.  Generally, a negative offset is nonphysical and is just
curve-fitting round-off error, but the existing code was failing
to divide out the factor of 1000 that had been multiplied through
when reading the tech file, resulting in a very wrong offset.
2023-02-22 15:30:50 -05:00
Tim Edwards d4790d2f31 Corrected the "measure" (Tcl scripted) command to fix an error
when internal units no longer match lambda units.  The text
would match the dimension of the cursor box, but the measurement
lines would be drawn assuming a lambda scale, not the internal
scale.
2023-02-20 16:06:18 -05:00
Tim Edwards c7f11d2169 Important update: Reworked the extraction method to properly
isolate the terminal areas of a device (e.g., source and drain)
and calculate their area and perimeter individually for the
device (in addition to the traditional method of calculating
area and perimeter of each resistance class for the entire node).

Also:  Reworked the SPICE syntax output to generate SI values
in the range 1-1000 with the appropriate suffix (e.g., "20u")
instead of defaulting to "u" for lengths and "p" for areas.
This prevents it from producing weird units like "150000u" when
a process definition already includes a scalefactor.

Reworked the "extresist" code to use the device terminal area
and perimeter.  This fixes an error in which "extresist" would
lose these values and "ext2spice" with option "extresist on"
would generate a new netlist output with zero terminal areas
and perimeters.
2023-02-16 11:59:13 -05:00
Tim Edwards 5fcd4441c1 Corrected the "extresist" command behavior to ensure that
transistor records match between the ".ext" file and the ".res.ext"
file for the number of terminals per device.  Previously, the first
device type for the layer type was always being used, and if it had
fewer terminals (e.g., a MOScap), then one terminal would go missing
in the output.
2023-02-13 10:57:43 -05:00
Tim Edwards adda4092d6 Updated version to go along with the merge of pull request #217 from
Anton Blanchard.
2023-02-02 09:18:22 -05:00
Tim Edwards 1a3caee376 (1) Added a check for unclosed boundaries when reading GDS.
This is diagnostic only and does not change the read-in
    behavior.
(2) ext2spice:  Corrected an error that had been introduced
    into version 8.3.171 that accidentally marks all devices
    as visited which causes all source/drain areas and
    perimeters to be output as zero.
(3) extract:  Sweeping changes to handling of fringe
    capacitance.  Removed the (recently added) "fringeshieldhalo"
    parameter from the tech file.  Reworked the fringe
    capacitance models based on results from the "capiche"
    project (github/RTimothyEdwards/capiche).  Fringe shielding
    is now done by clipping fringe at the boundary of a
    shielding shape, rather than trying to calculate the
    amount of shielding (as the "capiche" project proved this
    to be equivalent).  Values for partial fringing are modeled
    by atan(x), which like the sidewall (1/x) curve, extends to
    infinity and values are limited by the halo but do not
    otherwise depend on the halo.  Because of this, the halo can
    be made variable and controlled by the user for deciding on
    the tradeoff between accuracy and run time.  A new command
    option "extract halo" was added to allow this control over
    the halo distance.
2023-01-27 11:47:37 -05:00
Tim Edwards be59d787a1 Modified the "gds subcell polygon" command option to split into
three types:  "none", "temporary", and "keep" (instead of "true"
or "false").  "none" now reverts back to the original behavior,
because it was found that saving polygons in subcells prevents
them from participating in boolean operations.  The "keep"
option is the original option (polygons kept in subcells), and
"temporary" is the one recently introduced (which puts polygons
in subcells and then flattens them).  This restores the original
method while retaining the recently implemented method.  However,
a proper solution needs to be found that deals with the problem
of boolean operators.
2023-01-17 20:14:38 -05:00
Tim Edwards 05ad386500 Updated the version to go along with the merge of pull request
213 from Anton Blanchard (1. Don't cast pointer to struct and back
again in DBDiagonalProc(), 2.  Fix compiler warning in
drcMaskSpacing(), 3. Fix a few issues in leaDBSearchForTech(),
4. Remove spurious ";" from PlotPS()).
2023-01-16 22:11:15 -05:00
Tim Edwards f06f3b47db Added an experimental option for the cifoutput tech file section to
force magic to scale down the internal grid to the minimum
manufacturing grid size specified in the cifoutput section, upon
reading the techfile.
2023-01-13 17:21:37 -05:00
Tim Edwards ff608b51f1 Updated version to go along with pull requests #208 from
Alessandro de Laurenzis, and pull requests #209 and #210
from Anton Blanchard.
2023-01-08 13:11:06 -05:00
Tim Edwards 6d99e5326e Added a command option "setlabel box" to modify the attachment box
of a label from the command line.  Also fixed a long-standing
irritation that "setlabel" would change the properties of a label
in the edit cell but not in the selection itself, which would
cause the label to be drawn both with the original properties
in the selection and the new properties in the edit cell.  Now
both views will track the same changes.
2023-01-04 14:08:39 -05:00
Tim Edwards 83e17706fe Added handling of mask-hints properties to the flatten-in-place
method to ensure that mask hint geometry is retained when a
cell instance is flattened into the parent cell.
2022-12-22 11:27:37 -05:00
Tim Edwards 0bbb558b94 Reworked the "port" and "noport" label type designations in the
tech file to correct the underlying problem with the SkyWater
sky130 process in which a different layer/purpose pair is used
for TEXTTYPE and DATATYPE for the same layer.  Previously, all
output from magic writes the same pair for both when writing a
port label.  The new method preserves existing syntax, although
there are some differences based on what order the "port"
statement appears relative to other types for the same layer.
2022-12-21 17:49:43 -05:00
Tim Edwards 23b8d08f86 Modified the "load" command so that "-quiet" is promoted to
"-silent", and "-quiet" now produces relatively little output
except for important warnings and errors.
2022-12-19 11:20:50 -05:00
Tim Edwards a0f502501e Corrected the method of "flatten in place" from the previous
commit to prevent port labels from being copied up from the
flattened cell into the parent, and prefixing the instance
name to text in the instance top level so that there will be
no port or label collisions in the parent cell after flattening
the child cell in place.  Also:  Changed "extract dolabelcheck"
to be the default setting.
2022-12-16 12:03:38 -05:00
Tim Edwards 3b396d65f0 Reverted the toolkit change from the last commit after realizing
that the feature for implementing callbacks on a selection list
was already implemented via the add_dependency procedure.
Modified the GDS read to remove cell instances that are placed
directly on top of one another in the same cell.  Modified the
GDS read to make a better selection of a default font size for
text that specifies a font but not a size, using the minimum
width for the layer the text is placed on.  Modified the GDS
read to remove text with empty-string placeholders (created when
a pin layer is read but no text exists to go along with it, due
to GDS not having a specific way to make pins, such that pins
have to be split between one record for geometry and another
for text).
2022-12-15 12:25:23 -05:00
Tim Edwards e5813f51fa Added a new option "-doinplace" for the "flatten" command. This
should have been done a long time ago!  Allows an instance to be
flattened in place inside a cell def, which otherwise requires
a complicated set of commands to do.  Also:  Modified the polygon
handling routine from the previous commit so that it correctly
removes the polygon cell defs after flattening them into the
parent cell.
2022-12-14 12:44:30 -05:00
Tim Edwards 53682af668 Added a new special device model name "Short" which enables the
use of a resistor type as a FET extended drain, allowing the
FET drain node to short across to the other side of the resistor
so that the resistor is absorbed into the FET device.  Used with
the GF180MCU process to describe the salicide-block ESD FET types.
2022-12-13 16:02:49 -05:00
Tim Edwards 86b4ac3e4c Modified the "lef read -annotate" method so that pins are checked
for compatible layout over the area of the pin rectangle in the
entire hierarchy of the cell, not just in the top level.  This
corrects issues where pins are placed in the top level cell with
no metal underneath.  It is written in such a way that it will
work regardless of whether paint is split across the hierarchy,
or the label spans different types (such as crossing a contact).
2022-12-12 14:49:42 -05:00
Tim Edwards 11ddd559b2 Fixed an error with LEF read where duplicate macros are encountered
in the input.  The name of one was being modified but was being
right-justified into the string, resulting in a name starting with
many space characters.  Also:  Fixed an issue with extresist where
a label that ends up with an empty string can become a node with
an empty string name in the .res.ext file output.
2022-12-09 17:31:47 -05:00
Tim Edwards 02bbb1064e Corrected an error in "extresist" that can output an incorrect
number of terminals for devices that don't have the usual gate/
source/drain terminals (e.g., diodes, resistors, capacitors) when
writing the devices with re-mapped terminals into the .res.ext
file.  Also:  Changed the size of the word containing the name
refcount for "equiv" statements, since an accidental shorting
of pins can cause a large number of "equiv" statements in a .ext
file, causing an overrun of the previously 1-byte refcount (this
probably does not make the structure any longer, since it likely
has to fit to a word boundary).
2022-12-06 21:55:01 -05:00
Tim Edwards e5e1e04146 Made a variant of the "directional surround" rule to be able to
implement a GF DRC rule.  This variant allows for a difference
between the minimum allowed surround on one side and the amount
that must be extended on the adjacent side.
2022-11-30 15:33:21 -05:00
Tim Edwards f222004d65 Fixed an error in "lef read" that fails to apply an annotated
pin on a compatible area due to an incorrect type mask.  (Also
note that this routine only works (after correction) for RECT
statements, but there should be a similar check for POLYGON
statements.)
2022-11-29 17:02:36 -05:00
Tim Edwards 01f2ce37b8 Modified the "dereference" behavior so that it does not produce
warnings when rereferencing a layout file as intended.
2022-11-22 11:05:55 -05:00
Tim Edwards 71dffb2fd2 Implemented a method to handle empty subcells that exist because a
library has been read in with the "gds readonly true" option set
because the cell contains information on where in the GDS the
cell is located, but the cell is empty because it was flattened
into the magic view and all of its contents were erased.  This can
cause issues with LVS if magic generates an empty cell into the
netlist and the LVS tool tries to compare the cells by name.  Also,
this prevents unnecessary .ext files and unnecessary merges to the
substrate of such cells (since all cells have an implied substrate).
2022-11-21 17:13:33 -05:00
Tim Edwards 44af9aaf9f Added pin connection to the list of NET connections in a DEF file
when doing "def write", which was missing.
2022-11-20 13:30:19 -05:00
Tim Edwards 65ef9a1ad3 Final (I hope!) corrections to the "def write" command. 2022-11-19 22:02:44 -05:00
Tim Edwards fe89170f5a Small correction to defWrite to cancel a non-default rule when a
wire with default width is encountered.
2022-11-18 21:00:23 -05:00
Tim Edwards f066844761 Substantially revised the "def write" and "def read" routines.
Both were corrected with respect to the definition of non-default
(taper) rules.  "def write" was additionally modified to avoid
redundantly processing tiles where tile areas were merged together
to form a complete wire.  There is plenty of room for optimization,
but the output appears to be matching the layout.  Also:  Revised
the definition of "(not) visible layers" to include labels attached
to those layers, so that turning off visibility of any layer will
also hide all labels attached to that layer.
2022-11-17 20:24:39 -05:00
Tim Edwards 2519d0a4d8 Corrected an issue with readline that breaks the non-Tcl/Tk flow
due to a missing function prototype.  Modified the GDS output
flow to always output instance IDs as a property, not just in the
non-default case.  The property has been used for many years and
appears to be accepted by all tools reading GDS, so there is no
downside to always generating this output.  This has the upside
that default instance names don't get scrambled by going from
magic to GDS and back to magic.
2022-11-11 11:20:34 -05:00
Tim Edwards e37a4f418a Based on output from a large contact array for a pad, modified the
default behavior of magic to make use of the "gds contacts true"
option to output contacts as arrays of subcells instead of
individual boundary entries, as the former is much more efficient
than the latter.  Set the option to be true by default, and set
the "gds flatglob" option to have one entry "$$*$$" corresponding
to the contact subcells created by the "gds contacts" option, so
that GDS reads and writes as it did previously (but using a
different method).  Expanded the method to include "squares-grid"
and "slots" operators (the latter should produce much more
efficient fill pattern arrays).  Implemented for both compressed
and uncompressed GDS.  Tested in all variations.
2022-11-10 14:08:58 -05:00
Tim Edwards f4c5ec3a78 Fixed the DEF write routine, which had an error in identifying
"slivers";  the error tended to produce artifacts (extra metal)
around contacts.  Fixed an issue that caused the DEF write routine
to open the same file twice instead of a new file for the second
part of the DEF data, and then potentially hit a runaway condition
when trying to merge the two files together.
2022-11-09 11:15:06 -05:00
Tim Edwards 2059d6fbb1 Corrected an error in "def write" that starts output on the wrong
layer when the first part of the route is a contact (starts on the
via top instead of the via bottom).
2022-11-08 09:59:43 -05:00
Tim Edwards a9aafebfc4 Corrected the antenna checking routines, which were incorrect with
respect to calculations around diode-connected diffusion regions.
The diffusion area calculation needed to be fixed to avoid double-
counting contacts, and the value for the ratioDiffA coefficient
needed to be scaled, since it is multiplied by the diffusion area
and therefore has dimensioned units of (1/area^2) and should be
treated like all other dimensioned units in magic.
2022-11-06 11:50:05 -05:00
Tim Edwards 3534b79994 Fixed an instance where dbFgets() was used in the "def write"
routine;  that is incorrect, and it should have been fgets().
When dbFgets() is recast to a zlib version, then its use in
"def write" causes magic to crash.
2022-11-03 16:15:36 -04:00
Tim Edwards 0dac37cb46 Changed the behavior of GDS writing to halt with an error if an
attempt is made to write an abstract view to GDS.  This behavior can
be overridded with the new command option "gds abstract [enable|disable]".
Also:  Corrected extraction to allow split tiles to be set as the
reference tile for a node.  Previously this was allowed only if the
tile was the first to be searched, but that can cause different tiles to
be marked as the reference depending on where the search starts,
resulting in different names for the same node in .ext files, which is
bad.  Also:  Modified the LEF annotation to avoid bad entries in the LEF
that would create layers in the layout where none exist.
2022-11-02 09:40:20 -04:00
Tim Edwards d229aefb15 A handful of changes after applying pull request #191 from
Alessandro De Laurenzis.  That pull request cleaned up the vast
majority of compiler warnings.  However, that cleanup exposed a
few additional warnings pointing to errors in the code that needed
fixing.  The code now compiles cleanly except for one warning
about redefined CAD_DIR that I have not looked into.
2022-10-29 09:57:41 -04:00
Tim Edwards 9d40fbfecb Corrected an error in parsing the "defaultperimeter" statement in
tech files which incorrectly parses the syntax using five
parameters.  This syntax variant does not get used often, which
is why the error went undetected for a long time.
2022-10-22 22:12:15 -04:00
Tim Edwards 94daf986ab Corrected the GDS write for "boundary" to make sure that the
calculation of the area to check for output and the clip box
does not reduce the size of any layer associated with the
fixed bounding box declared by the FIXED_BBOX property.
2022-10-18 14:14:22 -04:00
Tim Edwards eecdc3c642 Added a "flatten -doproperty" command option that allows selective
flattening based on cells which have a property "flatten".  Also:
Modified the DEF read and write to convert DIEAREA into a
FIXED_BBOX property.  This solves issues with placing of components
from DEF, when those components may not have have come from place &
route and may not have P&R bounding boxes.  Also:  Fixed the
documentation for the "dump" command, which was missing the optional
orientation in the description.
2022-10-15 11:33:59 -04:00
Tim Edwards bc5093502c Corrected a small error in "extract unique" that will attempt to
run free() on a memory location that was never allocated.  This
error has no effect on anything, but correcting it prevents magic
from issuing a mysterious warning.
2022-10-07 08:43:49 -04:00
Tim Edwards 189d62da9b Corrected a really stupid error which prevented the "extract
unique notopports" from working.  Fixes issue #186 reported by
Mitch Bailey.
2022-09-28 17:45:28 -04:00
Tim Edwards 65b54e0cd5 Corrected a stack corruption error (that I have never seen in
practice but which was detected by AddressSanitizer.  Also
corrected a crash condition in the absence of a window;  also
hard to reproduce.
2022-09-27 10:43:04 -04:00
Tim Edwards a550d615c0 Made some modifications to the "def write" command: It now handles
non-default rules and so can accurately capture wire widths other
than the technology LEF defaults (also corrected a bug with non-
default rules for "def read").  Corrected via handling in "def
write" to function as claimed (although the algorithm is still
naive and expects all contacts to be rectangular, which is usually
true but doesn't have to be).
2022-09-23 15:02:22 -04:00
Tim Edwards 82c79b36ee Added a check for unfortunate values of a MAG record in a GDS text
record.  Failure to use the right 8-byte real format can produce
bizarre results where a label's bounding box ends up in some random
place and messes up an entire top level circuit's bounding box.
2022-09-19 17:26:42 -04:00
Tim Edwards 7905e15ae3 Enhanced the "def read -annotate" option to correctly annotate pins
with class, use, and shape information from the DEF file PINS record.
This is similar to what is done with LEF file annotation, but less
sophisticated (only erases an existing pin if it is an exact match
for pin name and location).
2022-09-14 13:02:55 -04:00
Tim Edwards 1c20abad5b Updated the version with the last commit, which was supposed to be
done yesterday and so shouldn't have needed a version update.
2022-09-08 11:13:25 -04:00
Tim Edwards 4087ac2dba Added a prototype function for DBDescendSubcell(), without which
the return value is cast to the wrong size and all calls fail.
2022-09-07 15:27:11 -04:00
Tim Edwards 63b9590958 Updated version to go along with the merge of pull request #181
from Brad Smith, for OpenBSD compatibility.
2022-09-04 12:48:42 -04:00
Tim Edwards 4afc476d92 Modified the "element" command so that coordinates may be given in
physical units (e.g., um).
2022-09-01 17:58:30 -04:00
Tim Edwards 5d51e10fb9 Corrected an error with perimeter calculation of a device that was
caused by other code that can move the plane of a device to match
the plane of a port.  Solved by retaining the original plane of the
node in the extTransRec structure, and using that to determine the
device plane for purposes of calculating perimeters and not double-
counting contacts.
2022-08-30 10:13:18 -04:00
Tim Edwards eed9882bf2 Modified the handling of GDS library names to avoid creating cells
with slashes in the name (picks up the text after the last slash).
Also allowed the "gds library" command option to modify the
behavior of "gds read" (previously only affected "gds write") to
indicate that the GDS file is a library and that there are no top-
level contents, only subcell definitions.  Also:  Corrected a typo
from yesterday's commit that prevents magic from compiling (oops).
2022-08-26 08:59:25 -04:00
Tim Edwards 2561afd402 Implemented the correction of Anton Blanchard's git pull request #180
"Antenna checker should ignore vias in partial mode".  I changed the
implementation by moving the correction into the antennaAccumFunc()
subroutine so that it skips the area calculations for the contacts,
avoiding unnecessary computation.  Otherwise, it's the same (vias
do not contribute to the surface area of the antenna when calculating
antenna area in "partial" mode).
2022-08-25 11:03:56 -04:00
Tim Edwards f45f3c96e5 Updated version to go along with the merge of pull requests 175 and 176
(OpenBSD/NetBSD/DragonFly support), and a change to the wrapper to allow
manual override of the number of icon columns (because sometimes some
window managers are clueless about the correct window dimensions).
2022-08-22 12:20:59 -04:00
Tim Edwards f7df5e7c86 Added an option to "def read" to avoid creating obstructions from
"BLOCKAGES" statements.
2022-06-24 15:22:53 -04:00
Tim Edwards 43d5cc2804 Added a quick check on cell defs when running "antennacheck" to
make sure that the cell def's .ext is not marked "abstract".
Otherwise, "antennacheck" appears to run, but no output is
produced, and no reason is given.
2022-06-20 12:26:23 -04:00
Tim Edwards 2b7b12d34c Added a catch for a node named "(none)" in a merge line. This
prevents magic from crashing but does not do anything about the
fact that a non-existent node ended up in the .ext file, which
will have to be investigated.
2022-06-16 19:54:21 -04:00
Tim Edwards bb9b9660e7 Updated version to go along with the merge of pull request #169 from
Matt Guthaus.
2022-06-14 08:55:43 -04:00
Tim Edwards 085131b090 Modified the handling of polygon cells when writing GDS; if a
polygon cell has been created with the "gds polygon subcell"
option and the parent cell is read-only (vendor GDS), then the
polygon cell does not actually exist in the original GDS and
should not be output during a "gds write".
2022-06-09 11:44:58 -04:00
Tim Edwards d099562e85 Fixed two issues: (1) Found a backwards-incompatibility with the
fringe capacitance halo where the default halo distance was set to
zero instead of one and caused divide-by-zero issues;  (2) Found
extraction issues where labels picked up from cells flattened
during GDS reading cause the flattened/emptied cells to show up
in the extraction with extra pins that can mess up LVS.  Solved
this by removing labels from flattened/emptied cells.
2022-06-08 16:02:40 -04:00
Tim Edwards bcf35db713 Working through various issues with parasitic capacitance extraction
using the newer methods for nearest-edge searching and fringe area
of effect.  Removed a same-net check in a routine that removes
capacitances that are redundant due to hierarchical overlaps;  these
redundancies must be checked on shapes within the same net.  Corrected
(again) an out-of-clip-bounds check.
2022-06-04 08:16:50 -07:00
Tim Edwards 8d985ea766 Corrected an error in the fringe area calculation that was supposed
to be ignoring geometry outside the area of the halo, but wasn't.
2022-05-31 22:45:46 -04:00
Tim Edwards bbcc05c004 Corrected a (very bad) accidental deletion in the last commit that
causes the compile to fail.
2022-05-29 21:20:32 -04:00
Tim Edwards c001de3d9d (1) Corrected an error in generating GDS_FILE properties when
reading GDS files, caused by an unneeded change to pass both
the "original" filename and the actual filename when handling
compressed files---The original filename is unneeded.
(2) Implemented several new methods for parasitic extraction.  The
first is an option offset value to apply to sidewall calculations.
This handles issues where actual wire separation is different
from drawn wire separation, which can be significant for the
1/d calculation of sidewall coupling.  The second method is to
use the recently-added fringe halo to compute the coupling of the
fringe capacitance to nearby wires.  Prior to this change, all
fringe capacitance was applied to surfaces directly under a wire
edge as if the fringe capacitance did not extend outward from the
edge.  Now the capacitance is properly pro-rated for the position
of any overlapped shape inside the fringing field.  Finally, the
third method added is a new search algorithm for finding the
nearest shapes along the length of a boundary.  This is used for
sidewall coupling and fringe shielding, where the nearest shape
dominates the coupling, and any shapes behind are shielded and
may (to first order) be ignored.  Previously, the entire halo
was searched without regard to shapes shielding other shapes
behind, and a recent correction added an ad-hoc search for
blocking shapes that was inefficient and not always correct.
The new method is both efficient and accurate.
2022-05-28 10:33:21 -04:00
Tim Edwards 4f5e1aec6b Corrected a typo in the new sidewall coupling shield check that
will cause an infinite loop during extraction.  Fixes issue #166
on the github issue tracker.
2022-05-18 09:26:00 -04:00
Tim Edwards f5382b824c Updated the version because the github mirror was copied earlier
today due to the critical fix for the compressed GDS file code.
2022-05-12 17:36:28 -04:00
Tim Edwards b643f44659 Modified the configure script to allow zlib compression to be
disabled from the configure command line.  Corrected an error with
the non-zlib-enabled compile.
2022-05-12 09:27:32 -04:00
Tim Edwards 93c96c23a1 Corrected an error in the new zlib GDS reading code that missed
changing the "rewind" function to "gzrewind", causing a crash when
a GDS file has to be re-read due to out-of-order contents.
2022-05-11 12:38:05 -04:00
Tim Edwards 371018ae4b Implemented native gzip compression/decompression using zlib routines.
Compression levels of the output can be controlled with the "gds
compress [<value>]" command, where <value> 0 (default) is uncompressed
output, 6 is "normal" gzip compression, and 9 is maximum compression.
2022-05-10 09:19:39 -04:00
Tim Edwards 6e0768ebd4 Removed the "-k" option from "gunzip", which is not only redundant
with "-c" but is unsupported on some OS versions of gunzip.
2022-05-09 15:27:51 -04:00
Tim Edwards 85d8ad6622 Added the capability to handle compressed GDS files through the use
of systems calls to "gzip" and "gunzip".  A compressed GDS file can
be made simply by doing "gds write <name>.gds.gz", and can be read
simply by doing "gds read <name>.gds.gz".  Names of compressed files
can be put in the GDS_FILE property of a cell.
2022-05-05 17:40:56 -04:00
Tim Edwards e00633b8a1 Corrected an issue in the extraction where a region could be set to
a split tile type, causing a crash if the node name had to be
discovered by a "hard search".
2022-05-04 12:00:09 -04:00
Tim Edwards 99384a63c7 Still recovering from unintended consequences of setting EditCellUse
to NULL for a read-only view. . .  Changed the command "what" so that
it will not fail on a non-edit cell.  There are likely a few other
commands that should not fail on non-edit cells because they do not
alter anything.
2022-05-03 18:03:27 -04:00
Tim Edwards f760b038d6 Updated VERSION to go along with the merge of pull requests 160
and 161 from Donn, and modified one of the files from PR 161 to
maintain typographic consistency.
2022-05-03 08:32:00 -04:00
Tim Edwards fcc884332b Made some corrections to the "extresist" code to avoid issues with
extracting a port-to-port net that does not touch any devices.
The error happens in a fairly rare set of cases.
2022-05-02 12:27:39 -04:00
Tim Edwards fe2eb6d390 Modified the file locking behavior so that the command "locking" is
recognized as a valid command when file locking has been disabled as
a compile-time option.  The command then generates an error on
"locking enable" but simply ignores the command "locking disable".
2022-04-25 13:23:29 -04:00
Tim Edwards 55128d3437 Updated version. 2022-04-20 16:18:31 -04:00
Tim Edwards 30ab57ee79 Found a problem with the calculation for the non-Euclidean grow/
shrink routine that over-computes the diagonal position (the
equation failed to divide the intersecting angle in half).
Rewrote the equation for the correct grow distance, still
accounting for the grid limit (if set).
2022-04-19 18:20:58 -04:00
Tim Edwards 7b08d16542 Updated version to go along with pull requests 155, 157, and 158
from Ryan Schmidt.
2022-04-13 08:35:41 -04:00
Tim Edwards eb1e94f440 Corrected issue with extresist that involves a device with a
terminal connected to a substrate or well type that is not a
FET 4th terminal (e.g., a varactor, or maybe a diode).
2022-04-12 17:41:17 -04:00
Tim Edwards 9402b0dcdd Added a new command option "contact erase". This provides a way to
remove contact cuts from a layout without affecting the surrounding
metals, which is something that the "erase" command does not do.
2022-04-07 11:10:24 -04:00
Tim Edwards 44df4fc125 Corrected another instance where running a command on a non-
writeable cell causes magic to crash.
2022-04-06 08:38:25 -04:00
Tim Edwards ff10aedf69 Added a prototype declaration for LefReadLayerSection (see github
issue tracker issue #154).
2022-04-05 09:50:36 -04:00
Tim Edwards 7199cefddc Found that ExtFindRegions() does not set temp_subsnode to NULL like
extFindNodes() does;  consequently, ExtLabelRegions() when called
after ExtFindRegions() may accidentally chain together a substrate
region with whatever was left in this linked list after the
previous call to extFindNodes(), with unpredictable results.
2022-04-04 21:16:03 -04:00
Tim Edwards 37fec8a06a Tentative implementation of parsing NONDEFAULTRULE definitions in
a LEF file (complementary to the implementation recently added to
the DEF file parser).
2022-03-31 10:23:39 -04:00
Tim Edwards e675decfc0 Cleaned up a bunch of stuff around "magicdnull", starting with not
linking it to Tk or X11 graphics.  Added new command "display" which
returns the display type, which is good for finding out if the
display is "NULL".  Added code to allow the wrapper to be defined
for NULL graphics with the Tk console, the main necessities of which
are to remove the "openwrapper" command, and to return immediately
from a number of tag callback functions.
2022-03-30 10:55:08 -04:00
Tim Edwards 0c584f9e77 Modified the configure scripts and makefile per Proppy's comments
in github issue #149.  This causes magic to no longer write log files
for "make" and "make install" but will properly exit with a non-zero
return code on any error during compile.

Also:  Corrected the command "tech drc surround <type1> <type2>" so
that it now returns the correct value when <type1> and <type2> are in
the same plane.  Added new command "tech drc directional <type1> <type2>"
which works the same way as "tech drc surround" except for directional
surround rules.  Used this to generate vias from "def write" with the
correct metal surround amounts included in the via definiton.  The
route analysis then ignores tile slivers that make up the surrounding
material around contacts.  Also implemented a method that handles
routes that are made of multiple thin tiles due to the maximum horizontal
stripes rule.  Now magic handles "def write" well except for not dealing
with non-minimum-width routes unless they're specifically called out as
"special" nets.
2022-03-29 16:52:01 -04:00
Tim Edwards 3b44dacab5 Corrected a minor issue in "def write" that will ignore a wire
completely if the width does not match the wire minimum width,
rather than attempt to cope with it gracefully.
2022-03-28 22:34:12 -04:00
Tim Edwards 84fbaa4ee1 Updated version with the offset fix. 2022-03-25 21:40:40 -04:00
Tim Edwards cf39fb102c Fixed some errors in DEF read/write and added behavior to "def write"
to treat unlabeled/unconnected layout as blockage statements in the
output.
2022-03-24 17:58:05 -04:00
Tim Edwards 59b68606e0 Corrected the equations for fringe shielding, as the equation for
the shielding fraction was inverted---I do not know how the tests
could pass that way.
2022-03-23 10:49:02 -04:00
Tim Edwards a205a0e941 Corrected a potential segfault condition on "extract" if a cellname
contains slashes (which makes it look like a full path).
2022-03-21 09:06:35 -04:00
Tim Edwards d98645afc1 Added an important new method: If the keyword "fringeshieldhalo"
is specified in the extraction section of the techfile, then magic
will compute the effect of a nearby shape partially shielding the
sidewall overlap capacitance, which approaches 100% shielding as
the shapes converge to zero separation.  This method prevents
magic from vastly overestimating the fringe capacitance of closely
spaced wires, which was magic's worst problem with parasitic
accuracy.  The "fringeshieldhalo" value is the distance at which
the fringe shielding becomes negligible.  Typically, it will be
about three times the distance at which half the fringe value is
shielded.  It may be necessary at some point to make both the
fringe shielding halo and the sidewall halo values per-type values
(or per-plane, at least).  For now, it should suffice to bring
Magic's parasitic extraction back in line with other tools.
2022-03-17 17:35:41 -04:00
Tim Edwards 083c0c10e9 Modified the routine that flattens labels so that it does not prepend
the name of the cell use if the cell use is a top level window.  It
was accidentally discovered that using "select top cell ; select flat"
will do this (creating label text with spaces in the process, which is
illegal syntax for netlists).
2022-03-08 13:55:07 -05:00
Tim Edwards 353ca3aff6 Corrected the (recently implemented) "labellayer" GDS/CIF output
function, which was incorrectly multiplying through by two scale
factors, resulting in incorrectly-placed labels in the GDS output.
2022-03-07 11:44:30 -05:00
Tim Edwards 47df9da0d3 Debugged an issue where a label on the default substrate node may
not be seen during hierarchical processing, causing the substrate
to get split into several names that may conflict in the netlist.
At issue is the fact that ExtLabelRegions() will not attach a
default substrate label to a default substrate region.  This may
need further untangling, as extFindNodes() will set the default
substrate node and is sometimes followed by ExtLabelRegions(),
which will label it.  Any place ExtFindRegions() is called, this
could be an issue.
2022-02-26 17:39:36 -05:00
Tim Edwards bae5d9cd06 Added a command-line option "magic --commit" which provides the commit
number from the git repository, which is overall more reliable than
the version number, but mainly to support a common method across the
open source tools for providing information to builds like open_pdks
that may need to know what version of every tool was used for the
build.
2022-02-25 09:56:22 -05:00
Tim Edwards db4fa65bfc Corrected some issues related to the handling of substrate hierarchy.
Most of this had to do with the incorrect use of the parent's substrate
name in extHierSubstrate().  After the correction, there still remains
an issue that is caused when a labeled isolated substrate region overlaps
an extraction tile boundary.  I believe that this particular error has
existed for some time and is not new, so I am committing these changes.
2022-02-24 16:47:11 -05:00
Tim Edwards 505155497e Resolved an issue with magic crashing during "antennacheck" due to
a routine that should have been called with a NULL argument, but
instead was called with no argument, making the behavior system-
dependent.  Revised the parsing of the "defaultareacap" and
"defaultperimeter" statements in the tech file, such that the short
version of both statements gets automatic handling of the substrate
and isolated substrate areas;  this goes back to the recent change
in extraction behavior to redefine the "substrate type" (e.g., pwell)
during extraction as defining isolated substrate areas, and not the
default substrate.  The earlier code change dealt with problems
related to extracting nodes and regions, but did not consider how
parasitic capacitance was affected.  This commit resolves that issue.
2022-02-23 15:02:40 -05:00
Tim Edwards f8390b78f8 Tackling a section of code with poor performance in extraction.
The extSubtree() routine cuts a layout into squares and extracts
each separately, checking for subcell interactions.  In each
square it parses all labels looking for unconnected ones.  This
section of code not only parses all labels M x N times, but it
then marks interaction areas where there may be none, forcing
additional unnecessary processing.  This commit makes the first
quick optimization, which is to change the return value of
DRCFindInteractions() from boolean to integer, allowing it to
return a value indicating that there are no subcells in the
area.  This prevents the loop through labels from happening in
cases where there can never be interactions.  More to come.
2022-02-20 17:36:49 -05:00
Tim Edwards 2e99d0cff7 Changed the behavior of "extract" routine extFindNodes() to not
check for abstract views to determine how to handle the substrate
node.  Running tests to check if this has any negative impact on
the extraction of abstract views that do not specify substrate
and well types.
2022-02-17 11:27:43 -05:00
Tim Edwards f23aec37b9 Corrected the "select flat" command, which failed to recompute the
selection bounding box, causing all following commands to fail to
handle anything in the selection outside of the unit area (0, 0) to
(1, 1).
2022-02-16 11:28:06 -05:00
Tim Edwards 3a758912c4 Corrected a small issue in the "property" command that will attempt
to free memory from location 0 if the cell is not editable.
2022-02-15 12:01:11 -05:00
Tim Edwards 6ecd077ab4 Restored compiling of the non-Tcl/Tk version of magic. This has
traditionally been kept for backwards compatibility.  However, the
operation of "ext2spice" and "ext2sim" as separate programs has
become extremely difficult to maintain, and so it has been dropped
in favor of folding both into the program as commands, as was done
a long time ago in the Tcl/Tk version.
2022-02-08 16:12:07 -05:00
Tim Edwards 113f0dfb3f Applied the same method as used in the last commit, to put all
cell properties in natural sort order when writing a .mag file.
This should remove the last bit of indeterminism in the output
of magic database files.
2022-02-01 11:58:11 -05:00
Tim Edwards 750ad12677 Updated version (after pulling last commit). 2022-01-31 15:33:56 -05:00
Tim Edwards ea80e30a8e Applied a string sort to the dump of cell uses when writing a .mag
file.  This makes the output of .mag files deterministic (except
possibly for properties, which may also need to be handled this
way).
2022-01-31 15:30:24 -05:00
Tim Edwards ee1d1ae5b0 Corrected an error in LEF write in which sticky labels that declare
the label to be attached to a non-contact type when the label is
actually over a contact are not handled correctly when checking if
multiple labels should belong to the same port record.
2022-01-24 17:19:13 -05:00
Tim Edwards e1aedc6f41 Decided that a different approach needed to be taken for having
timestamps that are fixed, since the timestamp update routine is
called from too many places, too many times.  Instead created a
new cell definition flag indicating a fixed timestamp, which can
be set by "cellname timestamp" for an individual cell, or with
"gds datestamp" for cells read from a GDS file.
2022-01-22 11:18:32 -05:00
Tim Edwards 5629c2a6cd Changed the "gds nodatestamp" option to "gds datestamp" and added
"gds datestamp <value>" as an option to force a specific datestamp
on the GDS output.  This is a third option beyond the previous two
which were either to use the current time or to write zero.  The
new option allows an entire library to get a common timestamp, for
example, related to a PDK version number.  The "gds nodatestamp"
option has been retained for backwards compatibility.
2022-01-21 10:26:29 -05:00
Tim Edwards c2755a061f First cut at a method to automatically generate mask hint properties
in a cell to account for the difference between what's in an input
GDS file and what magic would write out itself from the processed
data.  This potentially allows library cells to be read in that
will generate the equivalent mask data as output without resorting
to using GDS file references as properties.  The method is activated
with the new command option "gds maskhints on" and the default is
off.
2022-01-20 21:50:13 -05:00
Tim Edwards 10c5ba99c9 Corrected an error in the hierarchical GDS processing of mask hints,
which failed to translate hint coordinates from subcells into the
composite cell, resulting in hierarchical GDS errors.
2022-01-19 15:37:45 -05:00
Tim Edwards 453d276f20 Cleaned up a bit of confusing diagnostic output when reading GDS.
If cells are instanced before being defined, causing the GDS parser
to rewind the cell from the top, then the "already defined" error
messages will be suppressed, since it is to be expected that cells
will be seen twice (and ignored the 2nd time).  When rewinding, an
output message is issued so that it is clear that the file contains
instances that are used before they are defined, and recommends the
"gds ordering on" setting.  Also:  Fixed the "gds ordering" command
code so that the command with no third argument returns the state
of the "gds ordering" setting instead of generating a parser error.
2022-01-14 11:07:08 -05:00
Tim Edwards b68744a944 Made a change to basic extraction to avoid generating an extra
node representing the global substrate on cells that are abstract
views.  Corrected a typecasting issue in ext2spice.c that throws
a compiler warning.  Added another check for a cell being editable
when painting, which is a case that was not covered by the
previous code change to address the same issue.
2022-01-13 12:56:20 -05:00
Tim Edwards b5f2b75768 Removed code from ext2spice that is no longer functional.
Implemented a separate check for ports when writing a subcircuit
that cross-checks against the port list in the flattened
extraction.  This allows ports that were optimized out during
flattening of the hierarchy to be removed from the cell's port
list, which cuts down on disconnected nodes in the output port
list.
2022-01-12 15:30:07 -05:00
Tim Edwards 940a18efab Updated the version to go along with the merge of several pull
requests (117, 118, and 119) from Anton Blanchard.
2022-01-10 14:05:34 -05:00
Tim Edwards f89d52dbcc Modified the short selection routine (again) to avoid issues when
tracing the short path back through stacked contacts.  Discovered
a problem with the connectivity search routine (which has been in
the code for a very long time) which will fail to copy contacts
to the selection cell if it has already drawn one of the metal
layers in the same place.  This has now been fixed.
2022-01-06 13:29:43 -05:00
Tim Edwards 2fc0e669b6 Some optimizations on the "select search" function. Mainly this
stops checking for the "best" path during the feed-forward check
and only enumerates the cost function for every tile in the
selection, moving outward from the source.  This keeps the
algorithm efficient.
2022-01-03 17:49:54 -05:00
Tim Edwards 1fceef6acd Corrected the last commit's problem with file locking, which is that
there was no distinction between a locked file and a new cell
(initial state) before writing to disk.  This prevents any new cell
from being saved!  Also:  Revised the behavior of the "select short"
search, but this still has issues with long run-times on complex
layouts, so this is an ongoing effort.
2022-01-03 16:00:31 -05:00
Tim Edwards 6a78f4967e Updated the version to go along with pull request #115 from github
user susinxy.  Edited the merged code slightly, without changing
the functionality.
2022-01-01 13:24:18 -05:00
Tim Edwards 271449128a Updated the way that the technology file parser handles the
"defaultareacap" and "defaultperimeter" statements in the technology
file.  Now, the parser makes use of the configuration of the
substrate from the "substrate" line to generate a default list of
which types and planes represent the substrate, and which types and
planes represent shielding to the substrate.  This solves an issue
with the use of substrate isolation layers (e.g., "isosub" in
sky130A), because its definition and usage created substrate shields
on two planes (well and dwell), while the syntax for "defaultareacap"
and "defaultperimeter" only allow one shielding plane to be defined.
2021-12-31 11:13:59 -05:00
Tim Edwards be5b6dec0c Updated version to go along with the merge of pull request #113
from Brad Smith.
2021-12-30 09:26:38 -05:00
Tim Edwards 6adcd2dc74 Updated the version to go along with the merge of pull request
112 from Brad Smith.  Also ran autoconf, since change was made
to configure.in and the standard instructions don't call for
autoconf to be run.
2021-12-29 21:06:48 -05:00
Tim Edwards 9af44230eb Removed an oddball method put into the extflat code some time ago
that makes a net a global net if there is a Tcl variable of the
same name.  This conflicts with a later use of Tcl variables VDD
and GND to denote power and ground names, which is a completely
different usage.
2021-12-25 16:14:37 -05:00
Tim Edwards 86f7c1f2cf Corrected the return value of extSubsFunc2(), which was returning
value 1 after finding a substrate connecting type shielded (by deep
nwell, in the example) from the substrate, thus preventing the
search from processing any remaining substrate types.  Solved by
changing the return value to zero to keep the search going.
2021-12-23 16:31:34 -05:00
Tim Edwards 716848067e Made a few corrections that stem from the change to add a separate
record to the label structure to hold the port number.  One major
issue stemming from this was reported in github issue #203 by Anton
Blanchard.  This commit fixes that error.
2021-12-22 12:08:34 -05:00
Tim Edwards ea414c822d Got to the bottom of why area and perimeter values are no longer
output for transistors.  The problem came from a change made to
fix an issue with capacitors marked as floating nodes because some
nodes are not output as source or drain.  But those nodes are output
before the parameters, so when generating parameter output, all
nodes appear to have already been output.  Solution:  Specify an
additional bit in the "visited" mask for the node having been output
that is separate from the mask for resist classes used by the code
that writes parameter values, and use that bit as a test for whether
the node is connected to some device (not necessarily a FET source
or drain).
2021-12-20 13:12:49 -05:00
Tim Edwards 859879ce5d There being a specific situation where the enumeration of ports
used by "topVisit" and "subcktVisit" in ext2spice.c, probably
caused by having different names on the same port number, the
subcktVisit() routine was modified to use exactly the same
enumeration as topVisit() so that they are guaranteed to have
the same result.
2021-12-13 11:33:02 -05:00
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 552d6de0f7 Modification to prevent crashing on an attempt to do an area erase on
a read-only layout.
2021-12-07 14:25:50 -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 bfdf1227a7 Modified the "extract unique" behavior so that it treats "soft"
connections through the substrate as the same node, and so will
not force different nodes names on the soft connection to be
unique.  This should probably be selectable behavior.  However, as
written, the "extract" command will always merge soft connections,
so giving them unique names just causes problems with "extract".
2021-12-04 15:04:01 -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 65747132a0 Added behavior for reading cells with or without "-dereference" to
work around the issue of loading a file containing references to
cells with the same name as cells already loaded.  This is probably
going to cause additional headaches until a proper checksum method
is implemented.
2021-11-30 12:17:21 -05:00
Tim Edwards d43013048d Corrected a recent line change to return "0" instead of void, per
github Issue #104 by lantertronics.
2021-11-29 17:57:18 -05:00
Tim Edwards 8957d4b947 Slightly modified various use cases of "cellname" so that they
behave as one would expect;  e.g., "cellname self" returns the name
of the currently edited cell if nothing is selected;  "cellname
rename <name>" renames the currently edited cell to <name>.
Modified the "extract" command so that it will not extract a cell
named "(UNNAMED)" but will insist that the cell must be given a
proper name, much like the "writeall" command does.
2021-11-25 12:40:51 -05:00
Tim Edwards 6b72a51b17 Fixed a segfault condition if doing "splitpaint" on a zero-area
rectangle.  Likewise, this also fixes an unexpected result when
doing "spliterase" on a zero-area rectangle (which does not cause
a segfault, but is not what one would want magic to do).
2021-11-24 10:00:15 -05:00
Tim Edwards a6e57093f8 Realized a very stupid error in the handling of the "use" lines
when reading in a .mag file.  The routine was not checking for
whether a "use" entry in the file was the first one encountered
or not.  The path is only ever given for the first use of any cell
def, so for any cell after the first, the path should have already
been resolved.  This fix avoids lots of unnecessary error messages
when reading a file in a different directory.  Also, because the
routine now checks for the first use in a file, any error messages
that do occur will only be displayed for the first use, not all of
them.
2021-11-20 20:54:51 -05:00
Tim Edwards 73bad08457 Updated the version to go along with the merge of pull request
the existing coding style.
2021-11-17 09:12:47 -05:00
Tim Edwards e8eb96103d Modified the Euclidean distance "grow" operator so that it honors
the grid limit setting.
2021-11-16 09:59:23 -05:00
Tim Edwards 898783467c Corrected the "lef write" routine to more correctly handle port
statements, with all "hard" connections being enumerated in the
same PORT entry, and "soft" connections (same label on unconnected
areas;  e.g., through substrate or resistor device) being
enumerated as separate PORT entries, per the LEF spec.  Also
corrected behavior with respect to the "lef write -toplayer"
option, which was treating each port label independently, and so
generating entries for lower layers of a port if there were ports
on those layers, in contravention to the "-toplayer" option.
Also:  Added the PINS section to the "def write" output;  this had
been left as a "to be completed" item but was never done in spite
of being easy to add.
2021-11-12 11:34:16 -05:00
Tim Edwards 3afc462cac Removed the dependence on EXT_DOLABELCHECK when generating node
entries for "floating" labels.  Otherwise it is possible for the
hierarchical checks to find the label in flattened geometry and
reference it, resulting in merge statements in an .ext file that
reference undeclared nodes, ultimately resulting in extflat
failing to perform the merge, and an incorrect netlist.
2021-11-11 10:01:05 -05:00
Tim Edwards f6695cea52 Added an error message when writing GDS if any cell being written
still has the default "(UNNAMED)" cell name;  this is not strictly
an error, but is almost certainly not what the user intended.
2021-11-08 10:25:38 -05:00
Tim Edwards 9af83abfe5 Updated version with the previous commit. 2021-11-05 12:17:10 -04:00
Tim Edwards c0ea133e98 A recent commit caused connections to implicit (unlabeled) substrate
to not get into the subcircuit port list during ext2spice.  The new
fix brings back (unfortunately) the behavior of creating a substrate
node for cells that have no substrate connection to any device;
this will have to be handled separately.
2021-11-03 17:34:38 -04:00
Tim Edwards 3e07197dfa Adjusted LAYERS_PER_CONTACT from 3 to 4. This is not a preferred
solution;  it would be much better to make the value adjustible, but
the array of tiles sized to LAYERS_PER_CONTACT is a Region structure,
and the routine that frees the Region structures does not have a way
to call a routine to take additional measures like free'ing a sub-
structure of the Region.  A proper solution will require some work.
2021-11-01 09:26:21 -04:00
Tim Edwards c82c96cb73 Added checks to prevent magic from crashing when running various
commands on selections in a cell that is not editable.  Moves
and Copies were already handled correctly;  this correction fixes
Delete and transforms (e.g., rotates and flips).
2021-10-28 15:57:17 -04:00
Tim Edwards 34af2f3309 The "extresist" command was still generating "Couldn't find wire"
messages which was traced to code that changes a drivepoint position
to match a label;  the same drivepoint may be part of the record for
the initial position to search on the net, in which case if the
position is changed, then the tile type needs to be changed to match
the new position.
2021-10-11 10:18:27 -04:00
Tim Edwards bb8f7e6960 Revised the routine ResSortByGate() in ResRex.c so that it sorts
using qsort() instead of its own linked-list-based sorting, which
is horribly inefficient.  This change allows power nets (which
tend to be connected to all transistors) to be extracted in a
reasonable amount of time (hours instead of days).
2021-10-10 19:20:24 -04:00
Tim Edwards 2f7813094b Implemented glob-style matching for label selection. Introduces
an optional extra argument to the "select" command that can be used
to select labels by glob-style matching;  e.g., "select area labels
VSS*" or "select less area labels *_1".  This will help in managing
labels after flattening a standard cell design;  e.g., by using
"select less area labels */VDD".
2021-10-09 13:44:04 -04:00
Tim Edwards 537b1f057d Modified the generation of "equiv" statements in "extract" some more,
to eliminate all redundant names resulting from redundant labels.
Changed the behavior of "goto" so that it will find local names with
slashes, which are the result of using "flatten".  A hierarchical
search is done first, as before, but on failure to find a subcell
component, the local cell is searched for the verbatim name.
2021-10-08 10:58:10 -04:00
Tim Edwards 083ef458a8 Update of version with the fix to the last commit. 2021-10-08 09:36:51 -04: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 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 52a424e511 Added another option to the "extresist" command, this one to include
specific nets to extract, rather than excluding them.  That allows
"extresist" to target specific nets like the power supply or a clock
tree for extraction.
2021-10-04 15:32:37 -04:00