CoreFlatten.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Spreitzer, September 14, 1985 2:42:44 pm PDT
Barth, September 25, 1985 1:17:44 am PDT
DIRECTORY Core, CoreRecord;
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 = CoreRecord.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 CoreTransistor.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
ControlByFile: PROC [fileName: ROPE] RETURNS [control: FlattenControl];
There is a yet-to-be-determined file format that allows a textual specification of flattening control.
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.