<> <> <> DIRECTORY DM, DragOpsCross, DMMBusModel; 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.