IFUSrcImpl.mesa
Copyright c 1985 by Xerox Corporation. All rights reserved.
Last Edited by Curry, July 23, 1986 7:02:10 pm PDT
DIRECTORY Atom, CCDUtils, CD, Commander, CommandTool, Core, CoreFrame, CoreGlue, CoreName, CoreXform, DragOpsCross, IFUCoreData, IFUSrc, IO, PW, Process, Rope;
IFUSrcImpl: CEDAR PROGRAM
IMPORTS CCDUtils, Commander, CommandTool, CoreFrame, CoreGlue, CoreName, CoreXform, IFUCoreData, IFUSrc, IO, PW, Process, Rope
EXPORTS IFUSrc =
BEGIN
ROPE: TYPE = Core.ROPE;
ifuContext: PUBLIC CoreName.Context ← CoreName.NewContext[];
dShIn:   PUBLIC ROPE ← CoreName.RopeNm["DShIn"];
dShLeftOut:  PUBLIC ROPE ← CoreName.RopeNm["DShLeftOut"];
dShRightOut: PUBLIC ROPE ← CoreName.RopeNm["DShRightOut"];
dShOut:   PUBLIC ROPE ← CoreName.RopeNm["DShOut"];
ProcRegToList: PUBLIC PROC [reg: DragOpsCross.ProcessorRegister] RETURNS[LIST OF REF] =
{val: CARDINALLOOPHOLE[reg]; RETURN[CardToList[val, 8]]};
CardToList: PUBLIC PROC [val, size: CARDINAL] RETURNS[new: LIST OF REF] = {
new ← NIL;
THROUGH [0..size) DO
new ← CONS[(IF (val MOD 2)=1 THEN "VDD" ELSE "GND"), new];
val ← val/2;
ENDLOOP};
TestSwitching: PROC RETURNS[cellType: Core.CellType] = {
cellType ← IFUCoreData.CellProc[
subClass: "SwitchBox",
name:  "TestSwitching",
top:  "(A.)",
bot:  "(NIL A.)",
xform:  CoreXform.GenXform[LIST[ [2, 0] ]] ]};
TranslateCellName: PROC[name: ROPE] RETURNS[cell: Core.CellType] = {
cell ← SELECT CoreName.RopeNm[name] FROM
CoreName.RopeNm[ "Complete"  ] => IFUSrc.Complete[],
CoreName.RopeNm[ "PadTop"   ] => IFUSrc.PadTop[],
CoreName.RopeNm[ "PadHeart"  ] => IFUSrc.PadHeart[],
CoreName.RopeNm[ "PadBot"   ] => IFUSrc.PadBot[],
CoreName.RopeNm[ "PadLt"   ] => IFUSrc.PadLt[],
CoreName.RopeNm[ "HeartLt"   ] => IFUSrc.HeartLt[],
CoreName.RopeNm[ "Heart"   ] => IFUSrc.Heart[],
CoreName.RopeNm[ "PadRt"   ] => IFUSrc.PadRt[],
CoreName.RopeNm[ "LeftColumn" ] => IFUSrc.LeftColumn[],
CoreName.RopeNm[ "DataColumn" ] => IFUSrc.DataColumn[],
CoreName.RopeNm[ "RightColumn" ] => IFUSrc.RightColumn[],
CoreName.RopeNm[ "LeftColumnTop" ] => IFUSrc.LeftColumnTop[],
CoreName.RopeNm[ "FetchIndexing" ] => IFUSrc.FetchIndexing[],
CoreName.RopeNm[ "FetchControler" ] => IFUSrc.FetchControler
["testing", dShLeftOut].cellType,
CoreName.RopeNm[ "LtDrPadIO"  ] => IFUSrc.LtDrPadIO["testing"].cellType,
CoreName.RopeNm[ "LeftColumnBot" ] => IFUSrc.LeftColumnBot[],
CoreName.RopeNm[ "StackControler" ] => IFUSrc.StackControler["testing"].cellType,
CoreName.RopeNm[ "Interlock"  ] => IFUSrc.Interlock[dShIn].cellType,
CoreName.RopeNm[ "MainPipeControl" ] => IFUSrc.MainPipeControl["testing"].cellType,
CoreName.RopeNm[ "StackIndexing" ] => IFUSrc.StackIndexing[],
CoreName.RopeNm[ "InstrDecode" ] => IFUSrc.InstrDecode
["testing", dShRightOut].cellType,
CoreName.RopeNm[ "RtDrPadIO"  ] => IFUSrc.RtDrPadIO[dShLeftOut].cellType,
CoreName.RopeNm[ "StatusControl" ] => IFUSrc.StatusControl[],
CoreName.RopeNm[ "DataColumnTop" ] => IFUSrc.DataColumnTop[],
CoreName.RopeNm[ "Fetch"   ] => IFUSrc.Fetch[],
CoreName.RopeNm[ "FetchBuf"  ] => IFUSrc.FetchBuf[],
CoreName.RopeNm[ "XaForm"   ] => IFUSrc.XaForm[],
CoreName.RopeNm[ "PCFormTop"  ] => IFUSrc.PCFormTop[],
CoreName.RopeNm[ "PCFormBot"  ] => IFUSrc.PCFormBot[],
CoreName.RopeNm[ "DataColumnBot" ] => IFUSrc.DataColumnBot[],
CoreName.RopeNm[ "StackBuf"  ] => IFUSrc.StackBuf[],
CoreName.RopeNm[ "LSForm"   ] => IFUSrc.LSForm[],
CoreName.RopeNm[ "ABForm"  ] => IFUSrc.ABForm[],
CoreName.RopeNm[ "ControlPipe"  ] => IFUSrc.ControlPipe[],
ENDCASE          => NIL};
IFUBatchBuildRun: Commander.CommandProc = {
log:  IO.STREAM  ← CoreFrame.GetLog[];
cell:  Core.CellType ← NIL;
line:  ROPE    ← "RollBackAnd IFUPack; IFUBatchBuild ";
list:  LIST OF ROPE ← CommandTool.ParseToList[cmd].list;
IF list=NIL THEN RETURN[$Done, "\nIFUBatchBuild Loaded\n"];
cell ← TranslateCellName[ list.first];
log.Close[];
IF cell=NIL THEN cmd.err.PutRope[" -- Unknown name\n"];
IF list.rest=NIL THEN {
[ ] ← CommandTool.DoCommand["Source IFUBatchBuildFinish.cm", cmd];
RETURN[$Done, "\nIFUBatchBuild Complete\n"]};
FOR list ← list.rest, list.rest WHILE list#NIL DO line ← Rope.Cat[line, " ", list.first] ENDLOOP;
[ ] ← CommandTool.DoCommand[line, cmd]};
IFUBatchPlotRun: Commander.CommandProc = {
cell:  Core.CellType ← NIL;
line:  ROPE    ← "RollBackAnd IFUBatchPlot";
list:  LIST OF ROPE ← CommandTool.ParseToList[cmd].list;
FOR list ← list, list.rest WHILE list#NIL DO
[ ] ← CommandTool.DoCommand[IO.PutFR
["CDPlot -n /Indigo/Dragon/IFUModules/%g.dale", IO.rope[list.first]], cmd];
[ ] ← CommandTool.DoCommand[IO.PutFR
["Copy /Indigo/Dragon/IFUModules/%g.pd ← PD/Plot1.pd", IO.rope[list.first]], cmd];
[ ] ← CommandTool.DoCommand[IO.PutFR
["PeachPrint -n /Indigo/Dragon/IFUModules/%g.pd", IO.rope[list.first]], cmd];
ENDLOOP;
RETURN[$Done, "\nIFUBatchPlot Complete\n"]};
RunCTSoft: Commander.CommandProc = {
log:   IO.STREAM  ← CoreFrame.GetLog[];
nofArgs:  INT    ← CommandTool.NumArgs[cmd];
top:   Core.CellType ← NIL;
recCell:  Core.CellType ← NIL;
obj:   CD.Object  ← NIL;
cleanUp:  BOOL    ← FALSE;
status:   CoreGlue.Status;
build:   LIST OF ROPE;
list:   LIST OF ROPE;
comlist:  LIST OF ROPE ← CommandTool.ParseToList[cmd].list;
FOR list ← comlist, list.rest WHILE list#NIL DO
Next: PROC RETURNS[next: ROPE] =
{IF list.rest=NIL THEN ERROR; list ← list.rest; next ← list.first};
SELECT list.first.Fetch[0] FROM
'- => SELECT list.first.Fetch[1] FROM
'B, 'b  => build  ← CONS[Next[], build];
'C, 'c  => cleanUp ← TRUE;
ENDCASE;
ENDCASE => build  ← CONS[list.first, build];
ENDLOOP;
IF build.rest # NIL THEN RETURN
[$Failure, "\nWhat did you hope to accomplish with multiple frame names?\n"];
IF build.first=NIL THEN build ← CONS["Complete", build];
top ← NARROW[Atom.GetProp[$IFUFrames, build.first]];
top ← IFUSrc.FetchControler[];
top ← TestSwitching[];
top ← IFUSrc.ABForm[];
CoreFrame.Expand[hard, top];
status  ← CoreGlue.RouteHard[top]; IF status#complete2 THEN Signal[];
obj  ← CCDUtils.Layout[top];
[]   ← PW.Draw[obj] };
IF status#complete2 THEN RETURN[$Failure, "Routing Errors"];
IF CoreConnect.Connect[top]#TRUE  THEN RETURN[$Failure, "Connection Errors"];
top  ← CoreOps.Recast[top];
CoreOps.PrintCellType[top, log];
};
Signal: SIGNAL = CODE;
Commander.Register[proc: IFUBatchBuildRun, key: "IFUBatchBuild"];
Commander.Register[proc: IFUBatchPlotRun,  key: "IFUBatchPlot"];
Commander.Register[proc: RunCTSoft,   key: "IFUSrc"];
Process.SetPriority[Process.priorityBackground]
END.