CoreFlatten.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Spreitzer, September 14, 1985 2:42:44 pm PDT
Barth, November 1, 1985 4:48:36 pm PST
Bertrand Serlet November 26, 1985 11:48:52 am PST
DIRECTORY Core, CoreClasses;
CoreFlatten: CEDAR DEFINITIONS = BEGIN
Introduction
This interface defines a utility for flattening the data structure defined in Core.
Types
Wire: TYPE = Core.Wire;
CellType: TYPE = Core.CellType;
ROPE: TYPE = Core.ROPE;
CellInstance: TYPE = CoreClasses.CellInstance;
Flat Core
A flattened piece of Core is a record cell type. None of the instances or wires has a name. Each instance notes its source on its instanceSource property. Each wire notes its source on its wireSource property.
InstantiationPath:
TYPE =
LIST
OF CellInstance;
-- deeper first
Relative to the containing cell type, the levels of intermediate structure (i.e., cell instances) that have been removed.
wireSource: ATOM;
WireSource: TYPE = REF WireSourceRec;
WireSourceRec:
TYPE =
RECORD [
instantiationPath: InstantiationPath,
wire: Wire,
instance: CellInstance]; -- NIL for public and internal wires, not NIL for actual wires
instanceSource: ATOM;
InstanceSource: TYPE = REF InstanceSourceRec;
InstanceSourceRec:
TYPE =
RECORD [
instantiationPath: InstantiationPath,
instance: CellInstance];
GetShallowest: PROC [path: InstantiationPath] RETURNS [shallowest: CellInstance];
AllButShallowest: PROC [path: InstantiationPath] RETURNS [allBut: InstantiationPath];
Flattening
Flatten:
PROC [cellType: CellType, control: FlattenControl]
RETURNS [flat: CellType];
Each descendent is expanded or not, depending on what control says.
ExpandNonPrimitive: FlattenControl;
Expands instances whose class is not CoreClasses.transistorCellClass
Control
Flattening can be carried out to an arbitrary depth. The decision of whether to expand or stop is made at each node in the hierarchy.
FlattenControl: TYPE = REF FlattenControlRec;
FlattenControlRec: TYPE = RECORD [Decide: FlattenControlProc, data: REF ANY];
FlattenControlProc: TYPE = PROC [data: REF ANY, who: InstantiationPath] RETURNS [ExpandDecision];
ExpandDecision: TYPE = {leaf, expand};
An Algebra of Control
CoreFlattenCutSets: ATOM;
ControlByCutSet:
PROC [cutSetName:
ROPE]
RETURNS [control: FlattenControl];
Terminates flattening if the object class is CoreClasses.transistorCellClass or if the CoreFlattenCutSets property on the instance or cell type contains a list of rope one of which is equal to the cutSetName.
ControlByRecognition:
PROC [rl: RecognitionList]
RETURNS [control: FlattenControl];
RecognitionList: TYPE = LIST OF Recognition;
Recognition:
TYPE =
RECORD [
recognizer: Recognizer,
whatToDo:
SELECT kind: *
FROM
immediate => [decision: ExpandDecision],
nest => [subControl: FlattenControl],
ENDCASE];
Recognizer: TYPE = REF RecognizerRec;
RecognizerRec:
TYPE =
RECORD [
Recognize: PROC [data: REF ANY, ci: CellInstance] RETURNS [IRecognizeYou: BOOL],
data: REF ANY];
RecognizeName:
PROC [name:
ROPE]
RETURNS [r: Recognizer];
END.