--
PROC [tile: Tile, data: REF]-- = {
JLayer: JasmineObjectInLayer ← NARROW[tile.value];
JObject: JasmineObject ← JLayer.object;
r: CStitching.Rect ← CStitching.Area[tile];
TransistorModel:
PROC [] = {
tranData: CoreClasses.Transistor ← NARROW[data];
jasmineMacro.xtorType ←
SELECT JObject
FROM
nTran, nTranL => nE,
pTran, pTranL => pE,
ENDCASE => ERROR;
jasmineMacro.xtorLength ← tranData.length;
jasmineMacro.xtorWidth ← tranData.width;
};
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;
};
Re: QuickAndDirty.tioga
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: Core.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 => {TransistorModel[];};
ENDCASE => NULL;
symbol ← MapConvert[jasmineMacro.JMapLoc ← ScaleMap[tile]];
[] ← SymTab.Store[x: model, key: symbol, val: jasmineMacro];
}; --InsertMacro
CStitching.EnumerateArea[plane: tesselation, rect: CStitching.all, eachTile: InsertMacro];