Commit Graph

195 Commits

Author SHA1 Message Date
Tim Edwards fdcc178bcd After a discussion about "cifinput" rules, realized that there is
no way to implement boolean operators on labels, so any "label"
statement in the section can apply only to one magic layer.  This
is regularly violated in most (all?) techfiles (due mainly to lack
of explanation and guidance).  The addition of the "no-reconnect-
labels" option for cifinput made it worse, as it can cause a label
to be attached to the wrong layer and be stuck that way.  Even
without the option, an attachment to a non-connecting type is a
problem;  DIFF cannot simultaneously have a connection to both
ndiff and pdiff, so it will be one or the other, and the one not
connected can easily get labels moved to other nets.  To avoid
this:  (1) removed the "no-reconnect-labels" option, and (2) made
the automatic label reconnection smarter, as well as splitting it
into two different behaviors based on whether a label is being
created or manipulated from the command line (more or less the
original behavior) vs. being read from GDS or LEF.  The new rules
assume that labels attached to a GDS type will all map to the
same plane in magic.  To avoid excessive error messages from
existing tech files, a warning is issued only if "labels" changes
the plane of the target layer (a realistic solution rather than
the preferred one).  Also:  Fixed an error that causes a crash on
the "wizard" command "*watch" if the cell being observed is
read-only (see github issue #271).
2023-10-17 15:54:38 -04:00
Tim Edwards 36fa9aabd1 Implemented a new command option "gds magscale" to reinterpret the
meaning of the MAG record in GDS files.  Most available GDS
documentation is decidedly vague about what MAG means.  Most
layout tools seem to interpret a MAG of 1 as corresponding to a
text height of 1um.  However, there are a few tools that
interpret it as 1 centimicron, and there's no reason to assume
that any given interpretation is correct.  "gds magscale" allows
the scale to be redefined.
2023-07-19 20:33:01 -04:00
Johan Euphrosine 1bdf173391 textio: add TxErrorV variant 2023-07-12 05:21:20 +09:00
Johan Euphrosine eb9dcbcd01 calma: fix linux build? 2023-07-12 04:53:07 +09:00
Johan Euphrosine 96eb275622 quick and dirty emscripten port 2023-07-12 00:31:37 +09: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 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 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 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 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 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 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 583aaa1007 Added code to avoid making a call to get a default layer width on
an invalid type.  This prevents magic from generating unneeded
error messages about default layer widths on GDS read-in.
2022-12-19 11:52: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 13a1bfcc2e Discovered that reading in polygons as subcells and then flattening
can be much, much faster than reading in polygons directly into a
cell from GDS.  Modified the handling of polygons so that they are
*always* read into subcells.  If the "polygon subcell flatten true"
option is not enabled, then the subcells are flattened at the end
of reading the cell, and the polygon cells are deleted.  This method
avoids most of the cases in which "polygon subcell flatten true"
has ever needed to be set.
2022-12-13 21:58:30 -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 05056d2f1f Left in the new code supporting the "calma contact true" option
for the squares-grid operator and for GDS compression.  But I
reverted the "calma contact" option to be false by default, because
the method does not exactly match the output when not using cell
instance arrays, and so may produce unexpected results.  Will
need a different implementation that uses the same code to generate
the same (effective) layout.
2022-11-10 14:46:26 -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 075262b2ef Added the ability to read compressed .mag files (writing is not yet
supported).  Fixed the long-standing issue in which DRC does not
get stopped by the "drc off" command (the behavior for interrupting
the DRC was dependent on the DRC being turned on, and the "drc off"
command was turning it off before breaking, causing the interrupt
to be ignored).
2022-11-02 17:12:46 -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
Alessandro De Laurenzis b306a39560 Compatibility with C99 standard
This commit makes the code (mostly) C99-compatible, enabling to compile
it without the -Wno-error=implicit-function-declaration flag. This
way, Magic becomes usable on arm64 architectures, specifically on Apple
computers with M1/M2 SoC.
2022-10-29 06:07:46 +02: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 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 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 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 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 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 62ce6cde05 Corrected an error in the call to calmaDumpStructure(), which I added
an extra argument to, briefly, and then failed to remove it from one
call.
2022-05-12 20:43:30 -04:00
Tim Edwards 0c38707542 A number of other corrections around CalmaFullDump, which had
mistakenly recast the input file routines from zlib back to stdio;
only the output file routines should have been changed.
2022-05-12 09:55:38 -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 da49a50d8e Extended the code from the previous commit to handle automatically
pointing GDS_FILE to a compressed filename when using "gds readonly
true" on a compressed file.  The start and end pointers still point
to data bounds in the uncompressed file.
2022-05-05 18:04:41 -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 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 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 3065d4cc4b After much pain and suffering, finally tracked down all the places that
the timestamp is updated after reading in CIF or GDS, and managed to
get the timestamp dirty flag to remain clear after reading when
"gds datestamp" is used.  This includes a modification of the timestamp
update routine that only updates timestamps on a single file if only a
single file is being written.
2022-01-21 22:17:54 -05:00
Tim Edwards 5dd0c97dce Modified the "writeall" command to (1) raise an error message when
"writeall force <cell>" is used but <cell> doesn't exist, and (2)
to add options "writeall modified" and "writeall noupdate" (which
may or may not be useful).
2022-01-21 17:43:04 -05:00
Tim Edwards 93c4503fa8 Refined the new "gds maskhints" command option for GDS input from
yesterday's commit to allow the syntax "gds maskhints <types>", in
which mask hints can be restricted to a specific list of layers
rather than all layers which define mask hints in the cifoutput
rule.
2022-01-21 14:48:59 -05:00
Tim Edwards 97441bc07a Extended the GDS timestamp handling to GDS input. Unlike former
behavior, in which all cells read from GDS are given a zero
timestamp, and the timestamp is set when the file is written to
disk, the default behavior now is to set the layout cell's timestamp
from the timestamp provided in the GDS (the creation date timestamp,
specifically).  The same command "gds datestamp" implemented in the
previous commit for GDS writes now also applies to GDS reads:  If
set to "no", then the timestamp value from the GDS file is
transferred to the layout view (default behavior);  if set to "yes",
then the timestamp is set to zero (legacy behavior).  If set to
a value, then the value is used as the timestamp.
2022-01-21 13:05:24 -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 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 72227b4995 Revised the messaging coming from "gds read" so that it does not
post error messages when a GDS library addendum is read.  It now
assumes that if a cell is called but not defined in the GDS, and
that cell happens to be in memory already, then this is intentional.
2021-12-31 23:11:24 -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 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 db6128232f Added a new cif/calma layer type "labellayer" that can be used to
tag geometry with a specific label which is the name of the layer.
2021-11-16 10:58:18 -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 08461c9384 Simple change to "gds read" to print out a diagnostic message for
every 5000 uses read instead of 100;  this significantly cuts down
on the output.
2021-07-30 15:40:39 -04:00
Tim Edwards 1d8a59049c Added sanity checks to the GDS dump from GDS_FILE pointers. Since
it is easy to subvert the process by updating GDS without updating
the pointers, it is trivial to end up with bad GDS output.  The
sanity checks confirm that the position pointed to is a complete
structure (check begin and end records), and that it has the same
name as the cell (this is not a requirement, as there are reasons
one might want to point to data from a structure of a different
name, but a warning will be printed).
2021-07-30 13:45:03 -04:00
Tim Edwards f001502a18 One small enhancement to the code of the previous commit: If a
cell is referenced by a GDS "addendum" file but is not in either
the tree of the root def or any other dumped GDS file, then check
the database for those files and output them if they exist.  This
allows one way to get around missing cells in the GDS output if a
cell from a GDS addendum is used but no cells from the library
that the file is an addendum of are used.
2021-06-17 12:55:45 -04:00
Tim Edwards e55c1ecbda Corrected issues with GDS write that come from two features recently
introduced:  The use of substitutions for PDKPATH and home directory
in path names for GDS files referenced in abstract views, and the
"gds addendum" option.  Both were interfering with magic's handling
of writing GDS files from abstract layout views.
2021-06-17 12:40:21 -04:00
Tim Edwards 6e09586c54 Changed the property attribute number used for cell instance names
from 98 (arbitrarily selected) to 61 (apparently commonly used by
other tools).  This should help increase compatibility with GDS
files output from other tools.
2021-06-13 12:23:07 -04:00
Tim Edwards 75386e6467 Corrected the GDS read routine so that the "gds noduplicates"
option does not get undermined by GDS files that have cell
instances appear before cell definitions.
2021-06-12 11:40:13 -04:00
Tim Edwards 35b60531e5 Corrected CalmaRead to remove a syntax error that managed to end up in
the last commit, unfortunately.  Thanks to Matt Guthaus for alerting me
to this.  Also updated parts of the extresist code that remove the
dependence on ResConDCS;  this is a minor update and should not affect
the operation of extresist.  It is preparatory to doing more work to
support additional device types like capacitors, bipolars, and diodes.
2021-06-06 21:44:52 -04:00
Tim Edwards 78be76a650 Corrected a potential crash condition if attempting to read a GDS
cell without any edit cell defined.
2021-06-05 17:02:39 -04:00
Tim Edwards d8450cf1d4 Corrected an issue with a conflict between the "gds ordering" and
"gds noduplicates" options (essentially, they were canceling each
other out).
2021-05-12 22:49:25 -04:00
Tim Edwards e403e92017 Correction to the previous commit (didn't work as advertised). 2021-04-27 14:53:34 -04:00
Tim Edwards be19fda504 Added a "gds unique" option that behaves like the default CIF behavior,
in which if a cell is read from GDS that has the same name as a cell
in memory, then the cell in memory is renamed to keep all cell names
unique in the database.
2021-04-27 13:07:27 -04:00
Tim Edwards 6bd96a68dc Created a method for annotating abstract views with GDS pointers.
This can be done now by reading a LEF file, followed by reading
a GDS file with the "noduplicates" option set.  In addition,
annotation of either the LEF view or a read-only view follows the
same protocol as cell paths in the .mag file, which is to replace
leading path components matching Tcl variables for PDKPATH or
PDKROOT, and replace the home directory path with a tilde.
2021-04-22 14:39:34 -04:00
Tim Edwards 521baa91d9 Modified the "gds write" command so that it issues a strongly-
worded warning if an abstract cell view is written to GDS.
Corrected the "cellname ... writeable" command to allow an
overrride of the read-only status of a cell.  That change had
been made before but apparently got reverted by the recent
rollback.
2021-04-19 12:53:32 -04:00
Tim Edwards 8384891f3d Removed one diagnostic message after flattening a cell in GDS input
because depending on the GDS file it could be printed millions of
times.
2021-03-18 20:47:59 -04:00
Tim Edwards 08cb75a9b4 Modified the GDS read routine behavior so that if a cell is being
flattened per "gds flatten" or "gds flatglob", and the "gds readonly"
option is not set, then the instances of the flattened cells are
removed from the layout.  They are retained for the "readonly" option
because when writing GDS of such a cell, the full hierarchy needs to
be walked.
2021-03-18 15:16:37 -04:00
Tim Edwards f2af326368 Gave up on attempting to separate out slashes in instance names
from slashes in hierarchical names.  Magic does not allow slashes
in names when using "identify", so the simplest solution is just
to prohibit them in names being read from GDS files, and replace
them with underscores to make them magic-compatible.  Changing
GDS names always has repercussions on things like back-annotating
delays, so it should probably be revisited in the future.
2021-02-24 14:41:35 -05:00
Tim Edwards 3af205cd66 Altered the way that cells in unknown GDS libraries get prefixed,
to make it more compatible with SPICE by keeping it case-sensitive
and avoiding a number for the first character.
2021-02-19 08:52:56 -05:00
Tim Edwards d1f7e43dcc Revised DBWloadWindow (again) so that boolean flags are passed to
it as a single value "flags" (unsigned char) with meaningful flag
names.  Added new option "-fail" to the load command to allow
magic to fail on loading a cell that does not have a corresponding
file rather than the default action of creating a new cell.  Added
a flag for the "-quiet" option so that behavior on "-fail" can be
done quietly.
2021-02-10 13:05:38 -05:00
Tim Edwards 522171510c Moved the "Generating output" statement for "gds write" after the
calls on subcells, as otherwise the statement is confusing.
2021-02-03 11:09:58 -05:00
Tim Edwards cf54d146d1 Another change to CalmaWrite to avoid writing subcells of any
cell def that is marked for a "full dump" from a referenced GDS
file.  This change was supposed to have been done a few commits
ago but did not work as advertised.
2021-01-20 15:00:19 -05:00
Tim Edwards e7e01a635f Modified the behavior of "gds write" to refuse to write out the
magic database derived layout of a cell that declares GDS_FILE
but for which the GDS file referenced cannot be found or read.
This will produce an incomplete GDS file instead of an apparently
good and complete GDS file that actually contains bad data.  Also:
Added new command "random" that allows a random seed to be set,
for use with the GDS output when writing a full dump of a GDS
file.  Otherwise, the output prefixes are always the same, which
defeats the purpose of adding the random prefix.
2021-01-15 12:40:20 -05:00
Tim Edwards 7dfe407787 Implemented a return value for the cell read-in checks with an option
to stop the search whenever a cell is not found.  Used this to implement
a new option for GDS writes, "gds undefined allow|disallow" (default
"disallow") controls whether or not GDS with undefined references will
be allowed to be written.  Similarly affects CIF and LEF writes, extraction,
and DRC (when running "drc check" from the top).
2021-01-14 15:21:39 -05:00
Tim Edwards bb453f976e Changed "Writing cell" to "Generating output for cell" from the
"gds write" command, since "Writing cell" is easily confused with
writing a .mag database file.  "Generating output" seems clearer
to me.  Maybe it's just me.
2020-12-30 12:50:07 -05:00
Anton Blanchard 91f9bc166f Fix a few compiler warnings
We were missing string.h in a few places, and were also creating
a string format of %llld.
2020-12-24 22:00:44 -05:00
Tim Edwards b12734bfc2 Made a slight change to the "gds flatglob" command option to allow
cells with subcells to be flattened in this way, as there does not
seem to be any prohibition against it.
2020-12-22 21:53:36 -05:00
Tim Edwards bcc7b3d06d Added an option "gds flatglob [<string>|none]" that allows flattening
of input cells on a per-cellname basis, using glob-style pattern
matching.  This is probably the best way to deal with 3rd-party vendor
GDS with unfortunate practices like dividing devices up among cells in
a hierarchy, even though it comes across as a bit of a hack solution.
2020-12-22 14:44:30 -05:00
Tim Edwards 5755e0bcfd Added "gds" command option "gds nodatestamp [true|false]". Set to
true, this will force the "gds write" command to write out creation
date stamps as zero.  This is very useful for avoiding changing the
contents of an otherwise-unchanged layout, especially if it is in
a git repository where it will force the entire file to be replaced.
2020-12-15 14:52:30 -05:00
Tim Edwards 0429d94e1c Corrected a scaling error in the post-order reading routine. The
routine attempts to rescale the contents of the top-level cell after
moving forward in the GDS to find a cell that was used before it was
defined, if reading that cell caused the scale to change.  However,
the numerator and denominator were reversed, causing the scaling to
be the inverse of what it should have been.
2020-12-08 20:38:33 -05:00
Tim Edwards 1c82265244 Several enhancements: (1) Added command option "gds no_duplicates"
to allow a "gds read" command to ignore cells in the GDS which already
exist in memory.  This allows magic to be "pre-seeded" with specific
views of cells in the GDS.  Default is false, which is backwards-
compatble behavior.  (2) Changed the behavior of the the way the use
path is written to and read from a .mag file, checking the path prefix
against Tcl variables PDK_PATH, PDKPATH, PDK_ROOT, and PDKROOT, and
replacing any such leading path component with the variable name.
On reading a .mag file, any variable name at the start of the path
that matches a Tcl variable will be substituted.
2020-12-04 16:56:51 -05:00
Tim Edwards 0d10b7f785 Corrected a crash condition that can occur if a GDS file pointed
to by GDS_FILE does not exist.
2020-12-03 10:35:54 -05:00
Tim Edwards b9f9f73c9b "Partly" corrected an issue in GDS read: The cd_client record is
used both for counting cells during GDS write and for saving
geometry data from the "copyup" operator during GDS read.  The write
routine does not clear the client record, and the read routine was
checking if the cd_client value was default.  Corrected the resulting
crash condition by resetting cd_client before GDS reads.  However, the
underlying problem is that the GDS read is reading data into a cell
that already exists in the database, and is not handling it robustly
by renaming the existing cell.  So this should be revisited.
2020-11-20 19:56:41 -05:00
Tim Edwards 75a18053f8 Modified the CIFGenLayer() routine to be aware of when it is called during
hierarchical processing from CIFGenSubcells() and CIFGenArrays(), and to
avoid certain operators that are useless and harmful when applied
hierarchically; namely squares, slots, bbox, boundary, and net.
2020-11-12 10:34:27 -05:00
Tim Edwards c0015efbe0 Added experimental "calma addendum" option to output only references
to readonly cells but not the readonly cells themselves when writing
a GDS library.
2020-10-13 09:47:54 -04:00
Tim Edwards 838c9b840d Added a "calma library" command option, to generate a GDS library
from the subcircuits of a top-level layout without also writing the
top level.
2020-07-16 08:55:46 -04:00
Tim Edwards 3203eec28c Modified the "bloat-all" cifoutput operator to allow operations on
templayers.  This permits some useful interactions like growing to
the size of a bounding box, or abutment box, as well as many other
possibilities.  Also:  Corrected the use of "cif see" for the boundary
(abutment box) layer, which was not working because the "cif see"
command uses a flattened CellDef that does not have the boundary
property of the cell it was flattened from.
2020-05-26 14:29:36 -04:00
Tim Edwards 2af38a4191 Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
Tim Edwards 028612b70a Added extension to "gds flatten" command option to change the limit
of geometry primitives that triggers flattening (default 10).
2020-05-14 15:59:39 -04:00
Tim Edwards 38c6ce3b07 Changed the handling of GDS reads so that if the cifinput option
"ignore-unknown-layer-labels" is set, then error messages will not
be displayed when labels in the GDS input are on unknown layers
(this option is and has been otherwise handled correctly;  the only
issue is the generation of an error message on the output).
2020-05-14 15:41:46 -04:00
Tim Edwards 55ff3fd1ff Modified GDS read output to avoid generating error messages on
unrecognized layers when the "readonly" read option is set.
Added support to scale elements (from the "element" command,
such as the measurement text and arrows) when the grid scales,
which was missing.  Corrected the output of persistent elements
in a .mag file so that they are correctly scaled by the scale
reducer.
2020-05-12 12:03:38 -04:00
Tim Edwards 6737741902 Corrected CalmaRdpt() routine to avoid crashing if the cd_client
record is uninitialized when calling the rescale routine.
2020-05-08 16:44:29 -04:00
Tim Edwards 669ae1dfcc Added a way to subvert the adding of a prefix to subcells of a dumped
GDS library from an abstract view, by defining the property LEFview
in the cell as "no_prefix" instead of "TRUE".
2020-04-23 16:03:29 -04:00
Tim Edwards 0f16b7da6c One modification to the last commit, such that if the cell is not
marked as abstract yet has GDS_START but not GDS_END defined,
magic will not crash by attempting to use the nonexistant value
of GDS_END.
2020-04-23 15:08:56 -04:00
Tim Edwards 88e23a114e Corrected CalmaWrite behavior to be as was intended for handling vendor
GDS of abstract views, such that if the cellname being dumped is the
same as the library name, then no prefix is added to subcells.  This
behavior may be changed in the future.
2020-04-23 14:41:29 -04:00
Tim Edwards f28d2c5989 Merge branch 'master' into bplane
Merging correction to CalmaWrite.c for reference to property string
GDS_FILE that may not exist.
2020-03-27 16:52:21 -04:00
Tim Edwards d6b4b014d6 Corrected bad reference to GDS_FILE property when it may not exist. 2020-03-27 16:51:23 -04:00
Tim Edwards aab318176b Corrected lefWrite, which was not initializing the count of items
written, so that a LEF output with no ports would fail to write
the OBS ... END around the obstruction geometry.
2020-03-25 15:19:28 -04:00