Commit Graph

47 Commits

Author SHA1 Message Date
Darryl L. Miles 8b7e0aaec6 Makefile: whitespace only change 2025-07-29 10:50:32 -04:00
Darryl L. Miles 046401cbd8 Use HAVE_SYS_TIME_H and TIME_WITH_SYS_TIME from autoconf where possible 2025-07-27 12:43:04 -04:00
Darryl L. Miles df0623a435 include <unistd.h> where necessary in files using API calls
When global <sys/mman.h> was removed from tile.h it also removed
<unistd.h> nearby.  This exposes the lack of <unistd.h> being
included where needed using APIs like close()/read()/unlink()/isatty()
the WASM build seems to show this as the header file set is structured
differently.
2025-07-27 12:42:05 -04:00
Darryl L. Miles fd50bc1f4d TiJoin[XY]1 API introduction at all call sites 2025-07-27 12:42:05 -04:00
Darryl L. Miles 1a84eab4ce Plane[GS]etHint() added to encapsulate access to Plane->pl_hint
This is ground work to intercept usage and validate changes in
this area.

Fixed conflicts with earler patch in extract/ExtNghbors.c
2025-04-09 15:02:59 -04:00
Darryl L. Miles 606f37cc80 Ti[GS]etClient() usage enforcement
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*)
2025-04-09 14:55:58 -04:00
Darryl L. Miles e88dcba1c5 CodeQL File{MayNot,Never}BeClosed.ql file-handle resource leaks
Guided by CodeQL static code analyser.

FileMayNotBeClosed.ql
FileMayNeverBeClosed.ql

The trick with "if(fp != stdout)" is problematic (to analyser) as
technically 'stdout' can be a global pointer that COULD be modified any
time, so it might have changed between the fopen() and fclose() calls so
the close MAY NEVER occurs (which is problem the analyzer can see).

So local state is maintained as a bool which will also clarify to the
compiler see the intention without concern for external stdout
modification.

Some items appear to be out and out leaks when certain commands are use.
2025-02-22 21:02:49 -05:00
Darryl L. Miles 554327f1d3 plowSrShadowXxx() callback plowShowShadow() correct return type
was void, now int.
2025-02-22 20:58:59 -05:00
Darryl L. Miles 97ff043c1a plowInitRule() pass by-pointer const TileTypeBitMask* instead of by-value
sizeof(TileTypeBitMask) == 32
2025-02-22 20:58:59 -05:00
Darryl L. Miles 93054eb4e6 plowPropagateRect() pass by-pointer const TileTypeBitMask* instead of by-value
sizeof(TileTypeBitMask) == 32
2025-02-22 20:58:59 -05:00
Darryl L. Miles 8ee328811c plowSrShadowInitial() pass by-pointer const TileTypeBitMask* instead of by-value
sizeof(TileTypeBitMask) == 32
2025-02-22 20:58:59 -05:00
Darryl L. Miles 86bb97948f plowSrShadowBack() pass by-pointer const TileTypeBitMask* instead of by-value
sizeof(TileTypeBitMask) == 32
2025-02-22 20:58:59 -05:00
Darryl L. Miles cfd71f1b5d plowSrShadow() pass by-pointer const TileTypeBitMask* instead of by-value
sizeof(TileTypeBitMask) == 32
2025-02-22 20:58:59 -05:00
Darryl L. Miles d149c83a8a plowSrOutline() pass by-pointer const TileTypeBitMask* instead of by-value
sizeof(TileTypeBitMask) == 32
2025-02-22 20:58:59 -05:00
Darryl L. Miles cf0f9311ab plowFindWidthBack() pass by-pointer const TileTypeBitMask* instead of by-value
sizeof(TileTypeBitMask) == 32
2025-02-22 20:58:59 -05:00
Darryl L. Miles 2ff6d6113d plowFindWidth() pass by-pointer const TileTypeBitMask* instead of by-value
sizeof(TileTypeBitMask) == 32
2025-02-22 20:58:59 -05:00
Darryl L. Miles bc5a4a0fb1 Plow() pass by-pointer const TileTypeBitMask* instead of by-value
sizeof(TileTypeBitMask) == 32
2025-02-22 20:58:59 -05:00
Darryl L. Miles 6afadf9809 gcc11 -Wall -Wpedantic cleanup (post __attribute__) 2025-01-06 16:25:38 +00:00
Darryl L. Miles 0ce8265570 TCL9: ClientData macro assignment and access usage 2025-01-04 11:08:01 -05:00
Darryl L. Miles 79f2ab0f4b TCL9: ClientData macro header file changes
Header files documentation indicates the macros are of type ClientData
but previously did not cast to ensure that. So now follow this intention.
2025-01-04 11:08:01 -05:00
Darryl L. Miles 3dbcb0759e Lookup() constify call-site
plow/PlowCmd.c: Lookup() constify call-site
plot/plotVers.c: Lookup() constify call-site
plot/plotMain.c: Lookup() constify call-site
plot/plotCmd.c: Lookup() constify call-site
netmenu/NMnetlist.c: Lookup() constify call-site
netmenu/NMcmdLZ.c: Lookup() constify call-site
netmenu/NMcmdAK.c: Lookup() constify call-site
lef/lefTech.c: Lookup() constify call-site
lef/lefCmd.c: Lookup() constify call-site
irouter/irRoute.c: Lookup() constify call-site
irouter/irCommand.c: Lookup() constify call-site
router/rtrCmd.c: Lookup() constify call-site
resis/ResRex.c: Lookup() constify call-site
gcr/gcrShwFlgs.c: Lookup() constify call-site
windows/windCmdSZ.c: Lookup() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles 14b6453707 LookupStruct() constify call-site
irouter/irTestCmd.c: LookupStruct() constify call-site
irouter/irCommand.c: LookupStruct() constify call-site
mzrouter/mzTestCmd.c: LookupStruct() constify call-site
mzrouter/mzTech.c: LookupStruct() constify call-site
router/rtrCmd.c: LookupStruct() constify call-site
plow/PlowTest.c: LookupStruct() constify call-site
plow/PlowTech.c: LookupStruct() constify call-site
plot/plotVers.c: LookupStruct() constify call-site
grouter/grouteTest.c: LookupStruct() constify call-site
garouter/gaTest.c: LookupStruct() constify call-site
extract/ExtTest.c: LookupStruct() constify call-site
extract/ExtTech.c: LookupStruct() constify call-site
extflat/EFread.c: LookupStruct() constify call-site
DRCtech.c: LookupStruct() constify call-site
debugFlags.c: LookupStruct() constify call-site
CmdSubrs.c: LookupStruct() constify call-site
geometry.c: LookupStruct() constify call-site
set.c: LookupStruct() constify call-site
2024-12-26 15:20:58 -05:00
Darryl L. Miles 3919cc5b63 PlowRandom.c: warning: variable 'f2' is used uninitialized
PlowRandom.c:301:9: warning: variable 'f2' is used uninitialized whenever 'if' condition is true

clang18 -Wall warning cleanup [-Wsometimes-uninitialized]
2024-10-09 21:34:12 -04:00
Darryl L. Miles 76d8c8c911 35 x warning: suggest parentheses around assignment used as truth value
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]
2024-10-09 21:12:55 -04:00
Darryl L. Miles b654647fdc PlowTest.c: warning: enumeration value 'PC_ERROR' not handled in switch
False positive.

Added no-op case statement, but code above looks the case should never
execute due return from function.

GCC14 -Wall cleanup series [-Wswitch]
2024-10-09 21:12:55 -04:00
Darryl L. Miles 967b41343b GCC14: warning: missing braces around initializer
GCC14 -Wall cleanup series [-Wmissing-braces]
2024-10-09 21:12:55 -04:00
Darryl Miles 6946ea6845 plow/PlowTest.c: Wrong type of arguments to formatting function
Fix code scanning alert no. 106: Wrong type of arguments to formatting function (#30)

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2024-10-01 12:36:12 -04:00
Darryl Miles 384e59ea98 plow/PlowTest.c: Wrong type of arguments to formatting function
Fix code scanning alert no. 104: Wrong type of arguments to formatting function (#29)

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2024-10-01 12:36:12 -04:00
Darryl Miles 318993cb7b plow/PlowTest.c: Wrong type of arguments to formatting function
Fix code scanning alert no. 103: Wrong type of arguments to formatting function (#28)

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2024-10-01 12:36:12 -04:00
Johan Euphrosine 96eb275622 quick and dirty emscripten port 2023-07-12 00:31:37 +09:00
Alessandro De Laurenzis a4e65afae9 Add PlowShowTime prototype when NO_RUSAGE isn't defined
While there, change function's type from (implicit) int to void.
2023-01-08 13:06:12 -05: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
Anton Blanchard 73fee3e5fd Add missing types in function prototypes
It would be nice to convert the codebase from K&R to ANSI function
prototypes, but for now just clean up the warnings.
2022-01-10 14:04:37 -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 f84de3676a Moved the substrate plane/restore further out so that planes are
not restored until after all cells have been processed through
extraction.  Otherwise, top-down connections can end up with
different generated names for the same node, resulting in a
disconnect in the netlist.
2021-04-05 16:03:54 -04: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 2af38a4191 Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
Tim Edwards be1c0d1368 Merge branch 'master' into bplane
Conflicts:
	VERSION
	calma/Depend
	cif/Depend
	cmwind/Depend
	commands/Depend
	database/Depend
	dbwind/Depend
	debug/Depend
	drc/Depend
	ext2sim/Depend
	ext2spice/Depend
	extflat/Depend
	extract/Depend
	garouter/Depend
	gcr/Depend
	graphics/Depend
	grouter/Depend
	irouter/Depend
	lef/Depend
	lisp/Depend
	mzrouter/Depend
	netmenu/Depend
	plot/Depend
	plow/Depend
	resis/Depend
	router/Depend
	select/Depend
	sim/Depend
	tcltk/Depend
	textio/Depend
	tiles/Depend
	utils/Depend
	windows/Depend
	wiring/Depend

Merged recent changes from master branch into bplane branch.  Testing the
bplane implementation which has about a 5x improvement in extraction times
for large layouts, which is significant enough to move ahead with the bplane
implementation;  however, the bplane implementation has not been thoroughly
vetted yet, so it will remain a branch until such time that it has been
validated.
2020-03-15 13:23:24 -04:00
Tim Edwards 80fa495103 Removed the Depend files, which were being tracked with .gitignore
pointing to Depend instead of */Depend.
2020-03-13 15:39:08 -04:00
Tim Edwards 197c3f3448 Merge branch 'master' into bplane
Conflicts:
	commands/CmdCD.c
	database/DBcellsrch.c
	database/DBconnect.c
	database/DBio.c
	lef/lefRead.c
	select/selDisplay.c

Updated the bplane implementation with all recent updates (merged master).
2019-07-24 20:36:55 -04:00
Tim Edwards 1d04f20f5d Moved new work on magic-8.4 (experimental merging of micromagic bplane structure
into magic-8.2) into the newly-reorganized git repo as branch "bplane".
2019-03-22 19:58:47 -04:00
Tim Edwards 34ae6ea9cc Corrected error in technology file reloading that causes the plow
module to fill up its rules table and start printing errors about
the table overflow.  Tables are now properly reset on tech reload.
2018-12-14 16:33:34 -05:00
Tim Edwards dc49771220 Finished restoring the plow function to the original capability.
However, various updates are needed to match changes in magic
over the years, including handling of non-manhattan geometry,
and handling of added DRC rules such as surround and extend.
2018-04-01 22:00:57 -04:00
Tim Edwards 03933d7b26 Corrected problem with spacing rules. Only contact handling problem
remains.
2018-04-01 20:20:14 -04:00
Tim Edwards 9d8b43c934 Corrected the plow width rules. However, plow spacing rules seem
to be not quite right, and all sets of rules need to be updated
to match the latest DRC rule parsing.  Also, plowing does not
handle contact types correctly.
2018-04-01 20:05:26 -04:00
Tim Edwards 42ec70d4dc Re-implemented plow setup for the first time since about 2006,
enabling the "plow" command.  At this time, however, not all
rules are being implemented correctly given the numerous changes
to the DRC handling since the last time "plow" was working.  Fixes
are ongoing.
2018-04-01 14:40:10 -04:00
Tim Edwards 231a299b16 Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00