LoadsOutImpl.mesa
Frank Bowers May 23, 1986 11:08:35 am PDT
DIRECTORY
Atom,
CMosB,
FS,
HashTable,
IO,
LoadsOut,
Rope,
Route,
RouteChannel,
SC,
SCChanUtil,
SCPrivate;
LoadsOutImpl: CEDAR PROGRAM
IMPORTS Atom, CMosB, FS, HashTable, RouteChannel, SCChanUtil, IO
EXPORTS LoadsOut
= BEGIN
NetData: TYPE = REF NetDataRec;
NetDataRec: TYPE = RECORD [
metLength: Route.Number ← 0,
met2Length: Route.Number ← 0];
ProcessChan: PROC [rowChan: SCPrivate.RowChan, hashTable: HashTable.Table] = {
EnterSeg: RouteChannel.EnumSegmentsProc = {
net: NetData ← NIL;
value: REFNIL;
found: BOOLEANFALSE;
length: INT ← 0;
key: ATOM ← Atom.MakeAtom[name];
[found, value] ← HashTable.Fetch[hashTable, key];
net ← IF found THEN NARROW[value] ELSE NEW[NetDataRec ← []];
length ← MAX[ABS[pos1.x-pos2.x], ABS[pos1.y-pos2.y]];
SELECT layer FROM
CMosB.met => net.metLength ← net.metLength + length;
CMosB.met2 => net.met2Length ← net.met2Length + length;
ENDCASE => NULL;
IF NOT found THEN [] ← HashTable.Store[hashTable, key, net];
};
EnumPins: RouteChannel.EnumPinsProc = {};
EnumVias: RouteChannel.EnumViasProc = {};
EnumExits: RouteChannel.EnumExitsProc = {};
EnumIncompletes: RouteChannel.EnumIncompletesProc = {};
IF rowChan.routing = NIL THEN RETURN;
[] ← RouteChannel.GetRouting[routingArea: rowChan.routing.routingArea, rect: rowChan.routing.routingRect, properties: NIL, EnumSegments: EnterSeg, EnumPins: EnumPins, EnumVias: EnumVias, EnumExits: EnumExits, EnumIncompletes: EnumIncompletes];
};
EnumerateHashTable: PROC [hashTable: HashTable.Table, outPutFile: Rope.ROPE] = {
PutLengthsForNet: HashTable.EachPairAction = {
atom: ATOMNARROW[key];
net: NetData ← NARROW[value];
IO.PutF[out, " %g : %g : 0 : %g :\n", [atom[atom]], IO.int[net.met2Length], IO.int[net.metLength]];
};
out: IO.STREAM;
out ← FS.StreamOpen[outPutFile, $create];
IO.PutF[out, "%g: Standard Cell routing lengths for use by SETAR's CAPLOAD CANDE annotation utility\n\n", [rope[outPutFile]]];
IO.PutF[out, " NET : LENGTH : LENGTH : LENGTH :\n"];
IO.PutF[out, " : IN L𡤁 : IN L� : IN L𡤂 :\n"];
IO.PutF[out, " ------------------------------------------------------\n\n"];
[] ← HashTable.Pairs[hashTable, PutLengthsForNet];
IF out # NIL THEN IO.Close[out];
};
ProcessRouting: PUBLIC PROC [handle: SC.Handle, outputFile: Rope.ROPE] = {
ForEachChan: SCChanUtil.EachRowChanProc = {
PROC [chan: SCPrivate.MaxChanSr, rowChan: SCPrivate.RowChan] RETURNS [quit: BOOLFALSE];
ProcessChan[rowChan, hashTable]; -- pass in hash table
};
hashTable: HashTable.Table ← HashTable.Create[];
create hash table
[] ← SCChanUtil.EnumerateRowChans[handle: handle, eachRowChan: ForEachChan];
EnumerateHashTable[hashTable, outputFile];
Enumerate hash table and create Loads file
};
END.