<> <> <> <> <<>> <<>> DIRECTORY CStitching, IO, Jasmine, Real, Rope, SymTab, TerminalIO; JasmineNetwork: CEDAR PROGRAM IMPORTS CStitching, IO, Real, SymTab, TerminalIO = BEGIN OPEN Jasmine, Real; AspectType: TYPE = {vert, horiz, square}; BranchType: TYPE = {none, leftT, rightT, inverseT, T, L, reverseL, inverseL, inverseRevL, straight, fourWay}; JasmineModelLocation: TYPE = RECORD [row: INT, col: INT]; JasmineMacro: TYPE = REF JasmineMacroRec; JasmineMacroRec: TYPE = RECORD [ macroType: JasmineObject _ polyCont, JMapLoc: JasmineModelLocation _ [0, 0], wireAspect: AspectType _ vert, branch: BranchType _ T, resistance: REAL _ 0.0, capacitance: REAL _ 0.0, inductance: REAL _ 0.0, <> xtorCount: INT _ 0 ]; resolution: INT _ 4; Volts: TYPE = REAL; kOhm: TYPE = REAL; pF: TYPE = REAL; mA: TYPE = REAL; uH: TYPE = REAL; ScaleMap: PROC [tile: CStitching.Tile] RETURNS [loc: JasmineModelLocation] = { lambda: INT _ 8; x, y, scale: INT _ 0; r: CStitching.Rect _ CStitching.Area[tile]; IF resolution<1 THEN resolution_1; scale _ resolution*lambda; x _ Round[Float[r.x1+(r.x2-r.x1)/2]/scale]; y _ Round[Float[r.y1+(r.y2-r.y1)/2]/scale]; IF x<1 THEN x_1; IF y<1 THEN y_1; IF x>INT.LAST THEN x_INT.LAST; IF y>INT.LAST THEN y_INT.LAST; loc _ [x, y]; }; CreateModel: PROC [tesselation: CStitching.Tesselation] RETURNS [model: SymTab.Ref] = { InsertMacro: CStitching.TileProc --PROC [tile: Tile, data: REF]-- = { JLayer: JasmineObjectInLayer _ NARROW[tile.value]; JObject: JasmineObject _ JLayer.object; r: CStitching.Rect _ CStitching.Area[tile]; AccumulateTransistor: PROC [] = { }; AspectRatio: PROC RETURNS [ar: AspectType] = { -- Rect: TYPE = RECORD [x1, y1, x2, y2: INT]; ar _ SELECT TRUE FROM (r.x2-r.x1)>(r.y2-r.y1) => horiz, (r.x2-r.x1)<(r.y2-r.y1) => vert, ENDCASE => square; }; Branching: PROC RETURNS [branch: BranchType] = { tWest, tEast, tSouth, tNorth: CStitching.Tile; N, S, E, W: INT _ 0; tEast _ CStitching.NE[tile]; IF tEast.value#NIL THEN E _ 1; TRUSTED {tSouth _ LOOPHOLE[tile.wS]}; IF tSouth.value#NIL THEN S _ 1; tWest _ CStitching.SW[tile]; IF tWest.value#NIL THEN W _ 1; TRUSTED {tNorth _ LOOPHOLE[tile.eN]}; IF tNorth.value#NIL THEN N _ 1; SELECT (N+S+E+W) FROM 4 => branch _ fourWay; 3 => SELECT TRUE FROM N+(E+W)=3 => branch _ inverseT; N+(E+S)=3 => branch _ rightT; N+(W+S)=3 => branch _ leftT; S+(E+W)=3 => branch _ T; ENDCASE => NULL; 2 => SELECT TRUE FROM N+S=2 => branch _ straight; N+E=2 => branch _ L; N+W=2 => branch _ reverseL; S+E=2 => branch _ inverseL; S+W=2 => branch _ inverseRevL; ENDCASE => NULL; 1 => branch _ straight; ENDCASE => NULL; }; ContactResistance: PROC RETURNS [R: kOhm] = { R _ SELECT JObject FROM nDifCont => 30*1E-3, pDifCont => 120*1E-3, polyCont => 25*1E-3, ENDCASE --Via-- => 1E-3; }; WireResistance: PROC RETURNS [R: kOhm] = { Squares: PROC [CStitching.Rect] RETURNS [sqrs: REAL] = { len: INT _ (r.x2-r.x1); wid: INT _ (r.y2-r.y1); IF len > wid THEN sqrs _ Real.Float[len]/wid ELSE sqrs _ Real.Float[wid]/len; }; <> m1Resistivity: REAL _ 0.065; m2Resistivity: REAL _ 0.042; polyResistivity: REAL _ 3.5; nDifResistivity: REAL _ 35; pDifResistivity: REAL _ 120; R _ SELECT JObject FROM m1Wire => Squares[r]*m1Resistivity*1E-3, m2Wire => Squares[r]*m2Resistivity*1E-3, polyWire => Squares[r]*polyResistivity*1E-3, nDifWire => Squares[r]*nDifResistivity*1E-3, ENDCASE => Squares[r]*pDifResistivity*1E-3 }; WireInductance: PROC RETURNS [L: uH] = { }; WireCapacitance: PROC RETURNS [C: pF] = { }; symbol: Rope.ROPE; jasmineMacro: JasmineMacro _ NEW[JasmineMacroRec]; jasmineMacro.macroType _ JObject; SELECT jasmineMacro.macroType FROM m1Wire, m2Wire, nDifWire, pDifWire, polyWire => { jasmineMacro.wireAspect _ AspectRatio[]; jasmineMacro.resistance _ WireResistance[]; jasmineMacro.inductance _ WireInductance[]; jasmineMacro.capacitance _ WireCapacitance[]; jasmineMacro.branch _ Branching[]; }; nDifCont, pDifCont, polyCont, Via => { jasmineMacro.resistance _ ContactResistance[]; jasmineMacro.branch _ Branching[]; }; nTran, nTranL, pTran, pTranL => {AccumulateTransistor[];}; ENDCASE => NULL; symbol _ MapCovert[jasmineMacro.JMapLoc _ ScaleMap[tile]]; [] _ SymTab.Store[x: model, key: symbol, val: jasmineMacro]; }; --InsertMacro model _ SymTab.Create[]; CStitching.EnumerateArea[plane: tesselation, rect: CStitching.all, eachTile: InsertMacro]; PrintModel[model]; }; --CreateModel MapCovert: PROC [jml: JasmineModelLocation] RETURNS [sym: Rope.ROPE] = { sym _ IO.PutFR["[%g, %g]", IO.int[jml.row], IO.int[jml.col]]; }; PrintModel: PROC [model: SymTab.Ref] = { PrintMacro: PROC = { FOR i: INT IN [0..model.size] DO searchLocation.row _ i; FOR j: INT IN [0..model.size] DO searchLocation.col _ j; [thereIs, val] _ SymTab.Fetch[model, MapCovert[searchLocation]]; IF thereIs THEN { macro: JasmineMacro _ NARROW[val]; TerminalIO.WriteRope["\nMacro: "]; TerminalIO.WriteRope[MapCovert[macro.JMapLoc]]; SELECT macro.macroType FROM m1Wire, m2Wire, nDifWire, pDifWire, polyWire => { IF macro.wireAspect=vert THEN TerminalIO.WriteRope[" | "] ELSE TerminalIO.WriteRope[" -- "]; TerminalIO.WriteF[" %g K ", IO.real[macro.resistance]]; }; nDifCont, pDifCont, polyCont, Via => { SELECT macro.branch FROM leftT => TerminalIO.WriteRope[" --| "]; rightT=> TerminalIO.WriteRope[" |-- "]; inverseT=> TerminalIO.WriteRope[" L "]; T=> TerminalIO.WriteRope[" T "]; L => TerminalIO.WriteRope[" L "]; reverseL => TerminalIO.WriteRope[" _L "]; inverseL => TerminalIO.WriteRope[" F "]; inverseRevL => TerminalIO.WriteRope[" _F "]; straight => TerminalIO.WriteRope[" * "]; fourWay=> TerminalIO.WriteRope[" + "]; ENDCASE => NULL; TerminalIO.WriteF[" %g K ", IO.real[macro.resistance]]; }; nTran, nTranL, pTran, pTranL => TerminalIO.WriteRope[" -[ "]; ENDCASE => NULL; macroCount _ macroCount.SUCC; }; ENDLOOP; ENDLOOP; }; val: REF ANY; thereIs: BOOL; macroCount: INT _ 0; searchLocation: JasmineModelLocation; PrintMacro[]; TerminalIO.WriteF["\nTotal: %g, Scale: %g lambda\n\n", IO.int[macroCount], IO.int[resolution]]; }; --PrintModel END. <<>>