IFUInstrDecodeImpl.Mesa
created by RoseTranslate 3.1.3 of September 5, 1985 12:14:34 pm PDT
created from IFUInstrDecode.Rose of February 26, 1986 11:24:34 am PST
created for McCreight.pa
created at March 10, 1986 7:03:03 pm PST
DIRECTORY
RoseTypes, IFUInstrDecode, RoseCreate, Dragon, DragOpsCross, IFUPLAInstrDecode, SwitchTypes;
IFUInstrDecodeImpl: CEDAR PROGRAM
IMPORTS RoseCreate, IFUPLAInstrDecode
EXPORTS IFUInstrDecode
= BEGIN OPEN
RoseTypes, IFUInstrDecode;
Signal Type decls
MicroCycleNext: TYPE = IFUPLAInstrDecode.MicroCycleNext;
PCNext: TYPE = IFUPLAInstrDecode.PCNext;
PCBusSrc: TYPE = IFUPLAInstrDecode.PCBusSrc;
PCPipeSrc: TYPE = IFUPLAInstrDecode.PCPipeSrc;
ABCSourceLt: TYPE = IFUPLAInstrDecode.ABCSourceLt;
ABCSourceRt: TYPE = IFUPLAInstrDecode.ABCSourceRt;
PlusOffset: TYPE = IFUPLAInstrDecode.PlusOffset;
MinusOffset: TYPE = IFUPLAInstrDecode.MinusOffset;
LSourceLt: TYPE = IFUPLAInstrDecode.LSourceLt;
LSourceRt: TYPE = IFUPLAInstrDecode.LSourceRt;
SSourceLt: TYPE = IFUPLAInstrDecode.SSourceLt;
SSourceRt: TYPE = IFUPLAInstrDecode.SSourceRt;
X2ALitSource: TYPE = IFUPLAInstrDecode.X2ALitSource;
ALUOps: TYPE = Dragon.ALUOps;
CondSelects: TYPE = Dragon.CondSelects;
CondEffect: TYPE = IFUPLAInstrDecode.CondEffect;
PBusCommands: TYPE = Dragon.PBusCommands;
RegisterCells: PROC =
BEGIN
InstrDecode ← RoseCreate.RegisterCellType[name: "InstrDecode",
expandProc: NIL,
ioCreator: CreateInstrDecodeIO, driveCreator: CreateInstrDecodeDrive, initializer: InitializeInstrDecode,
evals: [EvalSimple: InstrDecodeEvalSimple],
tests: LIST[],
ports: CreateInstrDecodePorts[]
];
END;
otherss: SymbolTable ← RoseCreate.GetOtherss["IFUInstrDecode.partsAssertions"];
InstrDecode: PUBLIC CellType;
CreateInstrDecodePorts: PROC RETURNS [ports: Ports] = {ports ← RoseCreate.PortsFromFile["IFUInstrDecode.InstrDecode.rosePorts"]};
InstrDecodeSwitchIORef: TYPE = REF InstrDecodeSwitchIORec;
InstrDecodeSwitchIORec: TYPE = RECORD [
MicroCycleAB: PACKED ARRAY [0 .. 8) OF SwitchTypes.SwitchVal
,InstReadyAB: SwitchTypes.SwitchVal
,OpAB: PACKED ARRAY [0 .. 8) OF SwitchTypes.SwitchVal
,AlphaAB: PACKED ARRAY [0 .. 8) OF SwitchTypes.SwitchVal
,BetaAB: PACKED ARRAY [0 .. 8) OF SwitchTypes.SwitchVal
,PushPendingAB: SwitchTypes.SwitchVal
,PopPendingAB: SwitchTypes.SwitchVal
,UserMode0AB: SwitchTypes.SwitchVal
,GetNextInstBA: SwitchTypes.SwitchVal
,MacroJumpBA: SwitchTypes.SwitchVal
,InstStarting0BA: SwitchTypes.SwitchVal
,MicroCycleNextBA: PACKED ARRAY [0 .. 3) OF SwitchTypes.SwitchVal
,PCNextBA: PACKED ARRAY [0 .. 1) OF SwitchTypes.SwitchVal
,PCBusSrcB: PACKED ARRAY [0 .. 8) OF SwitchTypes.SwitchVal
,PCPipeSrcBA: PACKED ARRAY [0 .. 3) OF SwitchTypes.SwitchVal
,Push0BA: SwitchTypes.SwitchVal
,Pop0BA: SwitchTypes.SwitchVal
,X1ASrcStackBA: SwitchTypes.SwitchVal
,X1ADstStackBA: SwitchTypes.SwitchVal
,XBusStackEldestBA: SwitchTypes.SwitchVal
,XBusStackLBA: SwitchTypes.SwitchVal
,X1ASrcSLimitAc: SwitchTypes.SwitchVal
,X1ADstSLimitAc: SwitchTypes.SwitchVal
,X2ASrcStatusBA: SwitchTypes.SwitchVal
,X1ADstStatusBA: SwitchTypes.SwitchVal
,ASourceLtBA: PACKED ARRAY [0 .. 5) OF SwitchTypes.SwitchVal
,ASourceRtBA: PACKED ARRAY [0 .. 8) OF SwitchTypes.SwitchVal
,ASourceOffBA: PACKED ARRAY [0 .. 3) OF SwitchTypes.SwitchVal
,BSourceLtBA: PACKED ARRAY [0 .. 5) OF SwitchTypes.SwitchVal
,BSourceRtBA: PACKED ARRAY [0 .. 8) OF SwitchTypes.SwitchVal
,BSourceOffBA: PACKED ARRAY [0 .. 3) OF SwitchTypes.SwitchVal
,CSourceLtBA: PACKED ARRAY [0 .. 5) OF SwitchTypes.SwitchVal
,CSourceRtBA: PACKED ARRAY [0 .. 8) OF SwitchTypes.SwitchVal
,CSourceOffBA: PACKED ARRAY [0 .. 3) OF SwitchTypes.SwitchVal
,C0IsFieldCtlBA: SwitchTypes.SwitchVal
,LSourceLtBA: PACKED ARRAY [0 .. 4) OF SwitchTypes.SwitchVal
,LSourceRtBA: PACKED ARRAY [0 .. 4) OF SwitchTypes.SwitchVal
,SSourceLtBA: PACKED ARRAY [0 .. 4) OF SwitchTypes.SwitchVal
,SSourceRtBA: PACKED ARRAY [0 .. 4) OF SwitchTypes.SwitchVal
,PopSa0BA: SwitchTypes.SwitchVal
,PopSb0BA: SwitchTypes.SwitchVal
,PushSc0BA: SwitchTypes.SwitchVal
,X2ALitSourceBA: PACKED ARRAY [0 .. 5) OF SwitchTypes.SwitchVal
,KIsRtOp0BA: SwitchTypes.SwitchVal
,FCtlIsRtOp0BA: SwitchTypes.SwitchVal
,EUAluOp0BA: PACKED ARRAY [0 .. 4) OF SwitchTypes.SwitchVal
,EUCondSel0BA: PACKED ARRAY [0 .. 4) OF SwitchTypes.SwitchVal
,EUCondEffect0BA: PACKED ARRAY [0 .. 2) OF SwitchTypes.SwitchVal
,DPCmnd0BA: PACKED ARRAY [0 .. 8) OF SwitchTypes.SwitchVal
,DPCmndRd0BA: SwitchTypes.SwitchVal
,ClearTrapsEnbledBA: SwitchTypes.SwitchVal
,ClearUserModeBA: SwitchTypes.SwitchVal
,KPadsIn0BA: SwitchTypes.SwitchVal
,X2ASrcLit0BA: SwitchTypes.SwitchVal
,PhA: SwitchTypes.SwitchVal
,PhB: SwitchTypes.SwitchVal
];
InstrDecodeSimpleIORef: TYPE = REF InstrDecodeSimpleIORec;
InstrDecodeSimpleIORec: TYPE = RECORD [
fill0: [0 .. 255],
MicroCycleAB: [0..255]
,fill1: [0 .. 32767],
InstReadyAB: BOOLEAN
,fill2: [0 .. 255],
OpAB: [0..255]
,fill3: [0 .. 255],
AlphaAB: [0..255]
,fill4: [0 .. 255],
BetaAB: [0..255]
,fill5: [0 .. 32767],
PushPendingAB: BOOLEAN
,fill6: [0 .. 32767],
PopPendingAB: BOOLEAN
,fill7: [0 .. 32767],
UserMode0AB: BOOLEAN
,fill8: [0 .. 32767],
GetNextInstBA: BOOLEAN
,fill9: [0 .. 32767],
MacroJumpBA: BOOLEAN
,fill10: [0 .. 32767],
InstStarting0BA: BOOLEAN
,fill11: [0 .. 8191],
MicroCycleNextBA: MicroCycleNext
,fill12: [0 .. 32767],
PCNextBA: PCNext
,fill13: [0 .. 255],
PCBusSrcB: PCBusSrc
,fill14: [0 .. 8191],
PCPipeSrcBA: PCPipeSrc
,fill15: [0 .. 32767],
Push0BA: BOOLEAN
,fill16: [0 .. 32767],
Pop0BA: BOOLEAN
,fill17: [0 .. 32767],
X1ASrcStackBA: BOOLEAN
,fill18: [0 .. 32767],
X1ADstStackBA: BOOLEAN
,fill19: [0 .. 32767],
XBusStackEldestBA: BOOLEAN
,fill20: [0 .. 32767],
XBusStackLBA: BOOLEAN
,fill21: [0 .. 32767],
X1ASrcSLimitAc: BOOLEAN
,fill22: [0 .. 32767],
X1ADstSLimitAc: BOOLEAN
,fill23: [0 .. 32767],
X2ASrcStatusBA: BOOLEAN
,fill24: [0 .. 32767],
X1ADstStatusBA: BOOLEAN
,fill25: [0 .. 2047],
ASourceLtBA: ABCSourceLt
,fill26: [0 .. 255],
ASourceRtBA: ABCSourceRt
,fill27: [0 .. 8191],
ASourceOffBA: PlusOffset
,fill28: [0 .. 2047],
BSourceLtBA: ABCSourceLt
,fill29: [0 .. 255],
BSourceRtBA: ABCSourceRt
,fill30: [0 .. 8191],
BSourceOffBA: PlusOffset
,fill31: [0 .. 2047],
CSourceLtBA: ABCSourceLt
,fill32: [0 .. 255],
CSourceRtBA: ABCSourceRt
,fill33: [0 .. 8191],
CSourceOffBA: MinusOffset
,fill34: [0 .. 32767],
C0IsFieldCtlBA: BOOLEAN
,fill35: [0 .. 4095],
LSourceLtBA: LSourceLt
,fill36: [0 .. 4095],
LSourceRtBA: LSourceRt
,fill37: [0 .. 4095],
SSourceLtBA: SSourceLt
,fill38: [0 .. 4095],
SSourceRtBA: SSourceRt
,fill39: [0 .. 32767],
PopSa0BA: BOOLEAN
,fill40: [0 .. 32767],
PopSb0BA: BOOLEAN
,fill41: [0 .. 32767],
PushSc0BA: BOOLEAN
,fill42: [0 .. 2047],
X2ALitSourceBA: X2ALitSource
,fill43: [0 .. 32767],
KIsRtOp0BA: BOOLEAN
,fill44: [0 .. 32767],
FCtlIsRtOp0BA: BOOLEAN
,fill45: [0 .. 4095],
EUAluOp0BA: ALUOps
,fill46: [0 .. 4095],
EUCondSel0BA: CondSelects
,fill47: [0 .. 16383],
EUCondEffect0BA: CondEffect
,fill48: [0 .. 255],
DPCmnd0BA: PBusCommands
,fill49: [0 .. 32767],
DPCmndRd0BA: BOOLEAN
,fill50: [0 .. 32767],
ClearTrapsEnbledBA: BOOLEAN
,fill51: [0 .. 32767],
ClearUserModeBA: BOOLEAN
,fill52: [0 .. 32767],
KPadsIn0BA: BOOLEAN
,fill53: [0 .. 32767],
X2ASrcLit0BA: BOOLEAN
,fill54: [0 .. 32767],
PhA: BOOLEAN
,fill55: [0 .. 32767],
PhB: BOOLEAN
];
InstrDecodeDriveRef: TYPE = REF InstrDecodeDriveRec;
InstrDecodeDriveRec: TYPE = RECORD [driveRecordInitialPadding: DriveTagType, drive: PACKED ARRAY InstrDecodePort OF DriveLevel];
InstrDecodePort: TYPE = {
MicroCycleAB, InstReadyAB, OpAB, AlphaAB, BetaAB, PushPendingAB, PopPendingAB, UserMode0AB, GetNextInstBA, MacroJumpBA, InstStarting0BA, MicroCycleNextBA, PCNextBA, PCBusSrcB, PCPipeSrcBA, Push0BA, Pop0BA, X1ASrcStackBA, X1ADstStackBA, XBusStackEldestBA, XBusStackLBA, X1ASrcSLimitAc, X1ADstSLimitAc, X2ASrcStatusBA, X1ADstStatusBA, ASourceLtBA, ASourceRtBA, ASourceOffBA, BSourceLtBA, BSourceRtBA, BSourceOffBA, CSourceLtBA, CSourceRtBA, CSourceOffBA, C0IsFieldCtlBA, LSourceLtBA, LSourceRtBA, SSourceLtBA, SSourceRtBA, PopSa0BA, PopSb0BA, PushSc0BA, X2ALitSourceBA, KIsRtOp0BA, FCtlIsRtOp0BA, EUAluOp0BA, EUCondSel0BA, EUCondEffect0BA, DPCmnd0BA, DPCmndRd0BA, ClearTrapsEnbledBA, ClearUserModeBA, KPadsIn0BA, X2ASrcLit0BA, PhA, PhB};
CreateInstrDecodeIO: PROC [ct: CellType, switch: BOOL] RETURNS [ioAsAny: REF ANY] --IOCreator-- = {
ioAsAny ← IF switch THEN NEW[InstrDecodeSwitchIORec] ELSE NEW[InstrDecodeSimpleIORec];
};
CreateInstrDecodeDrive: PROC [ct: CellType] RETURNS [driveAsAny: REF ANY] --DriveCreator-- = {
driveAsAny ← NEW[InstrDecodeDriveRec];
};
InstrDecodeStateRef: TYPE = REF InstrDecodeStateRec;
InstrDecodeStateRec: TYPE = RECORD [
nextMacroBA:   IFUPLAInstrDecode.NextMacro,
preEUAluOp0BA:  Dragon.ALUOps,
aluOpIs47BA:   BOOL,
preEUCondSel0BA:  Dragon.CondSelects,
condSelIsOp57BA:  BOOL,
preDPCmnd0BA:   Dragon.PBusCommands,
preDPCmndSel0BA:  IFUPLAInstrDecode.DPCmndSel,
x1ASrcSLimitBA:  BOOL,
x1ADstSLimitBA:  BOOL,
phALast:     BOOL
];
InitializeInstrDecode: Initializer = {
state: InstrDecodeStateRef ← NEW[InstrDecodeStateRec];
cell.realCellStuff.state ← state;
};
InstrDecodeEvalSimple: SimpleEval =
BEGIN
drive: InstrDecodeDriveRef ← NARROW[cell.realCellStuff.newDriveAsAny];
sw: InstrDecodeSwitchIORef ← NARROW[cell.realCellStuff.switchIO];
newIO: InstrDecodeSimpleIORef ← NARROW[cell.realCellStuff.newIO];
state: InstrDecodeStateRef ← NARROW[cell.realCellStuff.state];
BEGIN OPEN drive, newIO, state;
IF PhA THEN {
PCBusSrcB ← offSetPC; -- precharge
phALast ← TRUE};
IF PhB AND phALast THEN {
[ [
nextMacro:   nextMacroBA,
macroJump:   MacroJumpBA,
microCycleNext:  MicroCycleNextBA,
pcNext:    PCNextBA,
pcBusSrc:    PCBusSrcB,
pcPipeSrc:   PCPipeSrcBA,
kPadsIn:    KPadsIn0BA,
push:     Push0BA,
pop:     Pop0BA,
x1ASrcSLimit:  x1ASrcSLimitBA,
x2ASrcStatus:   X2ASrcStatusBA,
x1ASrcStack:   X1ASrcStackBA,
x1ADstSLimit:  x1ADstSLimitBA,
x1ADstStatus:  X1ADstStatusBA,
x1ADstStack:   X1ADstStackBA,
xBusStackEldest:  XBusStackEldestBA,
xBusStackL:   XBusStackLBA,
aReg:     [ASourceLtBA, ASourceRtBA, ASourceOffBA],
bReg:     [BSourceLtBA, BSourceRtBA, BSourceOffBA],
cReg:     [CSourceLtBA, CSourceRtBA, CSourceOffBA],
cRegIsField:   C0IsFieldCtlBA,
lSource:    [LSourceLtBA, LSourceRtBA],
sSource:    [SSourceLtBA, SSourceRtBA],
popSa:     PopSa0BA,
popSb:    PopSb0BA,
pushSc:    PushSc0BA,
x2ALitSource:  X2ALitSourceBA,
kIsRtOp:    KIsRtOp0BA,
fCtlIsRtOp:   FCtlIsRtOp0BA,
aluOp:    preEUAluOp0BA,
aluOpIsOp47:   aluOpIs47BA,
condSel:    preEUCondSel0BA,
condSelIsOp57:  condSelIsOp57BA,
condEffect:   EUCondEffect0BA,
dpCmnd:    preDPCmnd0BA,
dpCmndIsRd:   DPCmndRd0BA,
dpCmndSel:   preDPCmndSel0BA,
clearTrapsEnbled: ClearTrapsEnbledBA,
clearUserMode:  ClearUserModeBA
] ] ← IFUPLAInstrDecode.InstrDecodeProc[ [
state:    MicroCycleAB,
instReady:  InstReadyAB,
op:    DragOpsCross.Inst[VAL[OpAB]],
alpha:    AlphaAB,
beta:    BetaAB,
pushPending: PushPendingAB,
popPending:  PopPendingAB,
userMode:  UserMode0AB ] ];
DPCmnd0BA ← SELECT preDPCmndSel0BA FROM
beta  => LOOPHOLE[BetaAB],
ENDCASE => preDPCmnd0BA;
EUAluOp0BA ← IF aluOpIs47BA
THENLOOPHOLE[OpAB MOD 16] ELSE preEUAluOp0BA;
EUCondSel0BA ← IF condSelIsOp57BA
THENLOOPHOLE[OpAB MOD 8] ELSE preEUCondSel0BA;
X2ASrcLit0BA ← X2ALitSourceBA # none;
GetNextInstBA ← nextMacroBA=get;
InstStarting0BA ← MicroCycleAB=0;
phALast ← FALSE;
};
X1ASrcSLimitAc ← PhA AND x1ASrcSLimitBA;
X1ADstSLimitAc ← PhA AND x1ADstSLimitBA;
END;
END;
RegisterCells[];
END.