ValueWires.mesa
Barth, December 3, 1985 4:45:47 pm PST
DIRECTORY Core;
ValueWires: CEDAR DEFINITIONS = BEGIN
Theory
A value wire is a DAG which is a subgraph of a Core.WireSequence DAG. Unlike a Core.Wire it contains fields which represent the value of a wire. Also unlike a Core.Wire the SEQUENCE which contains the pointers to elements is contained as a field of the record rather than contained in another record. This provides a mechanism for selecting a subcomponent of a composite which has less syntax. A value wire requires that the leaves of the value wire DAG form a disjoint cover of the leaves of the Core.Wire DAG. This eliminates aliases for the storage of values.
A value wire is often used for representing a Core.CellType.public wire. Such a wire defines an interface to a set of wires rather than a static definition of electrical equipotential regions. Thus a value wire contains a current strength as well as a voltage level.
A voltage level in a value wire can be represented as a boolean value or as a member of the set L, H, or X. A value wire can represent aggregates of either of these value sets. A current strength can only be specified once for any value wire. This means that a value wire which represents an aggregate of many electrical equipotential regions can specify multiple voltage levels but only a single current strength.
Types
ValueWire: TYPE = REF ValueWireRec;
The comment definition of a value wire record captures the semantics. However it introduces a number of runtime checks and excess verbiage in the source. The uncommented definition is used to eliminate them.
ValueWireRec: TYPE = RECORD [
value: SELECT type: ValueWireType FROM
l => [d: Drive ← none, l: Level ← L],
ls => [d: Drive ← none, ls: LevelSequence ← NIL],
b => [d: Drive ← none, b: BOOLFALSE],
bs => [d: Drive ← none, bs: BitSequence ← NIL],
c => [d: Drive ← none, c: CARDINAL ← 0],
lc => [d: Drive ← none, lc: LONG CARDINAL ← 0],
composite => [composite: SEQUENCE size: NAT OF ValueWire],
ENDCASE];
ValueWireRec: TYPE = RECORD [
type: ValueWireType ← composite,
d: Drive ← none,
l: Level ← L,
ls: LevelSequence ← NIL,
b: BOOLFALSE,
bs: BoolSequence ← NIL,
c: CARDINAL ← 0,
lc: LONG CARDINAL ← 0,
composite: SEQUENCE size: NAT OF ValueWire];
ValueWireType: TYPE = {l, ls, b, bs, c, lc, composite};
Drive: TYPE = {
expect, -- allows test procs to put expected value in
none, --from a test proc it means neither driven nor checked; in switch-level it means no strength at all
force, -- weakest drive level, allows test procs to check if device has tristated
chargeWeak, chargeMediumWeak,
charge,
chargeMediumStrong, chargeStrong, chargeVeryStrong,
driveWeak, driveMediumWeak,
drive,
driveMediumStrong, driveStrong, driveVeryStrong,
driveStrongest
};
Level: TYPE = {L, H, X};
LevelSequence: TYPE = REF LevelSequenceRec;
LevelSequenceRec: TYPE = RECORD [levels: PACKED SEQUENCE size: NAT OF Level];
BoolSequence: TYPE = REF BoolSequenceRec;
BoolSequenceRec: TYPE = RECORD [bools: PACKED SEQUENCE size: NAT OF BOOL];
ValueWireList: TYPE = LIST OF ValueWire;
Operations
CreateValueWire: PROC [wires: Core.Wire] RETURNS [value: ValueWire];
Creates a composite value wire for the top level wire sequence. Traverses the component wires looking for the valueType property on each. If it does not exist and the wire has elements then a composite value wire is generated for the value. If the valueType property does not exist and the wire has no elements then the value of the valueType property is assumed to be b and a value wire corresponding to the value of the valueType property is generated. If the valueDrive property exists on a wire which becomes a noncomposite value wire then it is used to initialize the drive field, otherwise the drive field is initialized to none. A check is made to ensure that the generated value wires which are not composite form a disjoint cover of the atomic wires reachable from "wires".
valueType: ATOM; -- the property value must be a REF ValueWireType
valueDrive: ATOM; -- the property value must be a REF Drive
IsComposite: PROC [wire: Core.Wire] RETURNS [BOOL];
Returns true if the wire would create a composite value wire.
PrintValueWire: PROC [wire: Core.Wire, value: ValueWire, out: Core.STREAM];
Prints the value wire using information found on the wire.
END.