From adb4d2613d0db8aa4b60d529134e62430f907441 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 20 Nov 2019 13:01:14 -0500 Subject: [PATCH] Added indexed selection to the PDK toolkit script (returns an index from a selection, which can then be used to index into other lists. This lets one selection be made on a list of arbitrary names, and then additional parameters can be linked together with the same index). Also, implemented (finally!) the "offset" parameters of the "slots" function (as advertised in the documentation). --- cif/CIFgen.c | 9 ++++++--- tcltk/toolkit.tcl | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/cif/CIFgen.c b/cif/CIFgen.c index 9c95f983..d2af4afb 100644 --- a/cif/CIFgen.c +++ b/cif/CIFgen.c @@ -1790,7 +1790,7 @@ cifSlotsFillArea(op, cellDef, plane) { Tile *tile, *t, *tp; Rect bbox, area, square, cut, llcut; - int nAcross, nUp, left, spitch, lpitch, ssize, lsize; + int nAcross, nUp, left, spitch, lpitch, ssize, lsize, offset; int diff, right; int xpitch, ypitch, xborder, yborder, xdiff, ydiff; int i, j, k, savecount; @@ -2017,10 +2017,11 @@ cifSlotsFillArea(op, cellDef, plane) /* For each contact cut area, check that there is */ /* no whitespace */ + offset = 0; for (i = 0; i < nUp; i++) { - cut.r_xbot = llcut.r_xbot; - cut.r_xtop = llcut.r_xtop; + cut.r_xbot = llcut.r_xbot + offset; + cut.r_xtop = llcut.r_xtop + offset; square.r_ybot = cut.r_ybot - yborder; square.r_ytop = cut.r_ytop + yborder; @@ -2047,6 +2048,8 @@ cifSlotsFillArea(op, cellDef, plane) } cut.r_ybot += ypitch; cut.r_ytop += ypitch; + offset += slots->sl_offset; + if (offset >= xpitch) offset -= xpitch; } if (savecount != CIFTileOps) break; diff --git a/tcltk/toolkit.tcl b/tcltk/toolkit.tcl index 7412277a..9ca83264 100644 --- a/tcltk/toolkit.tcl +++ b/tcltk/toolkit.tcl @@ -628,6 +628,38 @@ proc magic::add_selectlist {pname ptext all_values parameters} { set magic::${pname}_val $value } +#---------------------------------------------------------- +# Add a selectable-list parameter to the gencell window +# Unlike the routine above, it returns the index of the +# selection, not the selection itself. This is useful for +# keying the selection to other parameter value lists. +#---------------------------------------------------------- + +proc magic::add_selectindex {pname ptext all_values parameters} { + + if [dict exists $parameters $pname] { + set value [dict get $parameters $pname] + } else { + set value 0 + } + + set numrows [lindex [grid size .params.edits] 1] + label .params.edits.${pname}_lab -text $ptext + menubutton .params.edits.${pname}_sel -menu .params.edits.${pname}_sel.menu \ + -relief groove -text [lindex ${all_values} ${value}] + grid .params.edits.${pname}_lab -row $numrows -column 0 -sticky ens + grid .params.edits.${pname}_sel -row $numrows -column 1 -sticky wns + menu .params.edits.${pname}_sel.menu -tearoff 0 + set idx 0 + foreach item ${all_values} { + .params.edits.${pname}_sel.menu add radio -label $item \ + -variable magic::${pname}_val -value $idx \ + -command ".params.edits.${pname}_sel configure -text $item" + incr idx + } + set magic::${pname}_val $value +} + #------------------------------------------------------------- # gencell_defaults --- #