IFUSrcInstrDecode.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last Edited by Curry, July 21, 1986 5:48:41 pm PDT
DIRECTORY CDOrient, Core, CoreBlock, CoreFrame, CoreGlue, CoreName, IFUCoreCtl, IFUCoreDrive, IFUPLAInstrDecode, IFUSrc, IO, PLAOps, REFBit, Rope, WatchStats;
IFUSrcInstrDecode: CEDAR PROGRAM
IMPORTS CoreFrame, CoreGlue, CoreName, IFUCoreCtl, IFUCoreDrive, IO, PLAOps, REFBit, Rope, WatchStats
EXPORTS IFUSrc =
BEGIN
ROPE:   TYPE = Core.ROPE;
root:   ROPE = "InstrDecode";
plaRoot:  ROPE = Rope.Cat["IFUPLA", root];
PlaDscs:  TYPE = ARRAY [0..nofPlas) OF REF PLAD;
nofPlas:  INT = IFUPLAInstrDecode.InstrDecodeOutCount; -- 1;
PLAD:   TYPE = IFUCoreCtl.PLADescriptionRec;
ExceptionalOutSignals: ARRAY [0..nofPlas) OF ROPE;
InstrDecode: PUBLIC PROC [sIn: ROPE, altOut: ROPENIL]
RETURNS [cellType: Core.CellType, sOut: ROPE] = {
cachedName:  ROPE ← CoreName.RopeNm[plaRoot.Cat["Main"]];
IF (cellType ← CoreFrame.ReadFrameCache[cachedName])=NIL THEN {
maxOuts: INT ← 0;
ins:  REF ← REFBit.NEWFromName[plaRoot.Cat[".", root.Cat["In"] ] ];
plaDscs: PlaDscs;
drivesOut:  Core.CellType ←
CoreFrame.NewFrameCell[name: root.Cat["OutDr"], rec: [first: top], size: nofPlas];
drivesIn:   Core.CellType;
FOR index: INT IN [0..nofPlas) DO
plaName: ROPE  ← IO.PutFR["%g%g", IO.rope[plaRoot], IO.int[index] ];
plaDscs[index] ← NEW[PLAD ← [
name: plaName,
plaType: precharged,
includeIns: FALSE,
plaPhs: [AB, A, ABB, B, BA], capSides: none ] ];
plaDscs[index].ttt ← PLAOps.ReadPLAFile[plaName.Cat[".ttt"], log];
maxOuts ← MAX[maxOuts, REFBit.Desc[plaDscs[index].ttt.out].bitForm.size];
ENDLOOP;
sOut ← sIn;
FOR index: INT IN [0..nofPlas) DO
plaDscs[index].nofOrCols ← maxOuts;
IFUCoreCtl.MakePLA1[plaDscs[index]];
IFUCoreDrive.AdjustDriveOutPh[plaDscs[index].outDrs, ExceptionalOutSignals[index]];
sOut ← IFUCoreDrive.ConnectDrives[plaDscs[index].outDrs, sOut];
CoreFrame.FCT[drivesOut].seq[index] ← IFUCoreCtl.CellProc[outSec, plaDscs[index]];
ENDLOOP;
[plaDscs[0].inDrs, sOut] ← IFUCoreDrive.CapDrives[plaDscs[0].inDrs, sOut, altOut];
drivesIn ← IFUCoreDrive.DrivesToFrame[root.Cat["InDr"], plaDscs[0].inDrs];
FOR index: INT IN [0..nofPlas) DO
IF WatchStats.GetWatchStats[].vmFree < 10000 THEN {
log.PutF["\nAborting InstrDecode at %g", IO.int[index]]; RETURN[NIL, NIL]};
IFUCoreCtl.MakePLA2[plaDscs[index]] ENDLOOP;
CheckConsistancyOfInstrDecodePLAs[plaDscs];
cellType ← CoreFrame.NewFrameCells[name: cachedName, rec: [first: top], cells: LIST[
CoreFrame.NewFrameCells[name: root.Cat["InSBDr"], rec: [first: left], cells: LIST[
CoreGlue.CellProc[name: root.Cat["InSB"], b: conn, r: conn],
drivesIn ]],
drivesOut ]];
[ ]  ← CoreName.CellNm[cellType, cachedName];
IFUCoreDrive.SetDShiftIO[cellType, sIn, sOut];
CoreFrame.WriteFrameCache[cellType]};
[sIn, sOut] ← IFUCoreDrive.GetDShiftIO[cellType];
cellType ← CoreFrame.NewFrameCells[name: root, rec: [first: left], cells: LIST[
CoreGlue.CellProc[l: ext, r: conn],
cellType ]]};
CheckConsistancyOfInstrDecodePLAs: PROC[plaDscs: PlaDscs] = {
DeCONS: PROC[rope: ROPE, list: LIST OF ROPE]
RETURNS[LIST OF ROPE] = {
IF Rope.Equal[rope, list.first] THEN RETURN[list.rest];
FOR temp: LIST OF ROPE ← list, temp.rest WHILE temp.rest#NIL DO
IF NOT Rope.Equal[rope, temp.rest.first] THEN LOOP;
temp.rest ← temp.rest.rest;
EXIT REPEAT FINISHED => log.PutF
["\n ERROR: %g not driven by any of the Instruction Decode PLA's", IO.rope[rope]]
ENDLOOP;
RETURN[list]};
format: REFBit.Format;
outlist: LIST OF ROPE;
FOR index: INT IN [0..nofPlas) DO
format ← REFBit.Desc[plaDscs[index].ttt.out].bitForm;
FOR bit: INT IN [0..format.size) DO
IF format[bit].name  # NIL THEN outlist ← CONS[format[bit].name, outlist];
IF format[bit].nameInv # NIL THEN outlist ← CONS[format[bit].nameInv, outlist];
ENDLOOP;
ENDLOOP;
format ← REFBit.Desc[plaRoot.Cat[".", root, "Out"]].bitForm;
FOR bit: INT IN [0..format.size) DO
IF format[bit].name  # NIL THEN outlist ←
DeCONS[CoreName.BitRopeToSigRope[format[bit].name], outlist];
IF format[bit].nameInv # NIL THEN outlist ←
DeCONS[CoreName.BitRopeToSigRope[format[bit].nameInv], outlist];
ENDLOOP;
IF outlist#NIL THEN Signal[]}; -- main pla did not define these outputs
Signal: SIGNAL = CODE;
log: IO.STREAM ← CoreFrame.GetLog[];
ExceptionalOutSignals[0] ← "
PcBusSrcOffSetPCBA  NotPcBusSrcOffSetPCBA
PcBusSrcPipe3BA   NotPcBusSrcPipe3BA
PcBusSrcStackBA   NotPcBusSrcStackBA
PcBusSrcXopGenBA   NotPcBusSrcXopGenBA
PcBusSrcTrapGenBA  NotPcBusSrcTrapGenBA
PcBusSrcAlpBetGamDelBA NotPcBusSrcAlpBetGamDelBA
PcBusSrcXBA    NotPcBusSrcXBA
PcBusSrcPcBA    NotPcBusSrcPcBA
X2ALitSourceNone0BA  NotX2ALitSourceNone0BA";
ExceptionalOutSignals[1] ← "
NotClearTrapsEnbledBA
NotClearUserModeBA";
ExceptionalOutSignals[2] ← NIL;
ExceptionalOutSignals[3] ← NIL;
ExceptionalOutSignals[4] ← " NotPushScBA ";
ExceptionalOutSignals[5] ← NIL;
ExceptionalOutSignals[6] ← "
AluOpIsOp47BA  NotAluOpIsOp47BA
CondSelIsOp57BA  NotCondSelIsOp57BA
X1ASrcStackLAcNotX1ASrcStackLAc
X1ASrcStackPAc  NotX1ASrcStackPAc
X1ASrcSLimitAc  NotX1ASrcSLimitAc
X1ADstSLimitAc
X1ADstStatusBA  NotX1ADstStatusBA
X1ADstStackBA  NotX1ADstStackBA ";
END.