CoreFlatten.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Spreitzer, August 15, 1985 8:05:29 pm PDT
DIRECTORY Core, CoreRecordCellClass;
CoreFlatten: CEDAR DEFINITIONS = BEGIN OPEN Core, CoreRecordCellClass;
Introduction
This interface defines a utility for flattening the data structure defined in Core.
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 instantiation path on its instantiationPath property. Each wire notes its source on its wireSource property, or is a descendant of a wire with such a note.
instantiationPath: ATOM;
InstantiationPath: TYPE = REF InstantiationPathRep;
InstantiationPathRep: TYPE;
IsInstantiationPath: PROC [ra: REF ANY] RETURNS [BOOL];
NarrowToInstantiationPath: PROC [ra: REF ANY] RETURNS [InstantiationPath];
IsEmpty: PROC [ip: InstantiationPath] RETURNS [BOOL];
Split: PROC [ip: InstantiationPath, end: InstantiationPathDirection] RETURNS [step: Instance, rest: InstantiationPath];
Exhibit: PROC [ip: InstantiationPath, later: InstantiationPathDirection, to: PROC [step: Instance]];
InstantiationPathDirection: TYPE = {deeper, shallower};
wireSource: ATOM;
WireSource: TYPE = REF WireSourceRec;
WireSourceRec: TYPE = RECORD [
instantiationPath: InstantiationPath,
Relative to the containing cell type, the number of levels of intermediate structure (i.e., cell instances) have been removed.
wire: Wire
];
Flattening
Flatten: PROC [design: Design, cellType: CellType, control: FlattenControl] RETURNS [flat: CellType];
Each descendent is expanded or not, depending on what control says.
expandNonPrimitive: FlattenControl;
expands those whose recast is not NIL
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};
Control by File
There is a yet-to-be-determined file format that allows a textual specification of flattening control.
ControlByFile: PROC [fileName: ROPE] RETURNS [control: FlattenControl];
END.