CoreCreate.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Barth, August 26, 1985 6:57:06 pm PDT
Bertrand Serlet October 4, 1985 3:39:36 pm PDT
Common Types and Errors
ROPE: TYPE = Core.ROPE;
RopeList: TYPE = LIST OF ROPE;
Design: TYPE = Core.Design;
CellType: TYPE = Core.CellType;
CellInstance: TYPE = CoreClasses.CellInstance;
Wire: TYPE = Core.Wire;
Attributes: TYPE = LIST OF Attribute;
Attribute: TYPE = RECORD [key: ATOM, val: REF ANY ← NIL];
CreateError: ERROR [type: CreateErrorType, message: ROPE];
CreateErrorType: TYPE = {BadBinding, DuplicateName, InvariantFailed, MissingParameter, NotRecordCell};
Cells
CreateRecordCell:
PROC [design: Design, name:
ROPE, attribute: Attribute ← [
NIL,
NIL], attributes: Attributes ←
NIL]
RETURNS [cell: CellType];
Creates a record cell and attaches it to the design. Raises CreateError[DuplicateName] if a cell of the specified name already exists.
CreateSequenceCell:
PROC [design: Design, name:
ROPE, baseCell: CellType, count:
NAT, sequencePorts: RopeList ←
NIL, attribute: Attribute ← [
NIL,
NIL], attributes: Attributes ←
NIL]
RETURNS [cell: CellType];
Like CreateRecordCell but creates the cell by iterating the base cell.
CreateIdentityCell:
PROC [design: Design, name:
ROPE, baseCell: CellType, attribute: Attribute ← [
NIL,
NIL], attributes: Attributes ←
NIL]
RETURNS [cell: CellType];
Creates a new cell type which refers to the baseCell CellType but has a new property list.
FetchCell:
PROC [design: Design, name:
ROPE]
RETURNS [cell: CellType];
Searches for the named cell type. Returns NIL if not found
CreateCellInstance:
PROC [design: Design, in: CellType, type: CellType, bind:
ROPE ←
NIL, bindings: RopeList ←
NIL, name:
ROPE ←
NIL, attribute: Attribute ← [
NIL,
NIL], attributes: Attributes ←
NIL]
RETURNS [instance: CellInstance];
Creates an instance within the cell. If multiple bindings are given then only the last instance is returned. Raises CreateError[NotRecordCell] if the "in" cell is not a record cell. The binding rope is parsed first and any formal-actual pairs found in the rope are bound. If any formals are left unbound then the wire of the cell is searched and any wire whose name matches an unbound formal will be bound to the formal. The wires of the formal-actual pairs are compared for structural equivalence. CreateError[BadBinding] is raised if the binding fails for any reason.
binding ::= formal : selector ,..
formal ::= name
selector ::= ( name ?( . name | [ num ] | [ num .. num ) ) ) | constructor
constructor ::= [ selector ,.. ]
name ::= letter | name ( letter | digit ) -- no spaces in this or following rules
num ::= digit | num digit
Wires
CreateWireSequenceType:
PROC [design: Design, name:
ROPE ←
NIL, count:
NAT, base: Wire ←
NIL, attribute: Attribute ← [
NIL,
NIL], attributes: Attributes ←
NIL]
RETURNS [wire: Wire];
Creates a sequence wire type. The components are numbered from least significant to most significant starting at 0 and increasing by one.
CreateWireRecordType:
PROC [design: Design, name:
ROPE ←
NIL, components:
LIST
OF Wire, attribute: Attribute ← [
NIL,
NIL], attributes: Attributes ←
NIL]
RETURNS [wire: Wire];
Creates a record wire type.
CreateWireType:
PROC [design: Design, name:
ROPE ←
NIL, attribute: Attribute ← [
NIL,
NIL], attributes: Attributes ←
NIL]
RETURNS [wire: Wire];
Creates an atomic wire type.
CreateWire:
PROC [design: Design, in: CellType, name:
ROPE ←
NIL, names: RopeList ←
NIL, type: Wire ←
NIL, attribute: Attribute ← [
NIL,
NIL], attributes: Attributes ←
NIL]
RETURNS [wire: Wire];
Creates a wire within the cell. If type is NIL an atomic wire is created. Raises CreateError[NotRecordCell] if the cell is not a record cell. Raises CreateError[NoName] if no names are given. If multiple names are given then only the last wire is returned.
CreatePublicWire:
PROC [design: Design, on: CellType, name:
ROPE ←
NIL, names: RopeList ←
NIL, type: Wire ←
NIL, attribute: Attribute ← [
NIL,
NIL], attributes: Attributes ←
NIL]
RETURNS [wire: Wire];
Like CreateWire but makes the wire a public wire of the cell type.