DMMBusModelImpl.mesa
Written By: Jean Vuillemin and Pradeep Sindhu
Last Edited By: Pradeep Sindhu September 5, 1985 2:42:55 pm PDT
DMMBusModelImpl:
CEDAR
PROGRAM
IMPORTS DM
EXPORTS DMMBusModel = BEGIN OPEN DMMBusModel;
numResetCycles: INT = 20;
numRemainingResetCycles: INT;
Create:
PUBLIC
PROC []
RETURNS [mbus: DM.Component] = {
mbus ←
NEW [
DM.ComponentRec ← [
action: [Reset, PhA, EvPhA, PhB, EvPhB],
history: NIL,
componentType: $MBus,
subComponents: NIL,
specific: NEW [MBusSpecificRec]]];
};
MReset:
PUBLIC
PROC [mbus:
DM.Component]
RETURNS [
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
RETURN [pvt.mReset]
};
DrMReset:
PUBLIC
PROC [mbus:
DM.Component, value:
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
pvt.mReset ← value
};
MnAdCycle:
PUBLIC
PROC [mbus:
DM.Component]
RETURNS [
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
RETURN [pvt.mnAdCycle]
};
DrMnAdCycle:
PUBLIC
PROC [mbus:
DM.Component, value:
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
pvt.mnAdCycle ← value
};
MnShared:
PUBLIC
PROC [mbus:
DM.Component]
RETURNS [
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
RETURN [pvt.mnShared]
};
DrMnShared:
PUBLIC
PROC [mbus:
DM.Component, value:
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
pvt.mnShared ← value
};
MnAbort:
PUBLIC
PROC [mbus:
DM.Component]
RETURNS [
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
RETURN [pvt.mnAbort]
};
DrMnAbort:
PUBLIC
PROC [mbus:
DM.Component, value:
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
pvt.mnAbort ← value
};
MnDV:
PUBLIC
PROC [mbus:
DM.Component]
RETURNS [
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
RETURN [pvt.mnDV]
};
DrMnDV:
PUBLIC
PROC [mbus:
DM.Component, value:
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
pvt.mnDV ← value
};
MnError:
PUBLIC
PROC [mbus:
DM.Component]
RETURNS [
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
RETURN [pvt.mnError]
};
DrMnError:
PUBLIC
PROC [mbus:
DM.Component, value:
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
pvt.mnError ← value
};
MCmd:
PUBLIC
PROC [mbus:
DM.Component]
RETURNS [MCmdType] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
RETURN [pvt.mCmd]
};
DrMCmd:
PUBLIC
PROC [mbus:
DM.Component, mCmd: MCmdType] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
pvt.mCmd ← mCmd
};
MData:
PUBLIC
PROC [mbus:
DM.Component]
RETURNS [
DM.Word] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
RETURN [pvt.mData]
};
DrMData:
PUBLIC
PROC [mbus:
DM.Component, mData:
DM.Word] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
pvt.mData ← mData
};
MnHouseKeepingInProgress:
PUBLIC
PROC [mbus:
DM.Component]
RETURNS [
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
RETURN [pvt.mnHouseKeepingInProgress]
};
DrMnHouseKeepingInProgress:
PUBLIC
PROC [mbus:
DM.Component, value:
BOOL] = {
pvt: MBusSpecific ← NARROW[mbus.specific];
pvt.mnHouseKeepingInProgress ← value
};
PhA: DM.ActionProc = {
IF (numRemainingResetCycles ← numRemainingResetCycles-1) = 0
THEN DrMReset[component, FALSE];
};
EvPhA: DM.ActionProc = {
};
PhB: DM.ActionProc = {
};
EvPhB: DM.ActionProc = {
pvt: MBusSpecific ← NARROW[component.specific];
component.history ← DM.ConsHistory[EvPhB, NEW[MBusSpecificRec ← pvt^], component.history]
};
Reset: DM.ActionProc = {
component.history ← NIL;
numRemainingResetCycles ← numResetCycles;
DrMReset[component, TRUE];
};
END.