IFUBitSlice1.rose
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last edited by: McCreight, September 11, 1984 3:37:09 pm PDT
Last edited by: Curry, September 28, 1984 10:14:09 am PDT
Directory DragOpsCross, DragonMicrocode;
Imports BitOps, CacheOps, Dragon, DragonIFU;
IPDataParity: CELL [
IPDataB    < INT[32], -- bit slice
IPDataParityOddB > BOOL -- control slice
]
EvalSimple
IPDataParityOddB ← CacheOps.Parity32[Dragon.LongFromDouble[IPDataB]];
ENDCELL;
IPrefetchBuffer: CELL [
IPDataB   < INT[32], -- bit slice
PreOpA   > INT[8],
PreAlphaA  > INT[8],
PreBetaA   > INT[8],
PreGammaA  > INT[8],
PreDeltaA  > INT[8],
IBufWrtWdClkB < INT[4], -- control slice
IBufRdByteClkA < INT[16],
PhB    <BOOL
]
State
notIPDataB: Dragon.HexWord,
iBuf: ARRAY [0..16) OF Dragon.HexByte
EvalSimple
m: CARDINAL;
notIPDataB ← Dragon.LongFromDouble[BitOps.DNOT[IPDataB, 32]]; -- static logic
IF PhB THEN -- precharge
PreOpA ← PreAlphaA ← PreBetaA ← PreGammaA ← PreDeltaA ← 255;
m ← 1;
FOR j: [0..16) IN [0..16) DO
m ← m+m;
IF j<4 AND BitOps.WAND[m, IBufWrtWdClkB] # 0 THEN
FOR k: NAT IN [0..4) DO
iBuf[4*j+k] ← BitOps.ECFD[IPDataB, 32, 8*k, 8];
ENDLOOP;
IF BitOps.WAND[m, IBufRdByteClkA] # 0 THEN
BEGIN
PreOpA ← BitOps.WAND[PreOpA, iBuf[j]];
PreAlphaA ← BitOps.WAND[PreAlphaA, iBuf[(j+1) MOD 16]];
PreBetaA ← BitOps.WAND[PreBetaA, iBuf[(j+2) MOD 16]];
PreGammaA ← BitOps.WAND[PreGammaA, iBuf[(j+3) MOD 16]];
PreDeltaA ← BitOps.WAND[PreDeltaA, iBuf[(j+4) MOD 16]];
END;
ENDLOOP;
ENDCELL;
IReg: CELL [
XBus    = INT[32], -- bit slice
PreOpA   < INT[8],
PreAlphaA  < INT[8],
PreBetaA   < INT[8],
PreGammaA  < INT[8],
PreDeltaA  < INT[8],
OpAB    > INT[8],
AlphaAB   > INT[8],
BetaAB   > INT[8],
GammaAB  > INT[8],
DeltaAB   > INT[8],
OpBA    > INT[8],
AlphaBA   > INT[8],
BetaBA   > INT[8],
BufHasAtLeast1A < BOOL, -- control slice
BufHasAtLeast2A < BOOL,
BufHasAtLeast3A < BOOL,
BufHasAtLeast5A < BOOL,
InstReadyAB   > BOOL,
OpLengthAB   > INT[3],
XLitByte3PhAorB < BOOL,
XZeroByte2PhA  < BOOL,
XLitByte2PhAorB < BOOL,
XZeroByte01PhA  < BOOL,
XLitByte01PhAorB < BOOL,
PhA    <BOOL,
PhB    <BOOL
]
State
gammaBA: Dragon.HexWord,
deltaBA: Dragon.HexWord
EvalSimple
IF PhA THEN
BEGIN
op0: BOOL = BitOps.EBFW[PreOpA, 8, 0];
op1: BOOL = BitOps.EBFW[PreOpA, 8, 1];
op2: BOOL = BitOps.EBFW[PreOpA, 8, 2];
not2: BOOL = NOT (op0 AND NOT op1); -- OpLength[op]#2
not3: BOOL = NOT (op0 AND op1); -- OpLength[op]#3
not5: BOOL = NOT (NOT op0 AND NOT op1 AND op2); -- OpLength[op]#5
OpLengthAB ← (IF NOT not5 THEN 4 ELSE 0)+(IF op0 THEN 2 ELSE 0)+(IF not2 THEN 1 ELSE 0);
InstReadyAB ← NOT (NOT BufHasAtLeast1A OR NOT (not2 OR BufHasAtLeast2A) OR NOT (not3 OR BufHasAtLeast3A) OR NOT (not5 OR BufHasAtLeast5A));
OpAB ← PreOpA;
AlphaAB ← PreAlphaA;
BetaAB ← PreBetaA;
GammaAB ← PreGammaA;
DeltaAB ← PreDeltaA;
END;
IF PhB THEN
BEGIN
OpBA ← OpAB;
AlphaBA ← AlphaAB;
BetaBA ← BetaAB;
gammaBA ← GammaAB;
deltaBA ← DeltaAB;
END;
IF XLitByte3PhAorB THEN XBus ← BitOps.ICID[AlphaBA, XBus, 32, 24, 8];
IF XZeroByte2PhA THEN XBus ← BitOps.ICID[0, XBus, 32, 16, 8];
IF XLitByte2PhAorB THEN XBus ← BitOps.ICID[BetaBA, XBus, 32, 16, 8];
IF XZeroByte01PhA THEN XBus ← BitOps.ICID[0, XBus, 32, 0, 16];
IF XLitByte01PhAorB THEN
BEGIN
XBus ← BitOps.ICID[gammaBA, XBus, 32, 8, 8];
XBus ← BitOps.ICID[deltaBA, XBus, 32, 0, 8];
END;
ENDCELL;
IPCHandler: CELL [
XBus    = INT[32], -- bit slice
OpBA    < INT[8],
AlphaBA   < INT[8],
BetaBA   < INT[8],
IPAddrBA   > INT[32],
PCPipeToStackBA > INT[32],
NoJumpClkB    < BOOL, -- control slice
JumpToXAClkB   < BOOL,
JumpToXBClkB   < BOOL,
JumpToTrapClkB  < BOOL,
JumpToSumClkB   < BOOL,
AddBetaAlphaClkB  < BOOL,
AddAlphaClkB   < BOOL,
AddXAClkB    < BOOL,
PipeSumBA   < BOOL,
PipeSuccessorBA  < BOOL,
PipeNormalBA  < BOOL,
IncrPrefetchPCBA < BOOL,
IncrPCBA   < BOOL,
NoIncrPCBA   < BOOL,
CJumpOtherWayAB < BOOL,
PhA    < BOOL,
PhB    < BOOL
]
State
adder, addend: Dragon.HexWord,
sumBA, xAB: Dragon.HexWord,
ipAddrAB: Dragon.HexWord,
npcBA, pcAB, pcBA: Dragon.HexWord,
pcPipe: ARRAY [0..3] OF ARRAY Dragon.Phase OF Dragon.HexWord,
phALast, noJump, oneJump, oneSum: BOOL -- for debugging
EvalSimple
sum: Dragon.HexWord;
IF PhB THEN adder ← pcAB;
IF AddBetaAlphaClkB THEN
addend ← LONG[256]*(BetaBA-(IF BetaBA<128 THEN 0 ELSE 256))+AlphaBA;
IF AddAlphaClkB THEN
addend ← AlphaBA-(IF AlphaBA<128 THEN 0 ELSE 256);
IF AddXAClkB THEN
addend ← xAB;
IF PhA THEN
BEGIN
adder ← pcBA; -- previous instruction
addend ← Dragon.OpLength[OpBA];
END;
sum ← adder+addend; -- 2's complement, ignoring overflow
IF NoJumpClkB THEN
BEGIN
npcBA ← pcAB;
IPAddrBA ← Dragon.LongToDouble[ipAddrAB];
END;
IF JumpToXAClkB THEN
BEGIN
npcBA ← xAB;
IPAddrBA ← Dragon.LongToDouble[npcBA/4];
END;
IF JumpToXBClkB THEN
BEGIN
npcBA ← Dragon.LongFromDouble[XBus];
IPAddrBA ← Dragon.LongToDouble[npcBA/4];
END;
IF JumpToTrapClkB THEN
BEGIN
npcBA ← DragOpsCross.TrapBase+OpBA*DragOpsCross.TrapWidthBytes;
IPAddrBA ← Dragon.LongToDouble[npcBA/4];
END;
IF JumpToSumClkB THEN
BEGIN
npcBA ← sum;
IPAddrBA ← Dragon.LongToDouble[npcBA/4];
END;
IF PhA THEN
BEGIN
Dragon.Assert[ NOT (AddBetaAlphaClkB OR AddAlphaClkB OR AddXAClkB OR NoJumpClkB OR JumpToXAClkB OR JumpToXBClkB OR JumpToSumClkB) ];
Dragon.Assert [ Dragon.OneOf [ IncrPCBA, NoIncrPCBA ] ];
Dragon.Assert [ Dragon.OneOf [ PipeSumBA, PipeSuccessorBA, PipeNormalBA ] ];
xAB ← Dragon.LongFromDouble[XBus];
ipAddrAB ← Dragon.LongFromDouble[IPAddrBA]+(IF IncrPrefetchPCBA THEN 1 ELSE 0);
pcAB ← (SELECT TRUE FROM
IncrPCBA => sum, -- move to successor
NoIncrPCBA => npcBA, -- don't, because PC shouldn't move or instr. jumped
ENDCASE  => 0
);
pcPipe[1][a] ← (SELECT TRUE FROM -- Pipeline..
PipeSumBA  => sumBA, -- target, for conditional jumps predicting false
PipeSuccessorBA => sum, -- successor, for Calls or conditional jumps predicting true
PipeNormalBA => pcBA, -- PC, for normal instructions
ENDCASE   => 0
);
pcPipe[2][a] ← pcPipe[1][b];
pcPipe[3][a] ← pcPipe[2][b];
phALast ← TRUE;
END;
IF PhB THEN
BEGIN
sumBA ← sum;
pcBA ← pcAB;
pcPipe[1][b] ← pcPipe[1][a];
pcPipe[2][b] ← pcPipe[2][a];
pcPipe[3][b] ← pcPipe[3][a];
PCPipeToStackBA ← Dragon.LongToDouble[pcPipe[3][a]];
IF CJumpOtherWayAB THEN XBus ← Dragon.LongToDouble[pcPipe[3][a]];
noJump ← NoJumpClkB;
oneSum ← Dragon.OneOf[AddBetaAlphaClkB, AddAlphaClkB, AddXAClkB];
oneJump ← Dragon.OneOf[NoJumpClkB, JumpToXAClkB, JumpToXBClkB, JumpToTrapClkB, JumpToSumClkB];
phALast ← FALSE;
END
ELSE Dragon.Assert[oneJump AND (noJump OR oneSum)];
ENDCELL;