original implementation (which was added recently) used an inverted
output scale and multiplied by it instead of dividing by it,
resulting in incorrect units. However, it was not even getting to
that point due to the use of uninitialized variable "crec", which
should have been set from the window pointer but was missing.
Follow-up to review-master-upstream-20249999-oa-dcff2f64-6535a4e1.md:
- strcpy_s: add an inline fallback implementation right after the declaration,
guarded by #ifndef __STDC_LIB_EXT1__. glibc never defines that macro and does
not provide the C11 Annex K interfaces, so the bare declaration was an
unresolved symbol at link time; the fallback makes magicOA.o self-contained
(strcpy_s becomes a defined symbol) while a real Annex K libc still wins.
- magicInit.cpp / magicOA.cpp: use `char argvbuf[] = "tclsh"` for the mutable
argv string instead of `char[32]` + snprintf.
degenerate cases when attempting to find resistors in triangle
topologies in ResMerge, which fixes the segfault in github issue
diagnostic message. The other fix is part of github issue #538,
which found an error in the check for tied transistor sources and
drains. However, the other part of that issue, having to do with
nondeterminism in the "extresist" output, has not yet been addressed.
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.
can become corrupted if the name of the cell in magic changes from
the name of the structure in GDS pointed to by the GDS_FILE property,
and the new name is a different length from the original name.
Fixed by Claude Fable 5 and checked for all name-change scenarios
for both compressed and uncompressed output.
In GCC <= 14, flexible arrays are not supported in unions because of a parserlimitation.
This is a hack that declares an anonymous struct, which itself can contain a flexible array but still be a member of a union. Another empty element is included because structs that only contain a flexible array are also invalid.
In platforms with bounds-checking enabled, placeholder values for array sizes in structs that may be exceeded always result in a sigtrap.
This patch updates the following classes to use flexible arrays at the end of structs:
- database
- Label
- PropertyRecord (union of three flexible arrays and a pointer*)
- cellUE
- extflat
- HierName
- EFAttr
- Dev
- utils
- HashEntry (union of two flexible arrays and a pointer*)
- internalUndoEvent: Was a plain int, replaced with a flexible char array
Additionally, the database struct editUE, which would have just a single flexible-array member, was removed and simply replaced with a character pointer.
Where possible, allocation size macros have been introduced.
---
* It is noted flexible-length arrays as part of unions are not part of the C language spec and are a GNU99 extension, however, it is supported by both GCC and Clang.
a resistor subnet has been linked to itself (or something like that).
Otherwise it leads to a double-free and a crash. This commit does
not address why the subnet was linked to itself, and the crash was
preceded by another internal diagnostic message "Missing rptr at ..."
which has been noted before but still needs to be tracked down and
fixed. It is likely that a bad output netlist was created, but at
least magic doesn't segfault.
capacitance of a resistor device between the two terminals. If
the resistor device model contains the capacitance, then the
resistor type should not be included in types that generate
parasitics. If not, then the "pi" model is used. The "tee" model
is still available using "ext2spice resistor tee on". What this
update does is to default to the "pi" model instead of ignoring
the capacitance of the resistor type (e.g., "rm1"), and because
the capacitance of that node is removed after distributing it
between the two terminals, it will no longer produce a "floating"
node in the netlist output.
reading a resistor device which uses the syntax where the resistor
is given a value directly and not as a parameter; (2) allow the
use of "extresist minres 0" (allow resistors in the output no
matter how small). Thanks to Torleif Skaar for finding the issue
with the resistor syntax.
"progress report" of percent completion on certain long-running
processes (namely extraction, DEF reads, and GDS/CIF writes) was
allowing Tcl/Tk events to be processed so that the display would
be repainted and the console window updated to show the progress
instead of hanging. But that was allowing any key macros or
commands to be entered and executed, potentially corrupting the
database while the process was running. I have used
Tk_RestrictEvents() to prevent key and button events from being
processed until afterward. This preserves the display updates
(which do not alter the database) while preventing commands from
being run during one of these long-running processes. Also:
Previously, whenever a long-running process printed the status,
it would not update at the end, leaving output like "52% complete"
being the last output, leaving the impression that the process
never finished. Changed the code so that if any partial progress
is printed, then it will always finish up with the output "100%
complete" so that it is clear to the user that everything went
according to plan.
very major. The filename created had two slashes in the string
("/tmp//MAG...") because the temporary directory already has a slash
in the string. This makes no practical difference but looks odd when
printed to the terminal. The major error is that the Tcl script
that re-establishes the timer after a backup had a typo that caused
the timer never to be reset, resulting in crash backup files that are
created and written once but never again. This egregious error has
now finally been fixed.
a shielded substrate area for devices with terminals connecting to
substrate, search the entire cell hierarchy down to the bottom in
that area, not just the immediate child cell. Also: Reduced the
number of types being searched to ignore types in non-substrate
areas like nwell, although it should not make a practical difference
because those areas should not be searched.
a subcell: A further check is done to see if there are any devices
that interact with the substrate in the shielded area in the same
subcell. If not, then this is a trivial case where a different
substrate area exists but does not impact the subcell and should be
ignored. This change prevents some extraction errors where a substrate
area can get isolated because there was an unrelated substrate area
nearby. Also: Corrected parsing of "dsubckt" types when reading .ext
files; this applies to any device where the optional substrate is
omitted. There are apparently two conflicting methods when a device
doesn't have a substrate: (1) Output "None" for the substrate, or
(2) don't output anything. The 2nd method can be detected by counting
the number of arguments on the line in the .ext file. The extflat/
EFread.c code handles both methods. ResReadExtFile() now does too,
but probably code should be changed to just use method (1) always.
Also: Prevented the "tile not visited" error message in "extresist"
from printing duplicate messages for every device associated with the
same tile. The message can appear when a labeled net has unconnected
regions, and "extract do unique" is not used.
of pull request #527 from Enno, which allows the AppImage workflow
to trigger on a version update when the version number doesn't
start with a "v", as is the case for the repositories on
opencircuitdesign.com.
The AppImage release workflows trigger on any tag (the project tags
releases as e.g. 8.3.662, without a v prefix), but the npm publish
gate in main-wasm.yml required a v-prefixed tag, so a normal release
tag built the AppImages but never published the npm package to GitHub
Packages. The gate now accepts both forms, so a single tag releases
everything.
because this is the default value used if no substrate types are
declared in the tech file; and if so, this would cause an out-
of-bounds check. See Issue #523 on github from Darryl Miles.
The example/suite runners discarded e.stack via console.error(e.message ?? e),
hiding the wasm-function offsets that emsymbolizer needs to map an abort back
to C source. A failing test only printed a terse message like "memory access
out of bounds" with no trace.
- Add reportError() to helpers.js/helpers-tcl.js; print the full stack
(falling back to the message).
- Wrap command execution in runScript() to name the command that aborted
before the error propagates.
- Use reportError() in all standalone runners and in all.js/all-tcl.js
(full stack to stderr, one-line PASS/FAIL summary kept; tests still run
independently).
- build.sh: run the --test step in a subshell so its cd does not leak into
the --pack step.
Add explicit length limit to sscanf in TclmagicRegisterCommands: %92s
instead of %s prevents a potential stack overwrite if a command name
were ever longer than the buffer. Matches the available space (keyword[100]
minus the 7-byte "magic::" prefix minus null).
Extend the CI output-display step to also iterate over output-tcl/ so
that TCL-variant test regressions are visible in the job log without
downloading artifacts.
tclmagic.c: remove stray /*-----*/ line left over from a previous edit
that left a duplicate comment opener before TclmagicRegisterCommands.
magicWasm.c: move TxSetPoint inside the #else (non-TCL) branch of
magic_wasm_source_file and restore its explanation comment. TxSetPoint
routes TxDispatch commands to the layout window; it is irrelevant and
misleading in the Tcl_EvalFile path.
magic/Makefile: guard the TCL linker flags in the magic.js link rule
with ifneq (${TCL_LIB_DIR},). When building the non-TCL WASM variant
TCL_LIB_DIR is empty, so the unconditional -L${TCL_LIB_DIR} -ltclstub
expanded to a bare -L flag and a missing library, breaking the notcl
build.
Replace the last three intubun/tcl mentions with tcltk/tcl in
npm/tcl.js, toolchains/emscripten/build-tcl-wasm.sh, and npm/tcl.ref.
Also remove the stale comment in tcl.ref that referenced a non-existent
update-tcl GitHub Actions workflow.
Rename *-magic.tcl scripts to *-tcl.tcl to match the -tcl.js test naming
convention. Delete the old bare-command pcell.tcl (used cellname create,
no magic:: prefix) and promote pcell-magic.tcl to pcell.tcl.
Fix misleading comment in magicWasm.c: Tclmagic_Init only bootstraps the
interpreter; magic:: commands are registered separately by
TclmagicRegisterCommands after magicMainInit. Align comment block
dashes in TclmagicRegisterCommands to match tclmagic.c style (62 dashes).
Replace intubun/tcl references in build scripts and CI with tcltk/tcl to
match the actual pinned repo in npm/tcl.ref. Also run both test suites
when build.sh is invoked with --test.
All non-TCL tests (extract, gds, drc, cif) now also run against the TCL
variant using magic::-prefixed Tcl scripts. A new PCell test generates
two parameterized rectangle cells and verifies their GDS output.
The CI workflow runs npm run test:tcl after the TCL build and saves the
generated output files as an artifact.
magic_wasm_init() called Tclmagic_Init() and magicMainInit() but never
ran the command-registration loop in _magic_initialize(), so magic::tech,
magic::load, magic::gds and all other Magic commands were missing from
the Tcl interpreter.
Add TclmagicRegisterCommands() in tclmagic.c containing the
WindNextClient/WindGetCommandTable loop and call it from magic_wasm_init()
after magicMainInit() succeeds.
Also change magic_wasm_source_file() to use Tcl_EvalFile in MAGIC_WRAPPER
mode so scripts with magic:: commands are evaluated through the Tcl
interpreter instead of the plain text dispatcher.