RoseBehavior.mesa 
Copyright © 1985 by Xerox Corporation. All rights reversed.
Barth, July 31, 1985 3:37:03 pm PDT
Spreitzer, September 29, 1985 1:52:30 pm PDT
DIRECTORY Rope, TimeStamp;
RoseBehavior: CEDAR DEFINITIONS = BEGIN
Theory
This interface talks about the details of writing a Rosemary behavioural description of a cell type. Rosemary implements a mixed mode simulator that has a simple selective trace algorithm and a MOSSIM II switch level simulation algorithm integrated together.
Definition File Generation
The definitions file contains simple value, switch value, and drive record definitions as well as port paths.
The base is the behavior class name.
Port path names are generated by concatenating the base followed by the name of each field or the index within a sequence from the root of the public wire.
Wrong:
The simple value record type name is generated by appending the string "SimpleRec" to the base. Similiarly the ref type is generated by appending the string "SimpleRef" to the base. The switch value record type has the string "SwitchRec" appended and its ref type has "SwitchRef" appended. The drive record has the string "DriveRec" appended and its ref type has "DriveRef" appended.
Current:
The name given a data type used to represent a wire during simulation is the wire name, with either "Simple", "Switch", or "Drive" appended.
If a part of a behavior class's public wire has the property RoseBind.switchWire then that part participates in the full switch level algorithm. ValsChanged, PropQ and PropUD procedures must be supplied for the behavior class. InitUD, FinalUD, FindVicinity, and other low level procedures may be supplied. Parts without the RoseBind.switchWire property interact in the simple way. For determining the interaction of a tester for a behavior class, the RoseBind.testerSwitchWire property is consulted.
The types of the fields of the simple and switch value records are derived from the public wire of the behavior class according to the following rules:
An atomic wire becomes a BOOL in the simple value record type.
An atomic wire becomes a RoseBehavior.SwitchVal in the switch value record type.
A record wire becomes a RECORD. The fields of the RECORD are generated by recursively applying these rules to each of the elements of the record wire.
The base type of a sequence wire is the structure of a member of that sequence. A sequence wire which does not have identical structure for each of its elements is illegal. A sequence wire which has the property RoseBind.variableWire becomes a REF to a sequence record whose type is generated by applying these rules recursively to the base type of the sequence wire.
A basic sequence is a sequence wire which has an atomic wire as its base type. In the simple value record type a basic sequence becomes a BitOps.BitWord if 1 d size d 16; a BitOps.BitDWord if 16 ý size d 32; an ARRAY [0 .. size/16Ë) OF CARDINAL if size ý 32.
A sequence wire becomes an ARRAY of the base type.
Drive records have the following rules:
An atomic wire becomes a RoseBehavior.Drive.
A wire with the property RoseBind.simpleDrive (RoseBind.testerSimpleDrive for tester) becomes RoseBehavior.Drive.
A record wire becomes a RECORD. The fields of the RECORD are generated by recursively applying these rules to each of the elements of the record wire.
A sequence wire which has the property RoseBind.variableWire becomes a REF to a sequence record whose type is generated by applying these rules recursively to the base type of the sequence wire.
A basic sequence becomes RoseBehavior.Drive unless it has the property RoseBind.complexDrive (RoseBind.testerComplexDrive for tester).
A sequence wire becomes an ARRAY of the base type.
NAndSimpleRec: TYPE = RECORD[
Vdd: BOOL,
Gnd: BOOL,
Input: NAndSimpleInputRef,
nOutput: BOOL];
NAndSimpleInputRef: TYPE = REF NAndSimpleInputRec;
NAndSimpleInputRec: TYPE = RECORD[
c: SEQUENCE size: NAT OF BOOL];
Implementation Generation
Rosemary will generate a program module which implements functions necessary to running a simulation which can be derived from the Core data structure.
The simple and switch value records and the drive records allocation procedures are in this module. The module initializes the port paths.
Behavior Registration
The implementor of the details must call the Register procedure. Successive calls update the behavior of the existing cells.
Implementation
ROPE: TYPE = Rope.ROPE;
VersionStamp: TYPE = TimeStamp.Stamp;
Details: TYPE = REF DetailsRec;
DetailsRec: TYPE = RECORD [
EvalSimple, ValsChanged, InitQ, PropQ, InitUD, PropUD, FinalUD: EvalProc ← NIL,
All of the simple behavior is captured in the EvalSimple.
Switch-level behavior requires at least: PropQ, PropUD, and ValsChanged.
The strengthAny and simpleAny records may only be updated in the EvalSimple or ValsChanged, which are also the only ones that can perturb.
EnumerateVicinity: VicinityEnumerator ← NIL,
CreateState: StateCreator ← NIL];
EvalProc: TYPE = PROC [argsAny, switchAny, simpleAny, strengthAny, stateAny: REF ANY, perturb: PROC [portPath: PortPath]];
VicinityEnumerator: TYPE = PROC [
argsAny, stateAny: REF ANY,
portPath: PortPath,
evenIfInput: BOOLFALSE,
consume: PROC [PortPath]
];
PortPath: TYPE = LIST OF StructureIndex;
Deeper later, because they'll be traversed forward more often than backward, and it won't make a significant storage difference.
StructureIndex: TYPE = CARDINAL;
RegisterDetails: PROC [behaviorClassName: ROPE, details: Details, versionStamp: VersionStamp];
StateCreator: TYPE = PROC [argsAny: REF ANYNIL] RETURNS [stateAny: REF ANYNIL];
SwitchVal: TYPE = MACHINE DEPENDENT RECORD [
s: PACKED ARRAY StrengthIndex OF Strength ← ALL[none],
val: Level ← X,
pad: [0 .. 4) ← 0];
Level: TYPE = {L, H, X};
Strength: TYPE = Drive[none .. input];
StrengthIndex: TYPE = {q, u, d};
Drive: TYPE = {
test,--for TestProcs to say "test it for me"
see,--for TestProcs to say "I'll test it"
none,--from a TestProc it means neither driven nor tested; in simulation it means no strength at all
chargeWeak, chargeMediumWeak,
charge,
chargeMediumStrong, chargeStrong, chargeVeryStrong,
driveWeak, driveMediumWeak,
drive,
driveMediumStrong, driveStrong, driveVeryStrong,
input--the strongest drive level: how circuit inputs are driven
};
Stop: SIGNAL [msg: ROPE, data: REF ANYNIL];
This signal may be raised when a behavioural proc wishes to display a string to a user and wait for a proceed or abort.
END.