ClusterImpl.Mesa
created by RoseTranslate 3.1.3 of September 5, 1985 12:14:34 pm PDT
created from Cluster.Rose of March 11, 1986 12:24:23 pm PST
created for McCreight.pa
created at March 18, 1986 6:01:37 pm PST
DIRECTORY
RoseTypes, Cluster, RoseCreate, Basics, DragOpsCross, CacheOps, ClusterParams, DragonRosemary, IO, LizardRosemary, Process, Rope, RoseRun, SwitchTypes, Dragon, NumTypes, EnumTypes, IFU, EU, Cache;
ClusterImpl: CEDAR PROGRAM
IMPORTS RoseCreate, CacheOps, ClusterParams, DragonRosemary, IO, LizardRosemary, Process, Rope, RoseRun, RoseTypes, NumTypes, EnumTypes, IFU, EU, Cache
EXPORTS Cluster
= BEGIN OPEN
RoseTypes, Cluster;
Signal Type decls
PBusCommands: TYPE = Dragon.PBusCommands;
PBusFaults: TYPE = Dragon.PBusFaults;
MBusCommands: TYPE = Dragon.MBusCommands;
RegisterCells: PROC =
BEGIN
Cluster ← RoseCreate.RegisterCellType[name: "Cluster",
expandProc: ClusterExpand,
ioCreator: CreateClusterIO, driveCreator: CreateClusterDrive,
evals: [],
tests: LIST[[name: "T", proc: ClusterTestT, stateToo: FALSE]],
ports: CreateClusterPorts[]
];
END;
otherss: SymbolTable ← RoseCreate.GetOtherss["Cluster.partsAssertions"];
Cluster: PUBLIC CellType;
CreateClusterPorts: PROC RETURNS [ports: Ports] = {ports ← RoseCreate.PortsFromFile["Cluster.Cluster.rosePorts"]};
ClusterSwitchIORef: TYPE = REF ClusterSwitchIORec;
ClusterSwitchIORec: TYPE = RECORD [
IPRejectB: SwitchTypes.SwitchVal
,DPRejectB: SwitchTypes.SwitchVal
,PhA: SwitchTypes.SwitchVal
,PhB: SwitchTypes.SwitchVal
,Vdd: SwitchTypes.SwitchVal
,Gnd: SwitchTypes.SwitchVal
,PadVdd: SwitchTypes.SwitchVal
,PadGnd: SwitchTypes.SwitchVal
,RescheduleAB: SwitchTypes.SwitchVal
,ClusterError: SwitchTypes.SwitchVal
,DPData: PACKED ARRAY [0 .. 32) OF SwitchTypes.SwitchVal
,DPCmnd3A: PACKED ARRAY [0 .. 8) OF SwitchTypes.SwitchVal
,DPFaultB: PACKED ARRAY [0 .. 4) OF SwitchTypes.SwitchVal
,MDataAB: PACKED ARRAY [0 .. 32) OF SwitchTypes.SwitchVal
,MCmdAB: PACKED ARRAY [0 .. 4) OF SwitchTypes.SwitchVal
,MNShared: SwitchTypes.SwitchVal
,MParityAB: SwitchTypes.SwitchVal
,MNError: SwitchTypes.SwitchVal
,MReadyBA: SwitchTypes.SwitchVal
,M1Rq: SwitchTypes.SwitchVal
,M2Rq: SwitchTypes.SwitchVal
,MNewRq: SwitchTypes.SwitchVal
,M1Gnt: SwitchTypes.SwitchVal
,M2Gnt: SwitchTypes.SwitchVal
,ResetAB: SwitchTypes.SwitchVal
,DHoldAB: SwitchTypes.SwitchVal
,DShiftAB: SwitchTypes.SwitchVal
,DExecuteAB: SwitchTypes.SwitchVal
,DNSelectAB: SwitchTypes.SwitchVal
,DDataInAB: SwitchTypes.SwitchVal
,DDataOutAB: SwitchTypes.SwitchVal
];
ClusterSimpleIORef: TYPE = REF ClusterSimpleIORec;
ClusterSimpleIORec: TYPE = RECORD [
fill0: [0 .. 32767],
IPRejectB: BOOLEAN
,fill1: [0 .. 32767],
DPRejectB: BOOLEAN
,fill2: [0 .. 32767],
PhA: BOOLEAN
,fill3: [0 .. 32767],
PhB: BOOLEAN
,fill4: [0 .. 32767],
Vdd: BOOLEAN
,fill5: [0 .. 32767],
Gnd: BOOLEAN
,fill6: [0 .. 32767],
PadVdd: BOOLEAN
,fill7: [0 .. 32767],
PadGnd: BOOLEAN
,fill8: [0 .. 32767],
RescheduleAB: BOOLEAN
,fill9: [0 .. 32767],
ClusterError: BOOLEAN
,DPData: ARRAY [0..2) OF CARDINAL
,fill11: [0 .. 255],
DPCmnd3A: PBusCommands
,fill12: [0 .. 4095],
DPFaultB: PBusFaults
,MDataAB: ARRAY [0..2) OF CARDINAL
,fill14: [0 .. 4095],
MCmdAB: MBusCommands
,fill15: [0 .. 32767],
MNShared: BOOLEAN
,fill16: [0 .. 32767],
MParityAB: BOOLEAN
,fill17: [0 .. 32767],
MNError: BOOLEAN
,fill18: [0 .. 32767],
MReadyBA: BOOLEAN
,fill19: [0 .. 32767],
M1Rq: BOOLEAN
,fill20: [0 .. 32767],
M2Rq: BOOLEAN
,fill21: [0 .. 32767],
MNewRq: BOOLEAN
,fill22: [0 .. 32767],
M1Gnt: BOOLEAN
,fill23: [0 .. 32767],
M2Gnt: BOOLEAN
,fill24: [0 .. 32767],
ResetAB: BOOLEAN
,fill25: [0 .. 32767],
DHoldAB: BOOLEAN
,fill26: [0 .. 32767],
DShiftAB: BOOLEAN
,fill27: [0 .. 32767],
DExecuteAB: BOOLEAN
,fill28: [0 .. 32767],
DNSelectAB: BOOLEAN
,fill29: [0 .. 32767],
DDataInAB: BOOLEAN
,fill30: [0 .. 32767],
DDataOutAB: BOOLEAN
];
ClusterDriveRef: TYPE = REF ClusterDriveRec;
ClusterDriveRec: TYPE = RECORD [driveRecordInitialPadding: DriveTagType, drive: PACKED ARRAY ClusterPort OF DriveLevel];
ClusterPort: TYPE = {
IPRejectB, DPRejectB, PhA, PhB, Vdd, Gnd, PadVdd, PadGnd, RescheduleAB, ClusterError, DPData, DPCmnd3A, DPFaultB, MDataAB, MCmdAB, MNShared, MParityAB, MNError, MReadyBA, M1Rq, M2Rq, MNewRq, M1Gnt, M2Gnt, ResetAB, DHoldAB, DShiftAB, DExecuteAB, DNSelectAB, DDataInAB, DDataOutAB, ClusterPortTypePad31};
CreateClusterIO: PROC [ct: CellType, switch: BOOL] RETURNS [ioAsAny: REF ANY] --IOCreator-- = {
ioAsAny ← IF switch THEN NEW[ClusterSwitchIORec] ELSE NEW[ClusterSimpleIORec];
};
CreateClusterDrive: PROC [ct: CellType] RETURNS [driveAsAny: REF ANY] --DriveCreator-- = {
driveAsAny ← NEW[ClusterDriveRec];
};
ClusterExpand: PROC [thisCell: Cell, to: ExpansionReceiver] --ExpandProc-- = {
PrivateLookupNode: PROC [name: ROPE] RETURNS [node: Node] = {node ← RoseCreate.LookupNode[from: thisCell, path: LIST[name]]};
IPRejectB: Node ← PrivateLookupNode["IPRejectB"];
DPRejectB: Node ← PrivateLookupNode["DPRejectB"];
PhA: Node ← PrivateLookupNode["PhA"];
PhB: Node ← PrivateLookupNode["PhB"];
Vdd: Node ← PrivateLookupNode["Vdd"];
Gnd: Node ← PrivateLookupNode["Gnd"];
PadVdd: Node ← PrivateLookupNode["PadVdd"];
PadGnd: Node ← PrivateLookupNode["PadGnd"];
RescheduleAB: Node ← PrivateLookupNode["RescheduleAB"];
ClusterError: Node ← PrivateLookupNode["ClusterError"];
DPData: Node ← PrivateLookupNode["DPData"];
DPCmnd3A: Node ← PrivateLookupNode["DPCmnd3A"];
DPFaultB: Node ← PrivateLookupNode["DPFaultB"];
MDataAB: Node ← PrivateLookupNode["MDataAB"];
MCmdAB: Node ← PrivateLookupNode["MCmdAB"];
MNShared: Node ← PrivateLookupNode["MNShared"];
MParityAB: Node ← PrivateLookupNode["MParityAB"];
MNError: Node ← PrivateLookupNode["MNError"];
MReadyBA: Node ← PrivateLookupNode["MReadyBA"];
M1Rq: Node ← PrivateLookupNode["M1Rq"];
M2Rq: Node ← PrivateLookupNode["M2Rq"];
MNewRq: Node ← PrivateLookupNode["MNewRq"];
M1Gnt: Node ← PrivateLookupNode["M1Gnt"];
M2Gnt: Node ← PrivateLookupNode["M2Gnt"];
ResetAB: Node ← PrivateLookupNode["ResetAB"];
DHoldAB: Node ← PrivateLookupNode["DHoldAB"];
DShiftAB: Node ← PrivateLookupNode["DShiftAB"];
DExecuteAB: Node ← PrivateLookupNode["DExecuteAB"];
DNSelectAB: Node ← PrivateLookupNode["DNSelectAB"];
DDataInAB: Node ← PrivateLookupNode["DDataInAB"];
DDataOutAB: Node ← PrivateLookupNode["DDataOutAB"];
others: SymbolTable ← RoseCreate.GetOthers[otherss, "Cluster"];
IPData: Node ← to.class.NodeInstance[erInstance: to.instance, name: "IPData", type: NumTypes.NumType[32], other: RoseCreate.GetOther[others, "IPData"]];
IPCmnd3A: Node ← to.class.NodeInstance[erInstance: to.instance, name: "IPCmnd3A", type: EnumTypes.EnumType["Dragon.PBusCommands"], other: RoseCreate.GetOther[others, "IPCmnd3A"]];
IPFaultB: Node ← to.class.NodeInstance[erInstance: to.instance, name: "IPFaultB", type: EnumTypes.EnumType["Dragon.PBusFaults"], other: RoseCreate.GetOther[others, "IPFaultB"]];
KBus: Node ← to.class.NodeInstance[erInstance: to.instance, name: "KBus", type: NumTypes.NumType[32], other: RoseCreate.GetOther[others, "KBus"]];
NodeCreateHack1: PROC [name: ROPE] RETURNS [node: Node] = {node ← to.class.NodeInstance[erInstance: to.instance, name: name, type: NumTypes.boolType, other: RoseCreate.GetOther[others, name]]};
EUSt3AisCBus2BA: Node ← NodeCreateHack1["EUSt3AisCBus2BA"];
EURes3BisPBus3AB: Node ← NodeCreateHack1["EURes3BisPBus3AB"];
EUWriteToPBus3AB: Node ← NodeCreateHack1["EUWriteToPBus3AB"];
EUAluOp2AB: Node ← to.class.NodeInstance[erInstance: to.instance, name: "EUAluOp2AB", type: EnumTypes.EnumType["Dragon.ALUOps"], other: RoseCreate.GetOther[others, "EUAluOp2AB"]];
EUCondSel2AB: Node ← to.class.NodeInstance[erInstance: to.instance, name: "EUCondSel2AB", type: EnumTypes.EnumType["Dragon.CondSelects"], other: RoseCreate.GetOther[others, "EUCondSel2AB"]];
EUCondition2B: Node ← NodeCreateHack1["EUCondition2B"];
[] ← to.class.CellInstance[erInstance: to.instance, instanceName: "ifu", typeName: IFU.IFU[[logRef:ClusterParams.ifuLogRef, lizardSimRef:ClusterParams.lizardSimRef]].name, other: RoseCreate.GetOther[others, "ifu"], interfaceNodes: ""];
[] ← to.class.CellInstance[erInstance: to.instance, instanceName: "eu", typeName: EU.EU[[logRef:ClusterParams.euLogRef]].name, other: RoseCreate.GetOther[others, "eu"], interfaceNodes: ""];
[] ← to.class.CellInstance[erInstance: to.instance, instanceName: "iCache", typeName: Cache.Cache[[cacheParm:ClusterParams.iCache, skipRejectsParm:ClusterParams.iCacheSkipRejects]].name, other: RoseCreate.GetOther[others, "iCache"], interfaceNodes: "PData:IPData, PCmdA:IPCmnd3A, PRejectB:IPRejectB, PFaultB:IPFaultB, MRq:M1Rq, MGnt:M1Gnt"];
[] ← to.class.CellInstance[erInstance: to.instance, instanceName: "eCache", typeName: Cache.Cache[[cacheParm:ClusterParams.eCache, skipRejectsParm:FALSE]].name, other: RoseCreate.GetOther[others, "eCache"], interfaceNodes: "PData:DPData, PCmdA:DPCmnd3A, PRejectB:DPRejectB, PFaultB:DPFaultB, MRq:M2Rq, MGnt:M2Gnt"];
explicitly requested CEDAR:
{ };
};
ClusterTestT: CellTestProc =
BEGIN
simpleInstr: ClusterSimpleIORef ← NARROW[simpleInstructions];
drive: ClusterDriveRef ← NARROW[driveAsAny];
BEGIN OPEN drive, simpleInstr;
originalPriority: Process.Priority = Process.GetPriority[];
diagnosticName: Rope.ROPE ← "unknown";
Process.SetPriority[ Process.priorityBackground ];
IF clusterPanelChecker=NIL
THEN clusterPanelChecker ← FORK ClusterParams.PanelCheck[];
{
ENABLE UNWIND => {
ClusterParams.clusterLog.PutF["\nSimulation of %g aborted\n\n", IO.rope[diagnosticName]];
ClusterParams.clusterLog.Flush[];
Process.SetPriority[ originalPriority ] };
DoEval: PROC = {
OPEN ClusterParams;
clusterPanel.continueTestFromAbort ← FALSE;
IF PhA THEN {
RescheduleAB ← clusterPanel.resched;
ResetAB   ← clusterPanel.reset};
[] ← RoseRun.Eval[ handle
! RoseTypes.Stop => IF clusterPanel.continueTestFromAbort
THEN CONTINUE ELSE REJECT ];
IF clusterPanel.reset THEN clusterPanel.instrCount ← -1;
Process.Yield[];
clusterPanel.continueTestFromAbort ← FALSE};
Cycles: PROC [ n: INT ] =
{FOR i: INT IN [0..n) DO DoPh[a]; DoPh[b] ENDLOOP};
DoPh: PROC [ ph: Dragon.Phase ] = {
cp: REF ClusterParams.ControlPanel ← ClusterParams.clusterPanel;
PhB  ← ph=b;
PhA  ← ph=a;
cp.phase ← ph;
DoEval[];
IF (cp.cycle >= cp.slowFromCycle OR
(cp.cycle>=0 AND cp.instrCount >= cp.slowFromInstr)) AND
cp.stopInPh[ph] THEN {
Remark[IO.PutFR["Doing cycle %g Ph%g...",
IO.int[cp.cycle], IO.char[IF ph=a THEN 'A ELSE 'B]]];
DoEval[] };
PhA ← PhB ← FALSE;
DoEval[];
WHILE cp.repeatPhase DO
PhB ← ph=b; PhA ← ph=a; DoEval[];
Remark[IO.PutFR["...repeating Ph%g evaluation..",
IO.char[IF ph=a THEN 'A ELSE 'B]]];
DoEval[];
PhA ← PhB ← FALSE; DoEval[];
ENDLOOP };
FOR port: ClusterPort IN ClusterPort DO IF drive[port]=test THEN drive[port] ← see ENDLOOP;
drive[PhA]    ← drive;
drive[PhB]    ← drive;
drive[RescheduleAB] ← drive;
drive[ResetAB]   ← drive;
root  ← RoseTypes.GetSimulationFromCellTestHandle[handle].root;
DO
Chop: PROC RETURNS [ first, rest: Rope.ROPENIL ] =
BEGIN
dStream: IO.STREAM = IO.RIS[ClusterParams.clusterPanel.diagnostic];
first ← dStream.GetTokenRope[IO.IDProc ! IO.EndOfStream => CONTINUE].token;
rest ← ClusterParams.clusterPanel.diagnostic.Substr[dStream.GetIndex];
END;
diagnosticFileName: Rope.ROPE ← diagnosticName ← Chop[].first;
ClusterError     ← FALSE;
ClusterParams.clusterPanel.reset   ← TRUE;
ClusterParams.clusterPanel.stopInPh  ← ALL[TRUE];
ClusterParams.clusterPanel.repeatPhase ← ClusterParams.clusterPanel.resched ← FALSE;
ClusterParams.clusterPanel.cycle   ← -1;
ClusterParams.clusterPanel.instrCount  ← -1;
Cycles[5 !
DragonRosemary.AssertionFailed => RESUME;
RoseTypes.Stop => IF data = $FailedAssertion THEN RESUME ELSE REJECT ];
SELECT TRUE FROM
Rope.Equal[s1: diagnosticFileName, s2: "END", case: FALSE] => EXIT;
diagnosticFileName # NIL =>
BEGIN
CacheOps.VirtualMemoryFromFile[ClusterParams.vm, diagnosticFileName ];
ClusterParams.lizardSimRef^ ← (IF ClusterParams.clusterPanel.lizardToo THEN LizardRosemary.StartNewLizard[ClusterParams.vm] ELSE NIL);
END;
ClusterParams.clusterPanel.randomSeed#0 =>
BEGIN
diagnosticName ← IO.PutFR["random code (seed = %d)", IO.int[ClusterParams.clusterPanel.randomSeed]];
ClusterParams.InsertRandomProgramInVM[ClusterParams.vm, ClusterParams.clusterPanel.randomSeed, ClusterParams.clusterLog];
ClusterParams.lizardSimRef^ ← (IF ClusterParams.clusterPanel.lizardToo THEN LizardRosemary.StartNewLizard[ClusterParams.vm] ELSE NIL);
END;
ENDCASE => EXIT; -- test is finished!!!
DoPh[a];
ClusterError   ← FALSE;
ClusterParams.clusterPanel.reset ← FALSE;
DoEval[];    -- changes ResetAB during PhA
DoPh[b];
IF ClusterParams.clusterPanel.slowFromCycle<=0 THEN Remark["Processor has been reset..."];
ClusterParams.clusterPanel.cycle ← 0;
ClusterParams.clusterLog.PutF["\n\n\n%g Dragon Rosemary simulation of %g beginning...\n\n",
IO.time[],
IO.rope[diagnosticName]];
WHILE ClusterParams.clusterPanel.randomSeed=0 OR ClusterParams.clusterPanel.cycle<=ClusterParams.clusterPanel.randomCycleLimit DO
ENABLE {
LizardRosemary.SuccessHalt => {
ClusterParams.clusterLog.PutF["\n%g Success XOP in %g at instruction %d, cycle %d.\n\n",
IO.time[],
IO.rope[diagnosticName],
IO.int[ClusterParams.clusterPanel.instrCount],
IO.int[ClusterParams.clusterPanel.cycle]];
EXIT;
};
LizardRosemary.Breakpoint => {
ClusterParams.clusterLog.PutF["\n%g Breakpoint XOP in %g at instruction %d, cycle %d.\n\n",
IO.time[],
IO.rope[diagnosticName],
IO.int[ClusterParams.clusterPanel.instrCount],
IO.int[ClusterParams.clusterPanel.cycle]];
SELECT TRUE FROM
ClusterParams.clusterPanel.emulateBreakpoint => RESUME;
diagnosticFileName # NIL => REJECT;
ENDCASE => EXIT;
};
};
DoPh[a];
DoPh[b];
IF ClusterParams.clusterPanel.ckptEveryNCycles > 0 AND ClusterParams.clusterPanel.ckptAtCycle <= ClusterParams.clusterPanel.cycle THEN
ClusterParams.clusterPanel.ckptAtCycle ← ClusterParams.clusterPanel.cycle+ClusterParams.clusterPanel.ckptEveryNCycles;
ClusterParams.clusterPanel.cycle ← ClusterParams.clusterPanel.cycle+1;
IF ClusterParams.clusterPanel.ckpt OR ClusterParams.clusterPanel.ckptAtCycle = ClusterParams.clusterPanel.cycle THEN {
ClusterParams.clusterPanel.ckpt ← FALSE;
ClusterParams.CheckPoint[ClusterParams.clusterPanel.ckptFile, root]
};
ENDLOOP; -- on ClusterParams.clusterPanel.cycle
SELECT TRUE FROM
diagnosticFileName # NIL =>
BEGIN
first, rest: Rope.ROPE;
[first, rest] ← Chop[];
IF first.Equal[diagnosticFileName] THEN
ClusterParams.clusterPanel.diagnostic ← Rope.Cat[rest, " ",first];
END;
ClusterParams.clusterPanel.randomSeed # 0 =>
ClusterParams.clusterPanel.randomSeed ← ClusterParams.clusterPanel.randomSeed+1;
ENDCASE => NULL;
ENDLOOP; -- on ClusterParams.clusterPanel.randomSeed
}; -- for catching UNWIND
END;
END;
explicitly requested CEDAR:
root:      RoseTypes.Cell ← NIL;
clusterPanelChecker: PROCESSNIL;
Remark: PROC[message: Rope.ROPE] = ClusterParams.Remark;
RegisterCells[];
END.