1) Corrected spurious error messages about cells already existing
in GDS when using "flatten" or "flatglob".
2) Fixed handling of resistance as a subcircuit parameter
3) Added area and perimeter resistance for a device; this is done
through the "devresist" statement in the tech file, which is an
extension of the original "fetresist" statement. Where "fetresist"
only supported type "linear", "devresist" supports types "area"
and "perimeter".
4) Support for CDL syntax, including generating subcircuit-like
parameters for components starting with SPICE-standard prefixes
like M, R, C, etc., adding "/" between pins and subcircuit name,
and saving the file as ".cdl" instead of ".spice".
5) Estimated L and W for devices whose geometry is complex and do not
reduce to a simple rectangle. L and W are estimated as the square
root of the area.
6) Changed the method of extracting L and W for diodes to use the same
method as capacitors. Note that diodes are not usually specified
by L and W, but if they are, this will produce the right result.
7) Corrected the reported filename and line number when printing error
messages related to errors inside a technology file, when the
technology file uses "include" to combine multiple files.
since this is a common artifact of foundry cells and almost
always incompatible with magic. Modified the "port" command to
allow "port make <index>" on a label where other labels of the
same text already have the same index. Removed deprecated
documentation and added some missing documentation, such as an
explanation of the "ext2spice subcircuit auto" option.
Remove limited use HAVE_ZLIB wrapper API into separate header as
utils.h is used in many places and most source files don't need
to drag in the header file from this external dependency.
Copyright date(s) taken from original source file / git blame.
Previously this was returning two values, a 'bool' and a data
structure that is created. Now it simply returns the data
structure which makes it easier to reason about who takes
ownership of the memory and when, also that no address-of can
be supplied that has any side-effect that interacts with how
the method works / the returned result.
-extern bool CIFParsePath(CIFPath **pathheadpp, int iscale);
+extern CIFPath *CIFParsePath(int iscale);
Previous related comments:
Easier to reason about, there can be no interaction from *pathheadpp
and the various functions called, which maybe the first concern to
the next reader as visibility of new data is limited to that of a
local variable of the function.
All naked access to `ti_client` now uses the function-like-macro
to encapsulate this action. This macro existed before this just
makes all sites utilize it.
Added additional INT and PTR variants to remove the programmer
load on thinking about casing and casts polluting the point
of use. So the use now looks cleaner.
Equivalent prototypes:
void TiSetClient(Tile*, ClientData)
void TiSetClientINT(Tile*, intptr_t) /* pointertype */
void TiSetClientPTR(Tile*, void*)
ClientData TiGetClient(Tile*)
intptr_t TiGetClientINT(Tile*) /* pointertype */
void *TiGetClientPTR(Tile*)
that has since been compressed and given a ".gz" extension.
Removed code that uses a system call to "gunzip" and "gzip" when
the target file is compressed, since the compression is handled
in the code.
The type is actually an enum (assumed to be int by default) but relies
on the magic typedef to (unsigned char) so we make this explicit and
better document what the real type is.
I guess in the past it was really a bool with only 2 states NONE|TEXT.
C29 bool type compatibility
Example build issue using MacOS 12 (Xcode 14.2 from MacOSX.platform).
In file included from grTk1.c:23:
In file included from ../utils/main.h:26:
In file included from ../windows/windows.h:26:
../utils/magic.h:143:13: warning: 'FREAD' macro redefined [-Wmacro-redefined]
#define FREAD(a,b,c,d) gzread(d,a,b*c)
^
/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/fcntl.h:110:9: note: previous definition is here
#define FREAD 0x00000001
time.h has existed since C89 so is a standard header expected
to always be available.
sys/time.h was an optional header that historically only some
platforms provided.
If there is a conflict on specific platforms it is better to
'#if !defined()' that specific niche platform with the problem
if both headers are included in the same compile unit. But I
don't think this is a problem in modern times.
So this results in a resolution that removes #ifdef around
time.h and the detection by configure for the availabiltiy
of sys/time.h.
K&R obsolete syntax removal for C23 compatibility series
The local variable 'libnameptr' is used from the 'goto done;' label cleanup
but it may not be initiailzied at the time of the first use of the label.
When evaluating this I also notice the global 'calmaErrorFile' when closed
does not have the handle invalidated.
CalmaRead.c:233:9: warning: variable 'libnameptr' is used uninitialized whenever 'if' condition is true
CalmaRead.c:231:9: warning: variable 'libnameptr' is used uninitialized whenever 'if' condition is true
CalmaRead.c:225:9: warning: variable 'libnameptr' is used uninitialized whenever 'if' condition is true
clang18 -Wall warning cleanup [-Wsometimes-uninitialized]
CalmaRdpt.c:525:5: warning: variable 'rtype' is used uninitialized whenever 'if' condition is true
CalmaRdpt.c:792:5: warning: variable 'rtype' is used uninitialized whenever 'if' condition is true
clang18 -Wall warning cleanup [-Wsometimes-uninitialized]
FEOF condition of PEEKRH causes variable to possibly not get
initialized before use.
CalmaRdcl.c:372:5: warning: variable 'rtype' is used uninitialized whenever 'if' condition is true
clang18 -Wall warning cleanup [-Wsometimes-uninitialized]
Due to use of strcasecmp() or similar C API.
Maybe HAVE_STRINGS_H is needed ? If so which platforms needs this ?
clang18 default warning cleanup (strict)
PlowRules1.c:439:9: warning: suggest parentheses around assignment used as truth value
PlowTech.c:645:17: warning: suggest parentheses around assignment used as truth value
PlowTech.c:652:17: warning: suggest parentheses around assignment used as truth value
PlowTech.c:1019:17: warning: suggest parentheses around assignment used as truth value
ResReadSim.c:270:13: warning: suggest parentheses around assignment used as truth value
ResReadSim.c:871:9: warning: suggest parentheses around assignment used as truth value
ResRex.c:1840:17: warning: suggest parentheses around assignment used as truth value
getrect.c:72:9: warning: suggest parentheses around assignment used as truth value
getrect.c:79:9: warning: suggest parentheses around assignment used as truth value
getrect.c:86:9: warning: suggest parentheses around assignment used as truth value
getrect.c:93:9: warning: suggest parentheses around assignment used as truth value
hash.c:732:16: warning: suggest parentheses around assignment used as truth value
heap.c:328:17: warning: suggest parentheses around assignment used as truth value
heap.c:344:17: warning: suggest parentheses around assignment used as truth value
netlist.c:323:17: warning: suggest parentheses around assignment used as truth value
niceabort.c:121:9: warning: suggest parentheses around assignment used as truth value
path.c:1102:12: warning: suggest parentheses around assignment used as truth value
pathvisit.c:245:13: warning: suggest parentheses around assignment used as truth value
pathvisit.c:295:17: warning: suggest parentheses around assignment used as truth value
tech.c:656:17: warning: suggest parentheses around assignment used as truth value
ext2spice.c:1591:16: warning: suggest parentheses around assignment used as truth value
ext2spice.c:1622:16: warning: suggest parentheses around assignment used as truth value
ext2spice.c:1813:12: warning: suggest parentheses around assignment used as truth value
ext2spice.c:1862:12: warning: suggest parentheses around assignment used as truth value
ext2spice.c:3808:16: warning: suggest parentheses around assignment used as truth value
CalmaRdio.c:437:9: warning: suggest parentheses around assignment used as truth value
CalmaWrite.c:396:9: warning: suggest parentheses around assignment used as truth value
CalmaWrite.c:1772:29: warning: suggest parentheses around assignment used as truth value
CalmaWriteZ.c:372:9: warning: suggest parentheses around assignment used as truth value
CalmaWriteZ.c:1608:29: warning: suggest parentheses around assignment used as truth value
CIFrdtech.c:209:9: warning: suggest parentheses around assignment used as truth value
CIFrdtech.c:214:9: warning: suggest parentheses around assignment used as truth value
CIFrdtech.c:220:9: warning: suggest parentheses around assignment used as truth value
CIFrdtech.c:226:9: warning: suggest parentheses around assignment used as truth value
CIFrdutils.c:1258:12: warning: suggest parentheses around assignment used as truth value
GCC14 -Wall cleanup series [-Wparentheses]
An FEOF exit path exists in READRH() which causes the output
variable(s) to not be assigned a value, then the code makes
a decision (branch) based on uninitialized data.
SonarCloud detection
CalmaRead.c:359:The left operand of '!=' is a garbage value
https://sonarcloud.io/project/issues?open=AZJB17gSNGfDNup0Rkp5&id=dlmiles_magic
The 'predefined' pointer argument to calmaFindCell() is for an optional return value, so must be
NULL when feature is not used.
Copilot Autofix rejected: newdef = calmaFindCell(newname, someSecondArgument);
calma/CalmaRdcl.c
1c822652 (2020-12-04 16:56:51 -0500 1359) bool *predefined; /* If this cell was in memory before the GDS
1c822652 (2020-12-04 16:56:51 -0500 1360) * file was read, then this flag gets set.
1c822652 (2020-12-04 16:56:51 -0500 1361) */
commit 1c82265244 (tag: mpw-one-a, tag: 8.3.92)
Date: Fri Dec 4 16:56:51 2020 -0500
CodeQL: https://github.com/dlmiles/magic/security/code-scanning/6https://github.com/dlmiles/magic/security/code-scanning/5
report it after "Failure to read in entire sub-tree". This will
not report every failing cell (since it quits reading after the
first failure) but will avoid the existing issue of printing
nothing and leaving the user with no feedback as to which cell
was the problem.
"gds readonly true" mode and when writing a GDS file in full-dump
mode. Reading or writing a file with an incompatible DBU is now
prohibited. This is not a great solution, as it forces the
original file to be rewritten with a different DBU. Preferably
there should be code to scale the units during a dump, but that
needs to be coded.
cell being generated. This statement does not disambiguate the
case where a cell is being ripped verbatim from GDS instead of
being generated from the magic database. This print statement
has been split into two cases, and where a cell is being ripped
verbatim, the name of the file is indicated. This provides better
information to the user.