IFUAsmInstrDecode.mesa
Copyright c 1985 by Xerox Corporation. All rights reserved.
Last Edited by Curry, January 23, 1986 6:59:17 pm PST
DIRECTORY
CD,
CDExtras,
CDOrient,
CDFrame,
CDOps,
CDSimpleOps,
CDViewer,
Commander,
Dragon,
IO,
IFUAsm,
IFUPLAInstrDecode,
IFUPW,
PLAOps,
IFUPWControl,
REFBit,
Rope;
IFUAsmInstrDecode: CEDAR PROGRAM
IMPORTS CDFrame, Commander, IFUAsm, IFUPW, IFUPWControl, IO, PLAOps, REFBit, Rope
EXPORTS IFUAsm =
BEGIN OPEN CDF: CDFrame;
root:   Rope.ROPE = "InstrDecode";
plaRoot:  Rope.ROPE = Rope.Cat["IFUPLA", root];
module:  Rope.ROPE = Rope.Cat["IFUAsm", root];
InstrDecodeProc: CDF.ExpandProc = {
maxOuts:  INT ← 0;
ins:   REF ← REFBit.NEWFromName[plaRoot.Cat[".", root.Cat["In"] ] ];
drivesIn:  REF CDF.FrameSeq;
drivesOut: REF CDF.FrameSeq ← CDF.NewFrame
[IFUPLAInstrDecode.InstrDecodeOutCount, y, "InstrDecodePLAs", NIL, TRUE];
FOR index: INT IN [0..drivesOut.seqSize) DO
plaName: Rope.ROPEIO.PutFR["%g%g", IO.rope[plaRoot], IO.int[index] ];
pla: PLAOps.PLA ← PLAOps.ReadPLAFile[plaName.Cat[".ttt"], IFUAsm.log];
maxOuts ← MAX[maxOuts, REFBit.Desc[pla.out].bitForm.size];
drivesOut[index] ← IFUPWControl.DrPLA
[plaName, pla, precharged, AB, B];
ENDLOOP;
FOR index: INT IN [0..drivesOut.seqSize) DO
desc: IFUPWControl.PLADescription ← NARROW[drivesOut[index].data];
desc.nofOrCols ← maxOuts;
ENDLOOP;
CheckConsistancyOfInstrDecodePLAs[drivesOut];
drivesIn ← IFUPWControl.RefToDriverFrame[
name: "InstrDecodeInTemp", xory: y, data: NIL, unordered: TRUE, refRec: ins,
initial: [drDir: in, dualOut: TRUE, ref: [pos, A], out: [pos, AB]] ];
[ ]   ← IFUPWControl.BuildFrame[IFUAsm.Complete, "IFUAsmDataColumnCore", design];
new   ← GetFrame[IFUAsm.Complete, "IFUAsmDataColumnCore", NIL].new;
IF new.shell=NIL THEN ERROR;
IFUAsm.log.PutF["\n\n AccmPosAndAddDriversBasedOnShellSide drivesOut"];
drivesOut ← IFUPWControl.AccmPosAndAddDriversBasedOnShellSide
[drivesOut, new.shell, right];
IFUAsm.log.PutF["\n\n ReorderFrameBasedOnAvePos drivesOut"];
IFUPWControl.ReorderFrameBasedOnAvePos[drivesOut];
IFUAsm.log.PutF["\n\n AccmPosAndAddDriversBasedOnShellSide drivesIn"];
drivesIn[1] ← IFUPWControl.AccmPosAndAddDriversBasedOnShellSide
[drivesIn[1], new.shell, right];
IFUAsm.log.PutF["\n\n ReorderFrameBasedOnAvePos drivesIn"];
IFUPWControl.ReorderFrameBasedOnAvePos[drivesIn[1]];
FOR drive: INT IN [0..drivesOut.seqSize) DO
drivesOut[drive] ←
IFUPWControl.DrivenPLA[drivesOut[drive], design] ENDLOOP;
new ← IFUPW.NFS[root, x, LIST[
CDF.Glue[l: ext, r: conn],
IFUPW.NFS[root.Cat["Main"], y, LIST[
IFUPW.NFS[root.Cat["InputsSBDr"], x, LIST[CDF.Glue[b: conn, r: conn], drivesIn ]],
drivesOut,
IFUPWControl.DriverFill[] ]] ]]};
GetFrame: CDF.SpecificFrameProc = {
IF name=NIL THEN RETURN[NIL, FALSE];
IF frame.shell#NIL AND Rope.Equal[frame.shell.name, name] THEN RETURN[frame, TRUE];
done ← FALSE;
FOR index: INT IN [0..frame.seqSize) WHILE NOT done DO
[new, done] ← GetFrame[frame[index], name, NIL] ENDLOOP;
IF ~done THEN new ← NIL;
RETURN[new, done] };
CheckConsistancyOfInstrDecodePLAs: PROC[drivesOut: REF CDF.FrameSeq] = {
DeCONS: PROC[rope: Rope.ROPE, list: LIST OF Rope.ROPE]
RETURNS[LIST OF Rope.ROPE] = {
IF Rope.Equal[rope, list.first] THEN RETURN[list.rest];
FOR temp: LIST OF Rope.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 => IFUAsm.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.ROPE;
FOR index: INT IN [0..drivesOut.seqSize) DO
desc: IFUPWControl.PLADescription ← NARROW[drivesOut[index].data];
format ← REFBit.Desc[desc.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[format[bit].name, outlist];
IF format[bit].nameInv # NIL THEN outlist ← DeCONS[format[bit].nameInv, outlist];
ENDLOOP;
IF outlist#NIL THEN ERROR}; -- main pla did not define these outputs
InstrDecode: PUBLIC IFUPW.Frame ← CDF.NewExpandFrame[ module, InstrDecodeProc ];
InstrDecodeCT: Commander.CommandProc =
{IFUPW.AssembleFrame[IFUAsm.RefDesign[], InstrDecode, cmd ] };
Commander.Register  [proc:   InstrDecodeCT,  key: module];
END.