diff --git a/.gitignore b/.gitignore index 73ae5353..50ebaf94 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,19 @@ scripts/defs.mak *~ scmos/cif_template/objs/* UPDATE_ME +VERSION +database/database.h +install.log +magic/proto.magicrc +make.log +readline/readline +scmos/gdsquery.tech +scmos/minimum.tech +scmos/scmos-sub.tech +scmos/scmos-tm.tech +scmos/scmos.tech +scmos/scmosWR.tech +tcltk/magic.sh +tcltk/magic.tcl +tcltk/magicdnull +tcltk/magicexec diff --git a/COPYRIGHT b/LICENSE similarity index 100% rename from COPYRIGHT rename to LICENSE diff --git a/commands/CmdFI.c b/commands/CmdFI.c index 178fe9ee..f50e600e 100644 --- a/commands/CmdFI.c +++ b/commands/CmdFI.c @@ -1792,6 +1792,7 @@ FlatCopyAllLabels(scx, mask, xMask, targetUse) char pathstring[FLATTERMSIZE]; TerminalPath tpath; + pathstring[0] = '\0'; tpath.tp_first = tpath.tp_next = pathstring; tpath.tp_last = pathstring + FLATTERMSIZE; diff --git a/database/DBcellsrch.c b/database/DBcellsrch.c index a960bf2e..d3eaa667 100644 --- a/database/DBcellsrch.c +++ b/database/DBcellsrch.c @@ -581,8 +581,11 @@ DBTreeSrLabels(scx, mask, xMask, tpath, flags, func, cdarg) else is_touching = GEO_TOUCH(&lab->lab_rect, r); } - if (!is_touching && (flags & TF_LABEL_DISPLAY) && (lab->lab_font >= 0)) + if (!is_touching && (flags & TF_LABEL_DISPLAY) && lab->lab_font >= 0) + { + /* Check against bounds of the rendered label text */ is_touching = GEO_TOUCH(&lab->lab_bbox, r); + } if (is_touching && TTMaskHasType(mask, lab->lab_type)) if ((*func)(scx, lab, tpath, cdarg)) diff --git a/database/DBconnect.c b/database/DBconnect.c index f1f5a6ab..f81446bd 100644 --- a/database/DBconnect.c +++ b/database/DBconnect.c @@ -656,6 +656,9 @@ dbcUnconnectFunc(tile, clientData) * ---------------------------------------------------------------------------- */ +/* To do: Make the tpath entries dynamically allocated */ +#define FLATTERMSIZE 1024 + int dbcConnectLabelFunc(scx, lab, tpath, csa2) SearchContext *scx; @@ -667,6 +670,8 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2) Rect r; Point offset; int pos, rotate; + char newlabtext[FLATTERMSIZE]; + char *newlabptr; int dbcConnectFunc(); /* Forward declaration */ GeoTransRect(&scx->scx_trans, &lab->lab_rect, &r); @@ -677,12 +682,29 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2) /* Only add labels if they are on the search top level */ /* (NOTE: Could add hierachical labels using tpath) */ - if (scx->scx_use == csa2->csa2_topscx->scx_use) + if (scx->scx_use != csa2->csa2_topscx->scx_use) { - DBEraseLabelsByContent(def, &r, -1, lab->lab_text); - DBPutFontLabel(def, &r, lab->lab_font, lab->lab_size, rotate, &offset, - pos, lab->lab_text, lab->lab_type, lab->lab_flags); + int newllen = tpath->tp_next - tpath->tp_first; + newlabtext[0] = '\0'; + if (newllen > 0) + strncpy(newlabtext, tpath->tp_first, newllen); + sprintf(newlabtext + newllen, "%s", lab->lab_text); + newlabptr = newlabtext; } + else + newlabptr = lab->lab_text; + + /* Do not repeat a label copy; check that the label doesn't */ + /* already exist in the destination def first. */ + if (DBCheckLabelsByContent(def, &r, lab->lab_type, lab->lab_text)) + return 0; + + if (DBCheckLabelsByContent(def, &r, lab->lab_type, newlabptr)) + return 0; + + DBEraseLabelsByContent(def, &r, -1, lab->lab_text); + DBPutFontLabel(def, &r, lab->lab_font, lab->lab_size, rotate, &offset, + pos, newlabptr, lab->lab_type, lab->lab_flags); if (lab->lab_flags & PORT_DIR_MASK) { @@ -1019,6 +1041,13 @@ DBTreeCopyConnect(scx, mask, xMask, connect, area, destUse) DBTreeSrTiles(scx, mask, xMask, dbcConnectFunc, (ClientData) &csa2); while (csa2.csa2_top >= 0) { + char pathstring[FLATTERMSIZE]; + TerminalPath tpath; + + tpath.tp_first = tpath.tp_next = pathstring; + tpath.tp_last = pathstring + FLATTERMSIZE; + pathstring[0] = '\0'; + newmask = csa2.csa2_list[csa2.csa2_top].connectMask; scx->scx_area = csa2.csa2_list[csa2.csa2_top].area; newtype = csa2.csa2_list[csa2.csa2_top].dinfo; @@ -1059,7 +1088,7 @@ DBTreeCopyConnect(scx, mask, xMask, connect, area, destUse) searchtype |= TF_LABEL_ATTACH_NOT_SE; } } - DBTreeSrLabels(scx, newmask, xMask, NULL, searchtype, + DBTreeSrLabels(scx, newmask, xMask, &tpath, searchtype, dbcConnectLabelFunc, (ClientData) &csa2); } freeMagic((char *)csa2.csa2_list); diff --git a/database/DBlabel.c b/database/DBlabel.c index 6fb058dd..9e95d2d5 100644 --- a/database/DBlabel.c +++ b/database/DBlabel.c @@ -313,7 +313,55 @@ DBEraseLabel(cellDef, area, mask, areaReturn) cellDef->cd_flags |= CDMODIFIED|CDGETNEWSTAMP; return (erasedAny); } - + +#define RECTEQUAL(r1, r2) ((r1)->r_xbot == (r2)->r_xbot \ + && (r1)->r_ybot == (r2)->r_ybot \ + && (r1)->r_xtop == (r2)->r_xtop \ + && (r1)->r_ytop == (r2)->r_ytop) + +/* + * ---------------------------------------------------------------------------- + * + * DBCheckLabelsByContent -- + * + * Return any label found on the label list for the given + * CellDef that matches the given specification. + * + * Results: + * Returns a label if a match is found, otherwise returns NULL. + * + * Side effects: + * None. + * + * ---------------------------------------------------------------------------- + */ + +Label * +DBCheckLabelsByContent(def, rect, type, text) + CellDef *def; /* Where to look for label to delete. */ + Rect *rect; /* Coordinates of label. If NULL, then + * labels are searched regardless of coords. + */ + TileType type; /* Layer label is attached to. If < 0, then + * labels are searched regardless of type. + */ + char *text; /* Text associated with label. If NULL, then + * labels are searched regardless of text. + */ +{ + Label *lab; + + for (lab = def->cd_labels; lab; lab = lab->lab_next) + { + if ((rect != NULL) && !(RECTEQUAL(&lab->lab_rect, rect))) continue; + if ((type >= 0) && (type != lab->lab_type)) continue; + if ((text != NULL) && (strcmp(text, lab->lab_text) != 0)) continue; + + return lab; + } + return NULL; +} + /* * ---------------------------------------------------------------------------- * @@ -348,11 +396,6 @@ DBEraseLabelsByContent(def, rect, type, text) { Label *lab, *labPrev; -#define RECTEQUAL(r1, r2) ((r1)->r_xbot == (r2)->r_xbot \ - && (r1)->r_ybot == (r2)->r_ybot \ - && (r1)->r_xtop == (r2)->r_xtop \ - && (r1)->r_ytop == (r2)->r_ytop) - for (labPrev = NULL, lab = def->cd_labels; lab != NULL; labPrev = lab, lab = lab->lab_next) diff --git a/dbwind/DBWdisplay.c b/dbwind/DBWdisplay.c index 8ea1b3bd..0ccb80ea 100644 --- a/dbwind/DBWdisplay.c +++ b/dbwind/DBWdisplay.c @@ -418,7 +418,7 @@ DBWredisplay(w, rootArea, clipArea) /* Set style information beforehand */ GrSetStuff(STYLE_LABEL); (void) DBTreeSrLabels(&scontext, &DBAllTypeBits, bitMask, - (TerminalPath *) NULL, TF_LABEL_DISPLAY, + (TerminalPath *) NULL, TF_LABEL_DISPLAY | TF_LABEL_ATTACH, dbwLabelFunc, (ClientData) NULL); GrClipTo(&rootClip); } diff --git a/ext2sim/ext2sim.c b/ext2sim/ext2sim.c index 897e4f31..4efe627e 100644 --- a/ext2sim/ext2sim.c +++ b/ext2sim/ext2sim.c @@ -1078,7 +1078,7 @@ simdevVisit(dev, hierName, scale, trans) { putc(' ', esSimF); simdevSubstrate(hierName, subnode->efnode_name->efnn_hier, - dev->dev_type, 0, FALSE, esSimF); + dev->dev_type, 0.0, FALSE, esSimF); } GeoTransRect(trans, &dev->dev_rect, &r); @@ -1196,7 +1196,8 @@ int simdevSubstrate( prefix, suffix, type, scale, doAP, outf) HierName *prefix; HierName *suffix; -int type, scale; +int type; +float scale; bool doAP; FILE *outf; { @@ -1264,7 +1265,8 @@ FILE *outf; bool simnAP(node, resClass, scale, outf) EFNode *node; -int resClass, scale; +int resClass; +float scale; FILE *outf; { int a, p; @@ -1277,8 +1279,8 @@ FILE *outf; return FALSE; } markVisited((nodeClient *)node->efnode_client, resClass); - a = node->efnode_pa[resClass].pa_area*scale*scale; - p = node->efnode_pa[resClass].pa_perim*scale; + a = (int)(node->efnode_pa[resClass].pa_area*scale*scale); + p = (int)(node->efnode_pa[resClass].pa_perim*scale); if ( a < 0 ) a = 0; if ( p < 0 ) p = 0; fprintf(outf,"A_%d,P_%d", a, p); @@ -1288,7 +1290,8 @@ FILE *outf; bool simnAPHier(dterm, hierName, resClass, scale, outf) DevTerm *dterm; HierName *hierName; - int resClass, scale; + int resClass; + float scale; FILE *outf; { EFNode *node = dterm->dterm_node; @@ -1308,8 +1311,8 @@ bool simnAPHier(dterm, hierName, resClass, scale, outf) return FALSE; } markVisited((nodeClientHier *)node->efnode_client, resClass); - a = node->efnode_pa[resClass].pa_area*scale*scale; - p = node->efnode_pa[resClass].pa_perim*scale; + a = (int)(node->efnode_pa[resClass].pa_area*scale*scale); + p = (int)(node->efnode_pa[resClass].pa_perim*scale); if ( a < 0 ) a = 0; if ( p < 0 ) p = 0; fprintf(outf,"A_%d,P_%d", a, p); diff --git a/graphics/grTCairo1.c b/graphics/grTCairo1.c index 7e293d2f..e84789a0 100644 --- a/graphics/grTCairo1.c +++ b/graphics/grTCairo1.c @@ -370,6 +370,9 @@ GrTCairoPlotSVG (char *filename, MagWindow *mw) wind_context = tcairodata->context; tcairodata->surface = (cairo_surface_t *)cairo_svg_surface_create(filename, (double)screenw, (double)screenh); + cairo_svg_surface_restrict_to_version(tcairodata->surface, + CAIRO_SVG_VERSION_1_2); + tcairodata->context = cairo_create(tcairodata->surface); WindRedisplay(mw); WindUpdate(); diff --git a/magic/Makefile b/magic/Makefile index 2079bca5..4dc62515 100644 --- a/magic/Makefile +++ b/magic/Makefile @@ -19,7 +19,7 @@ EXTRA_LIBS = ${MAGICDIR}/cmwind/libcmwind.o ${MAGICDIR}/commands/libcommands.o \ ${MAGICDIR}/plow/libplow.o ${MAGICDIR}/utils/libutils.o \ ${MAIN_EXTRA_LIBS} -BITMAPS = up.xbm down.xbm left.xbm right.xbm zoom.xbm lock.xbm +BITMAPS = up.png down.png left.png right.png zoom.png lock.xbm DEST_XBM = $(BITMAPS:%=$(DESTDIR)${INSTALL_TCLDIR}/bitmaps/%) DFLAGS += -DMAGIC_DATE="\"`date`\"" -DCAD_DIR="${LIBDIR}" diff --git a/magic/bitmaps/down.png b/magic/bitmaps/down.png new file mode 100644 index 00000000..78c99518 Binary files /dev/null and b/magic/bitmaps/down.png differ diff --git a/magic/bitmaps/left.png b/magic/bitmaps/left.png new file mode 100644 index 00000000..dd63f521 Binary files /dev/null and b/magic/bitmaps/left.png differ diff --git a/magic/bitmaps/right.png b/magic/bitmaps/right.png new file mode 100644 index 00000000..4ae31e9c Binary files /dev/null and b/magic/bitmaps/right.png differ diff --git a/magic/bitmaps/up.png b/magic/bitmaps/up.png new file mode 100644 index 00000000..cbe44973 Binary files /dev/null and b/magic/bitmaps/up.png differ diff --git a/magic/bitmaps/zoom.png b/magic/bitmaps/zoom.png new file mode 100644 index 00000000..7d0f4484 Binary files /dev/null and b/magic/bitmaps/zoom.png differ diff --git a/tcltk/Makefile b/tcltk/Makefile index a6619678..efa12d00 100644 --- a/tcltk/Makefile +++ b/tcltk/Makefile @@ -24,7 +24,6 @@ TCL_FILES = \ tools.tcl \ mazeroute.tcl \ strip_reflibs.tcl \ - drc.tcl \ toolkit.tcl \ toolkit_rev0.tcl \ bsitools.tcl \ @@ -50,11 +49,13 @@ install-tcl: magicexec magicdnull ${BIN_FILES} ${TCL_FILES} magicexec: magicexec.c ${MAGICDIR}/defs.mak ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS_NOSTUB} ${LDFLAGS} magicexec.c \ - -o magicexec ${LD_RUN_PATH} ${LIBS} ${LIB_SPECS_NOSTUB} + -o magicexec ${LD_RUN_PATH} ${LIB_SPECS_NOSTUB} ${LIBS} \ + ${GR_LIBS} magicdnull: magicdnull.c ${MAGICDIR}/defs.mak ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS_NOSTUB} ${LDFLAGS} magicdnull.c \ - -o magicdnull ${LD_RUN_PATH} ${LIBS} ${LIB_SPECS_NOSTUB} + -o magicdnull ${LD_RUN_PATH} ${LIB_SPECS_NOSTUB} ${LIBS} \ + ${GR_LIBS} magic.tcl: magic.tcl.in ${MAGICDIR}/defs.mak sed -e /TCL_DIR/s%TCL_DIR%${TCLDIR}%g \ diff --git a/tcltk/drc.tcl b/tcltk/drc.tcl deleted file mode 100644 index 3820b925..00000000 --- a/tcltk/drc.tcl +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/tclsh -#---------------------------------------------- -# Dump a file of DRC errors from magic -#---------------------------------------------- -namespace path {::tcl::mathop ::tcl::mathfunc} - -magic::suspendall -set fout [open "drc.out" w] -set oscale [cif scale out] - -select top cell -set origcell [cellname list self] -drc check -set celllist [drc list count] -puts stdout "celllist is $celllist" -puts stdout "" -flush stdout -foreach pair $celllist { - set cellname [lindex $pair 0] - set count [lindex $pair 1] - puts stdout "loading $cellname" - flush stdout - - load $cellname - select top cell - puts $fout "$cellname $count" - puts $fout "----------------------------------------" - set drcresult [drc listall why] - foreach {errtype coordlist} $drcresult { - puts $fout $errtype - puts $fout "----------------------------------------" - foreach coord $coordlist { - set bllx [* $oscale [lindex $coord 0]] - set blly [* $oscale [lindex $coord 1]] - set burx [* $oscale [lindex $coord 2]] - set bury [* $oscale [lindex $coord 3]] - set coords [format "%.3f %.3f %.3f %.3f" $bllx $blly $burx $bury] - puts $fout "$coords" - } - puts $fout "----------------------------------------" - } - puts $fout "" -} -close $fout -load $origcell -magic::resumeall diff --git a/tcltk/drcmgr.tcl b/tcltk/drcmgr.tcl index abf9277f..3f46203e 100644 --- a/tcltk/drcmgr.tcl +++ b/tcltk/drcmgr.tcl @@ -101,11 +101,13 @@ proc magic::makedrcmanager { mgrpath } { -command {magic::drccallback update} button ${mgrpath}.actionbar.last -text "Last" -command {magic::drccallback last} button ${mgrpath}.actionbar.next -text "Next" -command {magic::drccallback next} + button ${mgrpath}.actionbar.save -text "Save" -command {magic::drc_save_report} button ${mgrpath}.actionbar.zoom -text "Zoom" -command {magic::drccallback zoom} pack ${mgrpath}.actionbar.update -side left pack ${mgrpath}.actionbar.last -side left pack ${mgrpath}.actionbar.next -side left + pack ${mgrpath}.actionbar.save -side left pack ${mgrpath}.actionbar.zoom -side right label ${mgrpath}.target.name -text "Target window:" @@ -150,7 +152,6 @@ proc magic::adddrcentry {key valuelist} { } } - #-------------------------------------------------------------- # The cell manager window main callback function #-------------------------------------------------------------- @@ -193,3 +194,107 @@ proc magic::drcmanager {{option "update"}} { } ;# (if Tk version 8.5) +#--------------------------------------------------- +# Alternative way to view/save DRC errors in magic. +# Dump a text file of errors and positions. Note +# that the dump, using "drc listall why", enumerates +# every single edge check and is therefore more +# detailed than the areas declared by "drc count" +# or enumerated in "drc find". +#--------------------------------------------------- + +proc magic::drc_save_report {{cellname ""} {outfile ""}} { + + if {$outfile == ""} {set outfile "drc.out"} + + set fout [open $outfile w] + set oscale [cif scale out] + + # magic::suspendall + + if {$cellname == ""} { + select top cell + set cellname [cellname list self] + set origname "" + } else { + set origname [cellname list self] + puts stdout "loading $cellname\n" + flush stdout + + load $cellname + select top cell + } + + drc check + set count [drc list count] + + puts $fout "$cellname $count" + puts $fout "----------------------------------------" + set drcresult [drc listall why] + foreach {errtype coordlist} $drcresult { + puts $fout $errtype + puts $fout "----------------------------------------" + foreach coord $coordlist { + set bllx [expr {$oscale * [lindex $coord 0]}] + set blly [expr {$oscale * [lindex $coord 1]}] + set burx [expr {$oscale * [lindex $coord 2]}] + set bury [expr {$oscale * [lindex $coord 3]}] + set coords [format " %.3f %.3f %.3f %.3f" $bllx $blly $burx $bury] + puts $fout "$coords" + } + puts $fout "----------------------------------------" + } + puts $fout "" + + if {$origname != ""} { + load $origname + } + + # magic::resumeall + + close $fout + puts stdout "done with $outfile\n" + flush stdout +} + +#--------------------------------------------------- +# Read back a dumped file of DRC errors. This is of +# limited use, as any layout should have DRC errors +# already marked. This routine loads errors into +# "feedback" areas, which is redundant to the error +# tiles. However, feedback areas are more precise, +# as they mark the error area at each checked edge +#--------------------------------------------------- + +proc magic::drc_load_report {{drc_file ""}} { + + if {$drc_file == ""} { + set drc_file "drc.out" + } + set fin [open $drc_file r] + + puts stdout "Reading $drc_file\n" + flush stdout + + magic::suspendall + + set error_text "" + while {[gets $fin line] >= 0} { + if {[string first " " $line] == 0} { + if [regexp { ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)} $line lmatch llx lly urx ury] { + feedback add "$error_text" vert_highlights ${llx}um ${lly}um \ + ${llx}um ${ury}um ${urx}um ${ury}um ${urx}um ${lly}um + } + } elseif {[string first "-" $line] != 0} { + set error_text $line + } + } + magic::resumeall + + close $fin + + puts stdout "Done.\n" + puts stdout "Use \"feedback find\" to enumerate errors.\n" + flush stdout +} + diff --git a/tcltk/ext2sim.sh b/tcltk/ext2sim.sh index b1c98edd..8bd40c31 100644 --- a/tcltk/ext2sim.sh +++ b/tcltk/ext2sim.sh @@ -15,7 +15,7 @@ for i in $@; do esac done # -eval /home/tim/cad/lib/magic/tcl/magicdnull -dnull -noconsole -nowrapper $mgargs < "magic::setscroll %W %$orient $orient" ${fname}.bar bind centre "magic::scrollview %W $win $orient" ${fname}.bar bind centre "magic::dragscroll %W %$orient $orient" @@ -1123,12 +1154,14 @@ proc magic::openwrapper {{cell ""} {framename ""}} { pack ${framename}.pane -side top -fill both -expand true - frame ${layoutframe}.xscroll -height 13 - frame ${layoutframe}.yscroll -width 13 + set swidth [expr {int($Opts(scale) * 13)}] + frame ${layoutframe}.xscroll -height $swidth + frame ${layoutframe}.yscroll -width $swidth + magic::makeglyphimages magic::makescrollbar ${layoutframe}.xscroll x ${winname} magic::makescrollbar ${layoutframe}.yscroll y ${winname} - button ${layoutframe}.zb -image $Glyph(zoom) -borderwidth 1 -command "${winname} zoom 2" + button ${layoutframe}.zb -image Glyph(zoom) -borderwidth 1 -command "${winname} zoom 2" # Add bindings for mouse buttons 2 and 3 to the zoom button bind ${layoutframe}.zb "${winname} zoom 0.5" diff --git a/utils/Depend b/utils/Depend index 4f469cb1..56e88bb4 100644 --- a/utils/Depend +++ b/utils/Depend @@ -2,9 +2,7 @@ args.o: args.c ../utils/magic.h ../utils/utils.h child.o: child.c ../utils/utils.h ../utils/magic.h ../utils/malloc.h dqueue.o: dqueue.c ../utils/magic.h ../utils/dqueue.h ../utils/malloc.h finddisp.o: finddisp.c ../utils/magic.h ../utils/utils.h -flock.o: flock.c ../utils/magic.h ../utils/hash.h ../utils/geometry.h \ - ../tiles/tile.h ../database/database.h ../windows/windows.h \ - ../utils/malloc.h +flock.o: flock.c flsbuf.o: flsbuf.c fraction.o: fraction.c ../utils/magic.h ../utils/geometry.h geometry.o: geometry.c ../utils/magic.h ../utils/geometry.h \