ExtractRouting.mesa
Copyright © 1986 by Xerox Corporation. All rights reversed.
Created by Bertrand Serlet February 13, 1987 7:16:25 pm PST
Bertrand Serlet February 13, 1987 8:07:20 pm PST
Extract proc for RoutingClass objects
DIRECTORY CD, CDDirectory, CDProperties, CoreGeometry, CoreClasses, CoreOps, CoreProperties, IO, PWObjects, Rope, Sinix, TerminalIO;
ExtractRouting: CEDAR PROGRAM
IMPORTS CDDirectory, CDProperties, CoreGeometry, CoreClasses, CoreOps, CoreProperties, IO, Rope, Sinix, TerminalIO
SHARES CoreGeometry
~ BEGIN OPEN Sinix;
LazyPinsEnumerate: CoreGeometry.LazyEnumerateProc = {
node: PWObjects.Node ← NARROW [CoreProperties.GetWireProp[wire, $PWObjectsNode]];
rir: REF CD.Rect ← NARROW [CoreProperties.GetWireProp[wire, $PWObjectsIR]];
FOR i: NAT IN [0 .. node.size) DO
instance: CoreGeometry.Instance = [node[i].object, [node[i].position]];
IF CoreGeometry.AtEdge[rir^, instance] THEN quit ← eachInstance[instance];
IF quit THEN RETURN;
ENDLOOP;
};
LazyGeometryEnumerate: CoreGeometry.LazyEnumerateProc = {
node: PWObjects.Node ← NARROW [CoreProperties.GetWireProp[wire, $PWObjectsNode]];
FOR i: NAT IN [0 .. node.size) DO
quit ← eachInstance[[node[i].object, [node[i].position]]];
IF quit THEN RETURN;
ENDLOOP;
};
ExtractRouting: ExtractProc = {
cellType: CellType;
routing: PWObjects.RoutingSpecific = NARROW [obj.specific];
publics: LIST OF Wire ← NIL;
TerminalIO.PutF["Extracting [%g] routing %g (nodes: %g)\n", IO.rope[mode.decoration.name], IO.rope[CDDirectory.Name[obj]], IO.int[routing.size]];
FOR i: NAT IN [0 .. routing.size) DO
node: PWObjects.Node = routing[i];
name1: ROPE = NARROW [CDProperties.GetListProp[node.properties, $InstanceName]];
name2: ROPE = NARROW [CDProperties.GetListProp[node.properties, $SignalName]];
wire: Wire ← CoreOps.CreateWire[
name: name1,
props: CoreProperties.Props[
[$PWObjectsNode, node], [$PWObjectsIR, NEW [CD.Rect ← routing.ir]]]
];
IF NOT Rope.Equal[name1, name2] THEN ERROR; -- current implementation of PWObjects
CoreGeometry.PutLazyGeometry[mode.decoration, wire, LazyGeometryEnumerate];
CoreGeometry.PutLazyPins[mode.decoration, wire, LazyPinsEnumerate];
publics ← CONS [wire, publics];
ENDLOOP;
We build the CellType
cellType ← CoreClasses.CreateRecordCell[
public: CoreOps.CreateWire[publics],
internal: CoreOps.CreateWire[publics],
instances: NIL,
name: CDDirectory.Name[obj]
];
CoreGeometry.PutObject[mode.decoration, cellType, obj];
result ← cellType;
};
RegisterExtractProc[$ExtractRouting, ExtractRouting];
END.