new "plane" property type (which apparently was not previously
documented when implemented, an oversight), and also (added by
request) to add a reminder that the "MASKHINTS" property only works
in conjunction with corresponding "mask-hints" records in the tech
file.
Out-of-tree, doc/latexfiles points a build-tree ../psfigures at the source
copy so latex/dvips resolve ../psfigures/*.ps. The old
`test -e ../psfigures || ln -s ... ../psfigures` had two defects:
* Under a parallel docs build two .ps jobs could both see ../psfigures
absent and both run `ln -s`. The second `ln -s DIR symlink-to-dir`
nests the link *inside* the target, writing a stray
doc/psfigures/psfigures INTO THE SOURCE TREE -- an out-of-tree build
must never modify source.
* (An order-only make prerequisite is not a fix here: VPATH makes make
"find" ../psfigures in the source tree and skip creating the build link
latex actually needs.)
Use a shell test (VPATH-immune) that is both idempotent and race/nest safe:
`test -d ../psfigures || ln -sfn ${MAGICSRC}/doc/psfigures ../psfigures`.
`test -d` is true in-tree (real source dir) and once the build symlink
exists; `ln -sfn` (force + no-dereference) replaces an existing symlink in
place instead of nesting inside it.
Verified in/out of tree under -j12: 28/28 docs, correct single-level build
symlink, source tree never touched (in-tree psfigures stays a real dir).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maint1.tex failed to build -- it was the one document that never
regenerated -- because of three source-level LaTeX errors, each masked by
the one before it:
* `gdb program $pid`: a bare `$` opens math mode (meant literally), which
was never closed, so `\endi` hit "Missing $ inserted" / Emergency stop.
Escaped to `\$pid`.
* `{\itshape process_ID}` (x2): a bare `_` is a math-mode subscript in
text. Escaped to `process\_ID`.
* a tabbing block (`\ii ps -C wish` before `\ii gdb ...`, and the
`gdb wish / run / set argc / set argv / source` block) was missing its
`\\` row separators, so multiple `\ii` (= \>\>\>) accumulated in one row
and overran the 4 tab stops -> "Undefined tab position". Added the
missing `\\`.
maint1 now compiles cleanly (two-pass, 0 errors) and `make all` in
doc/latexfiles produces 28/28 PostScript files instead of 27/28.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The doc/html install tar'd the whole $(srcdir), so it shipped Makefile.in
(always) and, for an in-tree build, the config.status-generated Makefile,
into $CAD_ROOT/magic/doc/html/. That also made the install differ
in-tree (377 files) vs out-of-tree (376).
Exclude ./Makefile and ./Makefile.in from the tar. The install now
contains only the 148 HTML files (+ subdirs) and is identical in-tree and
out-of-tree (375 files).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Switch the 5 nested children (scmos/cif_template, doc/man, doc/tutcells,
doc/html, doc/latexfiles) to configure-provided substitution:
srcdir = @srcdir@
VPATH = @srcdir@
MAGICDIR = @top_builddir@ (resolves to ../.. for these nested dirs)
Verified out-of-tree: full `make` rc=0; cif_template gets
srcdir=<src>/scmos/cif_template, doc/latexfiles MAGICDIR=../..; scmos
techs + 27/28 docs build.
With this, every module except readline/ is a configure-generated
Makefile.in using @srcdir@ substitution.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Convert the last nested children to Makefile.in and switch their parents
from the -f fallback to native recursion (they now have generated build
Makefiles). Rename and rewire are one unit: a pure rename would break the
parent's -f path to the (now-.in) child.
Converted (5): scmos/cif_template, doc/man, doc/tutcells, doc/html,
doc/latexfiles. Pure renames -- still build via the srcdir derivation;
@srcdir@ substitution follows.
Rewired to native `make -C <child>` (config.status now creates the child
build dirs + Makefiles):
* scmos/Makefile.in: cif_template build + clean.
* doc/Makefile.in: install/install-tcl over man/tutcells/html/latexfiles.
* Makefile.in: the docs: target -> `make -k -C doc/latexfiles all`.
The `mkdir -p` and `-f ${MAGICSRC}/.../Makefile` are dropped in each.
* configure.in: AC_CONFIG_FILES for the 5 children; regenerated configure.
* .gitignore: ignore each generated child Makefile, same commit.
Verified out-of-tree: full `make && make install` rc=0, 376 files --
scmos recurses natively into cif_template (8 objs), docs regenerate via
native doc/latexfiles (27/28), man pages install via native doc/man.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Switch the 5 top-level outlier modules to configure-provided substitution
(same template as the rest):
srcdir = @srcdir@
VPATH = @srcdir@
MAGICDIR = @top_builddir@
Their custom rules and ${MAGICDIR}/${MAGICSRC} references keep working:
${MAGICDIR} = @top_builddir@ (build top), $(srcdir) now from @srcdir@.
scmos/doc still recurse into their (static) children via -f.
Verified out-of-tree: full `make` rc=0 -- magic gets srcdir=<src>/magic,
tclmagic.so + scmos techs + 27/28 docs build.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fourth batch of the Makefile.in migration: the top-level complex outliers
magic tcltk scmos doc lisp
Pure renames -- content unchanged, so each still builds via the defs.mak
srcdir derivation; the @srcdir@ substitution follows.
Their nested children (scmos/cif_template and doc/{man,tutcells,html,
latexfiles}) are intentionally NOT converted here: scmos and doc recurse
into them with `-f ${MAGICSRC}/.../Makefile`, which keeps working only
while those children remain static Makefiles. They convert in a later
step together with the parent-recursion updates.
* git mv <dir>/Makefile -> <dir>/Makefile.in (5 modules)
* configure.in: AC_CONFIG_FILES for each; regenerated configure.
* .gitignore: ignore each generated <dir>/Makefile, same commit.
Verified out-of-tree: full `make` rc=0 -- tclmagic.so, scmos techs (scmos
recurses into the static cif_template via -f, 8 objs), 27/28 docs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When latex and dvips are available, the default no-arg "make" now
regenerates the PostScript documentation from its .tex sources into the
build tree; otherwise the pre-built PostScript shipped in the source tree
is used as-is at install time. Documentation is always available either
way -- installing latex simply refreshes it from source.
configure (scripts/configure.in, regenerated scripts/configure):
* AC_PATH_PROG for latex + dvips; DOCS_TARGET = "docs" only when both are
found; AC_SUBST(LATEX/DVIPS/DOCS_TARGET).
* Configuration summary prints "LaTeX docs: yes/no".
scripts/defs.mak.in: export LATEX/DVIPS.
Makefile.in:
* all: ... $(DOCS_TARGET) -- pulls in "docs" only when latex was found.
* docs: best-effort -- `make -k` + a warning on failure so a document
that will not typeset (or a missing texlive package) never fails the
build; install falls back to the pre-built PostScript for those.
doc/latexfiles/Makefile:
* use ${LATEX}/${DVIPS} from defs.mak.
* the .tex include figures as ../psfigures/*.ps; point the build-tree
../psfigures at ${MAGICSRC}/doc/psfigures (no-op in-tree) so latex and
dvips find them while outputs stay in the build tree.
CI: main.yml and main-aarch64.yml install
texlive-latex-base/-recommended + texlive-fonts-recommended so the Linux
builds exercise doc regeneration (best-effort, never fatal).
README.Tcl: document latex/dvips as an optional prerequisite for docs.
.gitignore: ignore in-tree doc build artifacts (doc/latexfiles/psfiles/,
*.dvi/*.aux/*.log); the pre-built doc/psfiles/ stays tracked.
Verified out-of-tree with TeX Live 2024: configure reports "LaTeX docs:
yes"; `make` regenerates 27/28 documents into the build tree (maint1.tex
has a genuine LaTeX error and falls back), stays exit 0; `make install`
installs the 27 regenerated PostScript from the build tree and maint1
from the source pre-built copy; the source tree is not modified.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extend the out-of-tree build to the outliers deferred earlier, and
audit install sourcing. All are read-source / write-build now.
Tcl auto-load shared libraries (built via each module's `tcl-main`;
not part of the default TCL build, but now correct when invoked):
* lef/plot/router/ext2spice/ext2sim: the hand-written object rules
(tcllef.o, tclplot.o, tclroute.o, spicewrap.o, spicehier.o, simwrap.o,
ext2sim_main.o) compiled a bare-name source from the cwd; switch to
`-c $< -o $@` so the source is found via VPATH and the object lands in
the build tree. ext2sim_main.o also swaps the hard-coded -I${MAGICDIR}
for ${CPPFLAGS} (build + source include paths). ext2spice spice2sim
install copies $< (source script). Sibling ${MAGICDIR}/<mod>/lib*.o
refs already resolve into the build tree (MAGICDIR = build top).
oa (disabled by default; OpenAccess):
* CXX_INCLUDES -I. -> -I$(srcdir) -I${MAGICDIR} -I${MAGICSRC} so the C++
sources, generated database/database.h, and cross-module headers all
resolve out-of-tree; .deps and objects were already build-local.
doc/latexfiles PostScript regeneration:
* Split PS_SRCDIR (pre-built PS shipped in the source tree, read-only)
from PS_GENDIR (= psfiles in the build tree). `all` / the .tex.ps
rule now regenerate into PS_GENDIR (mkdir -p; latex reads $(srcdir)
via TEXINPUTS; dvips writes the build tree) instead of writing back
into the source psfiles dir. install takes each .ps from PS_GENDIR if
regenerated there, else the pre-built PS_SRCDIR copy.
Verified out-of-tree (make modules; then per-module tcl-main):
* magiclef.so / tclplot.so / tclroute.so / exttospice.so / exttosim.so
all build into the build tree (rc=0); oa.o builds into the build tree;
source tree stays clean.
* install-tcl copies each .so from the build tree.
* Install-location audit on a full `make install DESTDIR=...`: generated
data (scmos.tech, .magicrc, magic.tcl, tclmagic.so) matches the build
tree; verbatim data (glyphs, fonts, magicps.pro, man pages, doc PS)
matches the source tree.
* DESTDIR: two distinct prefixes install 376 files each, independent and
fully contained (nothing written outside DESTDIR).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fix the remaining non-standard Makefiles so a full out-of-tree
`../configure && make && make install` builds and installs a complete
magic TCL tree, sources read from the source tree, all outputs in the
build tree.
Shared linker/preprocessor paths (scripts/configure.in, regenerated
scripts/configure):
* --version-script=${MAGICDIR}/magic/symbol.map -> ${MAGICSRC}/... so
every shared-library link (tclmagic.so, ...) finds the source map.
* MCPP preproc.py path ${MAGICDIR}/scripts -> ${MAGICSRC}/scripts.
Programs (built via tcllibrary, PROGRAMS = magic tcltk):
* magic/Makefile: proto.magicrc, magicWasm.o and the bitmaps/.initrc/
magicps.pro install copies use $< / $(srcdir) instead of bare names.
* tcltk/Makefile: magicexec/magicdnull compile $<; the sed'd launcher
scripts (magic.tcl/.sh, ext2spice.sh, ext2sim.sh) read $<; VERSION dep
-> ${MAGICSRC}; install-tcl copies each TCL file from the build dir if
present else $(srcdir) (magic.tcl is generated, the rest are source).
Techs (scmos):
* scmos/Makefile: SC_PP template include -> $(srcdir)/extract_template;
tech-file inputs (scmos.tech.in, *.tech.in) via $(srcdir)/$< ; recurse
into cif_template with mkdir + -f ${MAGICSRC}/scmos/cif_template/Makefile;
install copies from build-or-$(srcdir).
* scmos/cif_template/Makefile: MKDIR -> ${MAGICSRC}/scripts/mkdirs;
SC_CPP gains -I$(srcdir); cpp reads $(srcdir)/cif{in,out}.c so the .gen
includes resolve; objs/ generated in the build tree.
Data-file installs (source files copied from $(srcdir)):
* graphics/Makefile: glyphs, outline fonts, and the X11 helper build.
* windows/Makefile: glyphs and vector fonts.
* doc/Makefile: recurse into man/tutcells/html/latexfiles build-aware;
doc/man, doc/tutcells install with $< ; doc/html tars $(srcdir);
doc/latexfiles reads pre-built PostScript from ${MAGICSRC}/doc/psfiles.
Verified out-of-tree (mkdir _build; cd _build; ../configure): `make`
returns rc=0 (33 module libs, tclmagic.so, magicexec/magicdnull, scmos
tech files + cif_template objs, proto.magicrc), and
`make install DESTDIR=...` returns rc=0 installing 376 files
(bin/magic, tcl/tclmagic.so, sys/ glyphs+fonts+techs+dstyles), with the
source tree left completely clean.
Not exercised by the default TCL build/install and therefore not
converted here: the standalone .so/program variants of
lef/plot/router/ext2spice/ext2sim (their module libs do build), the
disabled oa module (-I. -> -I$(srcdir) still needed if enabled), the
WASM path, and doc/latexfiles PostScript *regeneration* (which still
writes into the source psfiles dir).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
after much discussion about the implementation. Since it is not
exactly clear what the field lines do at corners, the implementation
depends largely on an unknown and presumably global constant
multiplier; this has provisionally been set to 1 but needs to be
determined empirically with a field equation solver. At least one
rational approximation suggests a value of pi/2 instead of 1. The
corner capacitance can be considered a refinement of existing
parasitic capacitance extraction, and since it takes a non-trivial
additional amount of computation, it is left as an option to
"extract" that can be turned on when a more accurate result is
preferred at the expense of a longer extraction time.
determining what does and doesn't get into the R-C extraction
output. Added option "debug" and moved all excess diagnostic
information to be gated by this flag. Corrected an issue in
the standard extraction in which the substrate is always output
with zero lumped resistance, preventing it from being checked
by "extresist" for inclusion or exclusion in the .res.ext output.
Reinstated the computation of minimum resistance transistor but
excluded other devices. Added more sane handling of exceptional
conditions like loops. The result is a more consistent check of
nets in the design. However, I still need to recheck the
"rg_maxres" calculation because it appears to be too low.
(1) An incorrect use of ExtResetTiles() was found in "extresist"
which impacts performance, especially for small nets.
(2) Corrected units for resistance tolerance in extresist, and
handled output printing in fs when delay values get below ps
size.
(3) Added command option "extract do unique notopports" to be the
extraction option equivalent of the standalone command
"extract unique notopports".
(4) Changed the "extresist" default for "mindelay" to 1ps from 0,
in response to the observation that lumped resistance from
"extract" can be an extreme overestimate, and the extracted
time delay from "extesist" calculations should be used as a
better determination of whether a net should be output as a
resistor network or not.
(5) Added documentation for both "extract do unique notopports"
and the change to the "extresist" default values.
that "extresist" selects or rejects networks for resistance
extraction. The "tolerance" value, which nobody (including
myself) seems to understand, is now deprecated, replaced by
a handful of more meaningful options: "threshold" to set a
lumped resistance estimate threshold to determined whether or
not to extract a network; "minres" to specify when to prune
small resistors from the resulting tree network, and "mindelay"
to gate the selection and output on the estimated signal
propagation delay. With these settings, I am much better able
to control the size and complexity of the resulting output.
code now for 10 days). The last commit fixed an error when using
drcCanonicalMaxwidth() multiple times in DRC rule checks on a single
edge. At the time, I also added a method to save some
drcCanonicalMaxwidth() results to prevent needlessly re-doing the
same (potentially expensive) computation over and over. However,
where I reused the cached result, I did not check if the number of
entries is zero. Other code does not check the number of entries
and depends on the prior behavior that drcCanonicalMaxwidth()
returns NULL when there are no entries. So the code needed to check
if the number of entries is zero before re-using the cached result.
Without the fix, any time the caching is used, the last computed
maximum area rectangle will be made active even when the current
check area does not meet the area requirement, resulting in many
false positive errors.
the exiting documentation does not include the handful of options
available to the macro command, nor does it explain the relationship
between tools and macro sets.
The main changes are:
(1) Changed the hash function used to generate the 6-character
suffix for generated device cell names. The original hash
function is not good for ensuring unique names, and can
cause cell name collisions (two different parameter sets
having the same cell name). The chance of name collisions
should now be diminishingly small.
(2) Modified the string passed to the hash:
(A) Ordered the parameter names alphabetically, since iterating
through dictionary keys is not guaranteed to be in any
specific order, leading to different strings for the same
parameter set
(B) Normalized numerical parameters, so that "2", "2.0", "2e0"
are all hashed the same, again to avoid having multiple
cell names for the same set of parameters.
(3) Fixed a problem in which when changing parameters for a cell
instance, the instance would become unselected and the instance
name would be lost and revert to magic's auto-generated name.
(4) Fixed the annoyance of having a pop-up dialog whenever magic
decides that a parameterized cell name is not being used anywhere,
and it can safely delete the cell.
(5) Fixed an issue where the check for whether a cell can be deleted
is not run consistently.
The result is, I hope, a much more pleasant experience with generated
cells.
description, because otherwise it only appears in the tech file
reference, where it doesn't really belong since the labels are a
user-level feature, even if they do affect extraction. The new
feature of using gate attributes for parameters was added to the
command description. I noticed that the tech file reference made
mention of a gate label in the form of ":ext <name>=<value>", but
this seems not to be implemented anywhere. At any rate, the method
just committed supercedes that.
to force internal units to be used; this usage is now deprecated
and needed to be changed to the "units" command. Also: Fixed a
separate issue with getting both "view bbox" and "view get" to
return values in the currently selected units. Also: Fixed an
issue with "property" when setting a property to a list passed as
a single value (e.g., "property FIXED_BBOX [box values]"), which
needed to null the string after each value.
converted to the new PropertyRecord type. Since this was in the
CIFPropRecordPath() subroutine, which has always been problematic
and generally useless, I took the opportunity to make that function
dependent on an option set by "gds savepaths true", with the option
set to "false" by default, so "path" properties will no longer be
created from GDS input unless the option is manually set to "true".
Also: Found that the returned boolean from "box exists" is
sometimes getting overwritten with a NULL result, causing a spurious
Tcl error messages to pop up. I could not find where this
overwriting happens (probably in a tag callback), so I just took the
hack approach of converting a NULL result to "false", which is always
safe to do.
new properties, so created a "property compat" setting and made
it TRUE by default. This makes magic print all properties as
type "string" on output into a .mag file. Which is fine, since
it converts all values to the right type on input anyway. The
only thing that backwards-compatibility mode prevents is user-
defined properties that are not strings. That is a very rare case
and can be done by turning off comptability mode. Some time in
the future compatibility mode can be changed to be default false,
but there's probably no real need to do so.
are handled. Properties were previously only character strings,
which had become cumbersome because properties were being used for
mask hints and bounding boxes, with the necessity of constantly
converting values from string to integer and back, which can cause
a performance impact as well as just being messy. The main difference
to the command is the addition of an optional first keyword argument
for the property type, which can be "string", "integer", "dimension",
or "double". All types except "string" can consist of multiple
values. Multiple values can be specified as separate arguments on
the command line, so that, for example, values of FIXED_BBOX or
MASKHINTS_* no longer need to be quoted. In addition, this completes
the handling of "units" implemented recently, as all properties of
the type "dimension" can be entered in the current units, will display
in the current units, and will scale with the database.
(1) Fixed an error that was introduced in version 8.3.590 with
a patch that should have been applied only for the case of
BJT devices, and not for MOSFETs. The patch will cause
devices generated by "device mosfet" or "device asymmetric"
to be read incorrectly from a .ext file during "ext2spice".
(2) Fixed an error in the tech file reading, where using CDL
parameters on a capacitor device would cause the tech file
loader to print an error message. The parsing was correct
and only the message should not have been printed.
(3) Added a new feature with the new command option "extract
do unique". This replaces the "extract unique" command by
running the same code within the extraction, but has the
additional effect of reverting the label changes afterward.
This prevents the user from inadvertently writing the
altered labels back to the database file.
section of the tech file, which can be used to alter the layer
connectivity tables from the default. This can be used, for
example, to disconnect substrate and well from taps, to
generate a netlist that checks for soft-connect errors.
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.
command, but with some critical differences, since the "crash"
command is designed for crash backups. "crash" will save in a
temp file and removes the file after a successful recovery.
"archive" can be used at any time to make a complete snapshot of
a layout in a single file, or to read back that snapshot.
There is a "writeall" option that will make a snapshot including
layout of all read-only (PDK) cells.
X and Y values, in which case the selection is moved to the
current pointer position. This allows a different implementation
of the "copy" command as "select move; select keep", which avoids
the problem that "copy" has of modifying the selection with layer
interactions with the existing layout.
arguments unambiguous, and to allow coordinates to be given in
any units. To do this, the (seldom if ever used) passing of a
label as a reference point was changed to require the "label"
keyword before the label name, avoiding the code having to
disambiguate arguments from label text. This now makes it
possible to specify the coordinates in microns, lambda, etc.,
units.
Was looking to implement this feature and found it was already
implemented but is a secret feature.
Updated documentation and modified implementation so it is possible
a user can discover the feature via usage such as "quit -help -invalid"
like other commands.
that no nets will be checked for antenna gate and diffusion area,
and no antenna properties will be output to the LEF file. This can
greatly speed up LEF output file generation for a large design.
Thank you to Tamas Hubai for the code patch.
the time the option was implemented), and also implemented (and
documented!) a similar command option "extract stepsize" for
reporting or changing the extraction step size.
unrelated nets to be captured in the same selection, due to the
use of the label bounding box instead of the label rectangle.
The bounding box is used for display only and should not be used
for connectivity.
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.
"pick x y" which acts like "cursor", but operates on a database
coordinate instead of a pointer coordinate. Made a few other
corrections to the command logging code so that it produces
valid output when the log file is sourced.