Core.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Barth, December 4, 1986 5:03:28 pm PST
Bertrand Serlet September 18, 1986 4:25:42 pm PDT
Mike Spreitzer November 18, 1986 2:21:27 pm PST
DIRECTORY
IO USING [STREAM],
Properties USING [PropList],
Rope USING [ROPE];
Core: CEDAR DEFINITIONS = BEGIN OPEN ImplementationProperties: Properties;
Theory
This interface defines the basic data structure used for representing the structure of a design.
The cell-composition structure is a DAG, with cell types and cell instances. Different cell types may use different data structures to represent how they are composed from their components. This allows for more efficient representations to be used in special cases. We also address the problem of how to build a system that deals with all these different representations. We do not require every program to understand every representation. We do require every program to understand a small, standard set of representations. Any cell type that does not use one of these standard representations must be able to convert its representation into another representation (of its own choosing); we also require that every maximal series of such conversions terminate in a standard representation. We align cell type representations with cell classes. Every cell type is a member of some cell class. All the cell types of a class use the same representation. The conversion procedure, called `Recast', is part of the class. The small, standard set of classes includes `record', which represents its components by a rather simple, literal list. All the other standard classes either have no components, or refuse to disclose what they are (i.e., the decomposition is undefined).
Wires are directed acyclic graphs. The leaves of a wire DAG represent a single electrical node.
Common Types
ROPE: TYPE = Rope.ROPE;
STREAM: TYPE = IO.STREAM;
Properties: TYPE = PRIVATE ImplementationProperties.PropList;
This type should be opaque, but due to the current compiler restrictions, it is only PRIVATE.
Use always Core.Properties and do NOT use directly Properties.PropList.
Wires
Zero size means the wire is atomic. You might think you can determine the value of the `p' property of wire `w' by `CoreProperties.GetProp[w.properties, p]', but you might be wrong. Check out CoreProperties before you think you know how to deal with w.properties.
Wire: TYPE = REF WireRec;
WireRec: TYPE = RECORD [
properties: Properties ← NIL,
elements: SEQUENCE size: NAT OF Wire];
Wires: TYPE = LIST OF Wire;
A wire sequence represents an ordered set of wires. This is used for the interface of a cell type, and other places you'll meet later. Note that the referent type is the same as that of Wire; this is a hack to avoid defining two similar data types; it allows one to write a procedure that takes either a Wire or a WireSeq as an argument; needless to say, such procedures need to be written with care. When size=0, this is an empty sequence, not an atomic wire (this should not be a surprise, since it's never a wire, regardless of size).
WireSeq: TYPE = REF WireRec;
Cell Classes
A cell class must have recast (except recordCellClass and primitive classes). The "layersProps" BOOL controls property inheritance scanning. Cell classes with layersProps FALSE are declaring that no recast of a cell type of this class will introduce new properties of interest to clients interested in the interface, rather than the internal structure, of the cell. Cell classes with layersProps TRUE are declaring that a cell type of this class must be recasted during a search for interface properties.
CellClass: TYPE = REF CellClassRec;
CellClassRec: TYPE = RECORD [
name: ROPE,
recast: RecastProc ← NIL,
properties: Properties ← NIL,
layersProps: BOOLTRUE];
RecastProc: TYPE = PROC [me: CellType] RETURNS [new: CellType];
Returns a new cell type with the same structure as me, expressed in a more familiar way. That is, new is logically equivalent to me --- only new's internal representation (e.g., new.data) is more familiar. The public wire of new has the same structure as me but does not have any of the properties of me.public except the name. Properties are not blindly copied from me to new. A recast proc may or may not return a unique copy of the recast; see CoreOps.Recast for a procedure that guarantees uniqueness of result. You should almost never call a cell class's RecastProc directly --- you should be going through CoreOps.Recast. new may be ref equal to me since some recast procedures smash me to create new.
Cell Types
The type of the referent in the data field depends on the referent stored in the class field. Cell types may not share any part of any public wire, nor the sequence thereof. CoreOps naming strategy requires that the public wire sequence be immutable, once part of a cellType. You might think you can determine the value of the `p' property of cell type `ct' by `CoreProperties.GetProp[ct.properties, p]', but you might be wrong. Check out CoreProperties before you think you know how to deal with ct.properties.
CellType: TYPE = REF CellTypeRec;
CellTypeRec: TYPE = RECORD [
class: CellClass,
public: WireSeq,
data: REF ANYNIL, 
properties: Properties ← NIL];
END.