GCImpl.mesa
Copyright Ó 1986, 1987 by Xerox Corporation. All rights reserved.
Bryan Preas, September 16, 1987 4:26:06 pm PDT
Massoud Pedram November 9, 1987 12:52:51 pm PST
Don Curry December 7, 1987 11:27:08 am PST
DIRECTORY
Atom, CD, CDSimpleRules, Core, CoreGeometry, CoreRouteFlat, DABasics, FS, GC, GCPrivate, IP, IPBasicOps, IPCoTab, IPTop, Process, Rope, Route, RouteDiGraph;
GCImpl: CEDAR PROGRAM
IMPORTS CD, CDSimpleRules, GCPrivate, IPBasicOps, IPCoTab, IPTop, Process, Route, RouteDiGraph
EXPORTS GC = BEGIN
Errors
Error: PUBLIC ERROR
[errorType: GC.ErrorType ← callingError, explanation: Rope.ROPENIL] = CODE;
Signal: PUBLIC SIGNAL
[signalType: GC.ErrorType ← callingError, explanation: Rope.ROPENIL] = CODE;
Design Rules
CreateDesignRules: PUBLIC PROC [technologyKey: ATOM, rulesKey: ATOM, horizLayer, vertLayer: Rope.ROPE] RETURNS [designRules: GC.DesignRules] = {
Define the general cell design rules. technologyKey values must correspond to one of the ChipNDale technologies. horizLayer, vertLayer should be "poly", "metal" or "metal2".
hLayer: CD.Layer ← CDSimpleRules.GetLayer[technologyKey, horizLayer];
vLayer: CD.Layer ← CDSimpleRules.GetLayer[technologyKey, vertLayer];
technology: CD.Technology ← CD.FetchTechnology[technologyKey];
designRules ← NEW[GC.DesignRulesRec ← [
horizLayer: horizLayer,
vertLayer: vertLayer,
horizParams: Route.DefaultDesignRulesParameters
[technology, hLayer, vLayer, horizontal], --?used to use rulesKey as arg[-1]
vertParams: Route.DefaultDesignRulesParameters
[technology, hLayer, vLayer, vertical],  --?used to use rulesKey as arg[-1]
technology: technology]];
designRules.horizRules ← Route.DefaultDesignRules[designRules.horizParams]; --?rulesKey
designRules.vertRules ← Route.DefaultDesignRules[designRules.vertParams]};  --?rulesKey
General Cell Context and Result
defaultParms: PUBLIC GC.Parms ← NEW[GC.ParmsRec];
CreateContext: PUBLIC PROC [name: Rope.ROPENIL, structure: CoreRouteFlat.Structure, designRules: GC.DesignRules, parms: GC.Parms] RETURNS [context: GC.Context] = {
Create a General Cell context. The General Cell context definition includes the design rules (conductor and via widths and spacings) for the routing channels as well as the circuit structure definition.
contextName:  Rope.ROPEIF name # NIL THEN name ELSE structure.name;
topology:   IPTop.Ref ← IPTop.ReDefineChs
[top: IPTop.CreateFromStructure[structure], maxChWidth: TRUE];
SetIPTypes[structure, topology];
SetIPComps[structure, topology];
IPTop.Geometrize[topology];
context ← NEW[GC.ContextRec ← [name: contextName, rules: designRules, structure: structure, parms: parms, topology: topology, topologicalOrder: NIL]]};
DoInitialGlobalRoute: PUBLIC PROC [context: GC.Context] = {
Determine strategic paths for the wiring among the cells.
p: Process.Priority ← Process.GetPriority[];
Process.SetPriority[Process.priorityBackground];
GCPrivate.DoInitialGlobalRoute[context];
Process.SetPriority[p]};
DoImproveGlobalRoute: PUBLIC PROC [context: GC.Context] = {
Determine strategic paths for the wiring among the cells.
p: Process.Priority ← Process.GetPriority[];
Process.SetPriority[Process.priorityBackground];
Process.SetPriority[p]};
DoDetailRoute: PUBLIC PROC [context: GC.Context] RETURNS [result: GC.Result] = {
Determine actual wiring paths.
p: Process.Priority ← Process.GetPriority[];
Process.SetPriority[Process.priorityBackground];
result ← GCPrivate.DoDetailRoute[context];
Process.SetPriority[p]};
InitialPlace: PUBLIC PROC [structure: CoreRouteFlat.Structure] ~ {
FOR insts: LIST OF CoreRouteFlat.Instance ← structure.instances, insts.rest
WHILE insts#NIL DO insts.first.placed ← TRUE ENDLOOP};
SetIPTypes: PROC[structure: CoreRouteFlat.Structure, topology: IPTop.Ref] ~ {
EachTypeProc: CoreRouteFlat.EachObjectAction ~ {
IF object.heirarchyLevel = this THEN {
type: IPTypeTab.CoType ← IPTypeTab.FetchCoType[topology.types, object.name];
size: IP.IntVector ← CD.InterestSize[object.layObject];
shapeRec: REF IP.ShapeRep ← NEW[IP.ShapeRep ← [dim: IPBasicOps.NuNatVector[size.x, size.y]]];
type.shapeInfo ← [shapeRec, NIL, NIL];
};
}; --EachTypeProc
[] ← CoreRouteFlat.EnumerateObjects[structure, EachTypeProc];
}; --SetIPTypes
SetIPComps: PROC[structure: CoreRouteFlat.Structure, topology: IPTop.Ref] ~ {
FOR insts: LIST OF CoreRouteFlat.Instance ← structure.instances, insts.rest
WHILE insts#NIL DO
IF insts.first#structure.outerInstance THEN {
co:  IPCoTab.Component ← IPCoTab.GetComponent[topology.coTab, insts.first.name];
size: IP.IntVector   ← CD.InterestSize[insts.first.layObject];
shapeRec: REF IP.ShapeRep ← NEW[IP.ShapeRep ←
[dim: IPBasicOps.NuNatVector[size.x, size.y]]];
co.shape ← shapeRec^} ENDLOOP};
Clean Up
Destroy: PUBLIC PROC [context: GC.Context] ~ {
Remove circular references so garbage collection can work
DestroyNode: RouteDiGraph.EnumNodeProc = {
channel: GCPrivate.Channel ← NARROW[node.nodeInfo];
channel.topoOrder ← NIL};
IPTop.DestroySelf[NARROW[context.topology]];
RouteDiGraph.DestroyGraph[graph: NARROW[context.topologicalOrder], enumNode: DestroyNode];
GCPrivate.DestroyChannels[context]};
Global Frame Variables
metalVerticalRules: PUBLIC GC.DesignRules ←
CreateDesignRules[$cmosB, $Hybrid, "metal2", "metal"];
metalHorizontalRules: PUBLIC GC.DesignRules ←
CreateDesignRules[$cmosB, $Hybrid, "metal", "metal2"];
interestingProperties: PUBLIC LIST OF ATOMNIL; -- props interesting to GC
END.