TamPc.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Krivacic April 10, 1987 12:55:33 pm PST
Last Edited by: Krivacic April 13, 1987 4:34:43 pm PST
DIRECTORY
Basics,
TamarinBlocks,
TamDefs;
TamPc: CEDAR PROGRAM
IMPORTS TamDefs
= BEGIN OPEN TamDefs;
PcLogic: PUBLIC PROC [d1, r: Word, xBus: Word,
topCxt, nextRegCxt: FourBitIndex,
pcRaddrSel, pcWaddrSel: OneBitIndex,
opLength: ThreeBitIndex, opLength0:
OneBitIndex, clock: OneBitIndex] RETURNS [pcNext: Word, d2: Word] = {
};
-- Instruction Buffer Latches & State Info
iBufRegs: ARRAY [0..7] OF Word;
lastIBufDataRegsClock, lastIBufDriveClock: NAT ← 0;
iBufDataLatch: Word;
ShiftAmountDecode: PROC [shiftlines: NAT] RETURNS [shiftamount: NAT] = {
-- shiftlines: [8 4 2 1] bit select line for what byte (8 = msb)
shiftamount ← SELECT shiftlines FROM 8=>0, 4=>8, 2=>16, 1=>24 ENDCASE=> 0;
};
DecodeToIndex: PROC [decoder: NAT] RETURNS [index: NAT] = {
-- decoder: [128, 64, 32, 16, 8 4 2 1] bit select line for index (1 = msb)
index ← SELECT decoder FROM 128=>0, 64=>1, 32=>2, 16=>3, 8=>4, 4=>5, 2=>6, 1=>7 ENDCASE=> 0;
};
IBufDataRegs: PUBLIC PROC [iBSres: Word, selIBufData, reset, load, clock: NAT] RETURNS [D1: Word ← ZerosWord] = {
IF (clock = 1) AND (lastIBufDataRegsClock = 0) THEN {
shiftdist: NATSELECT reset FROM 0=>0, 8=>8, 12=>16, 14=>24, 15=>32, ENDCASE => ERROR;
iBufDataLatch ← SingleWordShiftRight[SingleWordShiftLeft[iBSres, shiftdist], shiftdist];
};
lastIBufDataRegsClock ← clock;
IF selIBufData = 1 THEN D1 ← iBufDataLatch;
};
IShifter: PUBLIC PROC [curIWd, nextIWd: Word, sel: NAT] RETURNS [iBSres: Word, ibufN, opCode: NAT] = {
shiftDist: NAT ← ShiftAmountDecode[sel];
opCode ← ByteToCard[WordToBytes[DoubleWordShiftRight[curIWd, nextIWd, shiftDist]][3]];
iBSres ← DoubleWordShiftRight[curIWd, nextIWd, shiftDist + 8];
ibufN ← ByteToCard[WordToBytes[iBSres][3]];
};
IBufReg: PUBLIC PROC [ibl, nibl: Word, selCur, selNext, selWrite: NAT] RETURNS [curIWd, nextIWd: Word] = {
IF (ibl # OnesWord) OR (nibl # OnesWord) THEN iBufRegs[DecodeToIndex[selWrite]] ← ibl;
curIWd ← iBufRegs[DecodeToIndex[selCur]];
nextIWd ← iBufRegs[DecodeToIndex[selNext]];
};
IBufDrive: PUBLIC PROC [xBus: Word, nWtIBuf, clock: NAT] RETURNS [ibl, nibl: Word ← OnesWord] = {
IF (clock = 0) AND (nWtIBuf = 0) THEN {
ibl ← xBus;
nibl ← TamNot[xBus];
};
};
END.