CoreFlat.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Barth, May 1, 1986 11:55:26 am PDT
Spreitzer, April 8, 1986 4:29:29 pm PST
Bertrand Serlet April 19, 1986 4:00:00 pm PST
DIRECTORY
Core, CoreClasses, HashTable;
CoreFlat: CEDAR DEFINITIONS = BEGIN
Theory
Many design tools only interpret CoreClasses.RecordCellType compositions and primitive elements such as CoreClasses.Transistor. This interface assists in recasting other composition types into record cells, flattening the resulting record cells into transistors and providing syntatic sugar for describing the flattened representation in terms of RecordCellType compositions.
An instantiation path is a list of cell instance pointers. The first element of the list is the deepest instance, the last element of the list is an instance in the root cell type. An instantiation path refers to levels of structure removed. It does not contain a pointer to a specific instance, e.g. an instance of the root cell must be referred to with a NIL path and a ref to that instance.
A path rope is a printable representation of an instantiation path which terminates with a cell instance or wire name. The following grammar specifies the syntax of a path rope.
Syntax Notation
item | item = choose one
?item = zero or one item
SMALL CAPS or puncuation other than bold ()?| = terminals
::= = keyword on left hand side is defined by expression on right hand side
Grammar
Path ::= ?InstancePath
InstancePath ::= / ( Name | (Number ?( ( Name ) )) ) ?( InstancePath )
WirePath ::= ?( InstancePath . ) ?((PUBLIC | INTERNAL | ACTUAL ) . ) WirePart
WirePart ::= (( Name | Number ) ?(. WirePart )) | ( [ Number ] ?WirePart )
Name ::= Letter ?LetterDigitString
LetterDigitString ::= (Letter | Digit) ?LetterDigitString
Number ::= Digit ?Number
Letter ::= one of a-z | one of A-Z
Digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Grammar Notes
White space may appear anywhere except inside Name or Number. Reserved words are matched ignoring case. ACTUAL causes the wire path to begin at the actual of the last instance of the instance path and then use the public names of the instance's cell type to index the actual. PUBLIC and INTERNAL cause the wire path to begin at the public or internal of the cell type of the last instance. If none of ACTUAL, PUBLIC, or INTERNAL appear then INTERNAL is assumed. The name in the instance path may be the instance name or, if unambiguous, the cell type name. The name in parantheses must be the cell type name.
PathError: ERROR [msg: ROPENIL];
Types
ROPE: TYPE = Core.ROPE;
WireRoot: TYPE = {internal, public, actual};
InstantiationPath: TYPE = CoreClasses.CellInstances; -- deepest first
PackedPath: TYPE = RECORD [
length: PathIndex ← 0,
bits: PACKED ARRAY PathIndex OF BOOLALL[FALSE]];
PathIndex: TYPE = [0..32); -- caution!!!, look at the implementation of PathEqual before changing this type!!!
NullPath: PackedPath = [];
A packed path can only be interpreted given a root cell type. A packed path contains the same information as an InstantiationPath but in a more compact form. Clients should not need to interpret a packed path directly. They should use the procedures in this interface.
WireBind: TYPE = REF WireBindRec;
WireBindRec: TYPE = RECORD [
path: PackedPath,
wire: Core.Wire ← NIL,
data: REF ANYNIL];
A number of procedures in this interface have bindings as arguments or results. The bindings are hash tables which have internals of record cell types, which may be public, as keys and have WireBinds as the values. The path and wire in a binding indicate to which internal wire the key is bound. The client may fill the data field with anything, it is ignored by the implementation of this interface.
FlatWires: TYPE = LIST OF FlatWire;
FlatWire: TYPE = REF FlatWireRec;
FlatWireRec: TYPE = RECORD [
path: PackedPath,
wire: Core.Wire ← NIL];
FlatInstance: TYPE = REF FlatInstanceRec;
FlatInstanceRec: TYPE = RECORD [
path: PackedPath,
instance: CoreClasses.CellInstance ← NIL];
Flatten
GetCellType: PROC [root: Core.CellType, path: PackedPath] RETURNS [cellType: Core.CellType];
cellType.class=CoreClasses.recordCellClass
VisitUnboundPath: PROC [root: Core.CellType, path: PackedPath, eachInstance: EachUnboundInstanceProc];
EachUnboundInstanceProc: TYPE = PROC [instance: FlatInstanceRec, cellType: Core.CellType];
cellType.class=CoreClasses.recordCellClass
cellType is the parent of instance
BoundCellType: PROC [root: Core.CellType, path: PackedPath] RETURNS [bindings: HashTable.Table, cellType: Core.CellType];
cellType.class=CoreClasses.recordCellClass
VisitBoundPath: PROC [root: Core.CellType, path: PackedPath, eachInstance: EachBoundInstanceProc] RETURNS [bindings: HashTable.Table];
EachBoundInstanceProc: TYPE = PROC [bindings: HashTable.Table, instance: FlatInstanceRec, cellType: Core.CellType];
cellType.class=CoreClasses.recordCellClass
cellType is the parent of instance
EnumerateLeaves: PROC [root: Core.CellType, eachInstance: EachInstanceProc, rootCellType, beforeInstances, afterInstances: EachCellTypeProc ← NIL];
EachInstanceProc: TYPE = PROC [bindings: HashTable.Table, path: PackedPath, instance: CoreClasses.CellInstance] RETURNS [flatten: BOOLTRUE];
EachCellTypeProc: TYPE = PROC [bindings: HashTable.Table, path: PackedPath, cellType: Core.CellType];
cellType.class=CoreClasses.recordCellClass
EnumerateAtomicWireLeaves: PROC [root: Core.CellType, rootWire: Core.Wire, eachInternalWire: EachInternalWireProc ← NIL, eachWireInstance: EachWireInstanceProc ← NIL];
rootWire.size#0 => ERROR. rootWire must be reachable from the internal of root. All internal wires bound to rootWire, including rootWire, are enumerated. The instances whose actual reaches rootWire are enumerated.
EachInternalWireProc: TYPE = PROC [bindings: HashTable.Table, path: PackedPath, cellType: Core.CellType, wire: Core.Wire];
EachWireInstanceProc: TYPE = PROC [bindings: HashTable.Table, path: PackedPath, instance: CoreClasses.CellInstance, wire: Core.Wire] RETURNS [flatten: BOOLTRUE];
Paths
FindPath: PROC [root: Core.CellType, pathRope: ROPE] RETURNS [path: PackedPath];
PathRope: PROC [root: Core.CellType, path: PackedPath] RETURNS [pathRope: ROPE];
PathEqual: PROC [one, other: PackedPath] RETURNS [equal: BOOL];
PathHash: PROC [path: PackedPath] RETURNS [hash: CARDINAL];
ComputePackedPath: PROC [root: Core.CellType, instantiationPath: InstantiationPath] RETURNS [path: PackedPath];
Instances
FindInstance: PROC [root: Core.CellType, instancePathRope: ROPE] RETURNS [instance: FlatInstanceRec];
InstancePathRope: PROC [root: Core.CellType, instance: FlatInstanceRec] RETURNS [instancePathRope: ROPE];
AddInstance: PROC [currentPath: PackedPath, instance: CoreClasses.CellInstance, within: Core.CellType] RETURNS [newPath: PackedPath];
FlatInstanceEqual: PROC [one, other: REF ANY -- FlatInstance --] RETURNS [equal: BOOL];
FlatInstanceEqualRec: PROC [one, other: FlatInstanceRec] RETURNS [equal: BOOL];
FlatInstanceHash: PROC [instance: REF ANY -- FlatInstance --] RETURNS [hash: CARDINAL];
FlatInstanceHashRec: PROC [instance: FlatInstanceRec] RETURNS [hash: CARDINAL];
Wires
FindWire: PROC [root: Core.CellType, wirePathRope: ROPE] RETURNS [wire: FlatWireRec, wireRoot: WireRoot];
WirePathRope: PROC [root: Core.CellType, wire: FlatWireRec, wireRoot: WireRoot ← internal] RETURNS [wirePathRope: ROPE];
FlatWireEqual: PROC [one, other: REF ANY -- FlatWire --] RETURNS [equal: BOOL];
FlatWireEqualRec: PROC [one, other: FlatWireRec] RETURNS [equal: BOOL];
FlatWireHash: PROC [wire: REF ANY -- FlatWire --] RETURNS [hash: CARDINAL];
FlatWireHashRec: PROC [wire: FlatWireRec] RETURNS [hash: CARDINAL];
END.