-- RouteChipmonkPlot.mesa -- cell subroutines to run within Chipmonk -- last changed by W Crowther, May 10, 1983 9:43 AM -- written by E. McCreight, September 16, 1982 1:46 PM DIRECTORY ChipUserInt, ppdddefs, ppddefs, ppdefs, RouteDefs, StringDefs; RouteChipmonkPlot: PROGRAM IMPORTS ChipUserInt, ppdddefs, ppddefs, ppdefs, RouteDefs, StringDefs EXPORTS RouteDefs = BEGIN GetChipmonkString: PUBLIC PROCEDURE[ result, prompt1: STRING, prompt2, prompt3: STRING ← NIL] = BEGIN s: STRING ← ChipUserInt.RequestString[prompt1, prompt2, prompt3 ! ChipUserInt.Punt => GOTO Punted]; result.length ← 0; StringDefs.AppendString[to: result, from: s]; ppdefs.FreeString[s]; EXITS Punted => ERROR RouteDefs.Interrupt; END; -- of GetChipmonkString PlotCell: PUBLIC PROCEDURE [cell: RouteDefs.CellPtr] = BEGIN OPEN ppdefs; cellOb: obPtr ← NIL; ob1: obPtr ← NIL; itemCount: INTEGER ← 0; itemList: listPtr ← NIL; item1: listPtr ←NIL; sx: locNum = Lambda*cell.sizeL.x; sy: locNum = Lambda*cell.sizeL.y; FOR s: RouteDefs.SignalListPtr ← cell.signals, s.t WHILE s#NIL DO signal: RouteDefs.SignalPtr = s.h; ob: obPtr = SELECT signal.level FROM blue => ppdddefs.makeWire[len: 3*Lambda, wid: 3*Lambda, l: met], red => ppdddefs.makeWire[len: 2*Lambda, wid: 2*Lambda, l: pol], ENDCASE --both-- => ppdddefs.makePolycon[0]; item: listPtr = ppdddefs.makeList[p: ob, x: (SELECT signal.side FROM n, s => Lambda*signal.offset, e => sx-ob.size[0], ENDCASE --w, x-- => 0), y: (SELECT signal.side FROM e, w => sy-Lambda*signal.offset-ob.size[1], n => 0, ENDCASE --s, x-- => sy-ob.size[1]), o: 0, refl: 0]; IF signal.name#NIL AND signal.name.length>0 THEN BEGIN tp: LONG POINTER TO text ppdefs.prop = ppddefs.alocTextProp[]; tp.s ← newString[signal.name]; ppdddefs.putProp[item, tp]; END; itemList ← ppddefs.insertList[itemList, item]; itemCount ← itemCount+1; ENDLOOP; ob1 ← ppdddefs.makeWire[len: sy, wid: 1*Lambda, l: pol]; item1 ← ppdddefs.makeList[p: ob1, x: 0, y: 0, o: 0, refl: 0]; itemList ← ppddefs.insertList[itemList, item1]; item1 ← ppdddefs.makeList[p: ob1, x: sx-1, y: 0, o: 0, refl: 0]; itemList ← ppddefs.insertList[itemList, item1]; ob1 ← ppdddefs.makeWire[len: sx, wid: 1*Lambda, l: pol]; item1 ← ppdddefs.makeList[p: ob1, x: 0, y: 0, o: 2, refl: 0]; itemList ← ppddefs.insertList[itemList, item1]; item1 ← ppdddefs.makeList[p: ob1, x: 0, y: sy-1, o: 2, refl: 0]; itemList ← ppddefs.insertList[itemList, item1]; itemCount ← itemCount+4; cellOb ← ppdddefs.makeCell[sx: sx, sy: sy, cnt: itemCount, ptr: itemList]; masterList ← ppddefs.insertList[masterList, ppdddefs.makeList[p: cellOb, x: Lambda*cell.pos.x, y: -Lambda*cell.pos.y-sy, o: 0, refl: 0]]; ppddefs.dChange ← TRUE; END; -- of PlotCell routeList: ppdefs.listPtr ← NIL; StartPlot: PUBLIC PROCEDURE = {routeList ← NIL}; EndPlot: PUBLIC PROCEDURE = BEGIN OPEN ppdefs; mix, miy, max, may: locNum; count: INTEGER ← 0; lp: LONG POINTER TO list; cellOb: obPtr; [mix, miy, max, may] ← minmax[routeList]; mix ← 0; miy ← -Lambda*RouteDefs.problem.chipSize.y; max ← Lambda*RouteDefs.problem.chipSize.x; may ← 0; FOR list: listPtr ← routeList, list.nxt WHILE list#NIL DO list.lx ← list.lx-mix; list.ly ← list.ly-miy; count ← count+1; ENDLOOP; cellOb ← ppdddefs.makeCell[sx: max-mix, sy: may-miy, cnt: count, ptr: routeList]; masterList ← ppddefs.insertList[masterList, lp←ppdddefs.makeList[p: cellOb, x: mix, y: miy, o: 0, refl: 0]]; ppddefs.dChange ← TRUE; routeList ← NIL; END; PlotBlueWire: PUBLIC PROCEDURE[hor: BOOLEAN, x,y,l: RouteDefs.Lambda] = BEGIN OPEN ppdefs; item: listPtr; wire: obPtr; IF l<=0 THEN ERROR; wire ← ppdddefs.makeWire[len: Lambda*l, wid: 3*Lambda, l: met]; item ← ppdddefs.makeList[p: wire, x: Lambda*x, y: -Lambda*y-wire.size[IF hor THEN 0 ELSE 1], o: (IF hor THEN 2 ELSE 0), refl: 0]; routeList ← ppddefs.insertList[routeList, item]; END; -- of PlotBlueWire PlotRedWire: PUBLIC PROCEDURE[hor: BOOLEAN, x,y,l: RouteDefs.Lambda] = BEGIN OPEN ppdefs; item: listPtr; wire: obPtr; IF l<=0 THEN ERROR; wire ← ppdddefs.makeWire[len: Lambda*l, wid: 2*Lambda, l: pol]; item ← ppdddefs.makeList[p: wire, x: Lambda*x, y: -Lambda*y-wire.size[IF hor THEN 0 ELSE 1], o: (IF hor THEN 2 ELSE 0), refl: 0]; routeList ← ppddefs.insertList[routeList, item]; END; -- of PlotRedWire PlotBlueRedContact: PUBLIC PROCEDURE[x,y: RouteDefs.Lambda] = BEGIN OPEN ppdefs; item: listPtr; cont: obPtr = ppdddefs.makePolycon[0]; item ← ppdddefs.makeList[p: cont, x: Lambda*x, y: -Lambda*y-cont.size[1], o: 0, refl: 0]; routeList ← ppddefs.insertList[routeList, item]; END; -- of PlotBlueRedContact Interrupt: PUBLIC ERROR = CODE; END. -- of RouteChipmonkPlot