EUPLAMainControl.mesa
Copyright c 1984 by Xerox Corporation. All rights reserved.
Last edited by Curry, April 10, 1985 2:12:52 pm PST
DIRECTORY
Dragon,
EUPLA,
PLAOps,
PW;
EUPLAMainControl:
CEDAR
PROGRAM
IMPORTS PLAOps, PW =
BEGIN OPEN EUPLA, PO: PLAOps;
GenMainControlPLA:
PROC = {
aluLtSig: Dragon.ALULeftSources ← LAST[Dragon.ALULeftSources];
aluLtIsAbus: PO.BoolExpr ← BE[m:[aluLt: aluLtSig], d:[aluLt: aBus]];
kIsRtOp: PO.BoolExpr ← BE[m:[kIsRtOp: TRUE], d:[kIsRtOp: TRUE]];
Set[s: PO.And[aluLtIsAbus, kIsRtOp], out: [doThis: TRUE] ];
Set[s: aluLtIsAbus, out: [doThat: TRUE] ];
Write it out just for the hell of it
PO.WritePLAFile["MainControl.pla", ,MainControlPLA] };
Define some utility procs
BE:
PROC [m, d: MainControlIn]
RETURNS[
PO.BoolExpr] = {
mRef: REF MainControlIn ← NARROW[MainControlPLA.mask];
dRef: REF MainControlIn ← NARROW[MainControlPLA.data];
mRef^ ← m; dRef^ ← d; RETURN[PO.GetBEForDataMask[MainControlPLA]]};
Set:
PROC [s:
PO.BoolExpr ←
NIL, m, d: MainControlIn ← [ ], out: MainControlOut] = {
res: REF MainControlOut ← NARROW[MainControlPLA.out];
IF s=
NIL
THEN s ← BE[m,d]
ELSE s ← PO.And[s, BE[m,d] ];
res^ ← out; PO.SetOutForBE[MainControlPLA, s]};
If you want to read in a modified .pla file
ReadMainControl: PROC = {MainControlPLA ← PO.ReadPLAFile["MainControl.pla"] };
MainControlCell:
PROC
RETURNS[cell:
PW.ObjName] = {
pla: PO.PLA ← MainControlPLA;
iFormat: PO.Format ← MainControlPLA.iForm;
FOR outField:
CARDINAL
IN [0..pla.oForm.size)
DO
row: PW.ObjName ← NIL;
inField: CARDINAL ← 0;
foundTerm: PO.Term ← NIL;
IF pla.oForm[outField].bitSize#1 THEN ERROR; -- You promised only BOOLs
FOR term:
PO.Term ← pla.termList.begin, term.next
WHILE term#
NIL
DO
IF PO.GetOutQrt[term, pla.oForm[outField].firstBit]#one THEN LOOP;
IF foundTerm#NIL THEN ERROR; -- It was in the contract, only one term
foundTerm ← term;
ENDLOOP;
IF foundTerm= NIL THEN ERROR; -- Output not used ? What did you want to happen
FOR recIdx:
INT
IN [0..pla.termList.inBits)
DO
IF recIdx=(iFormat[inField].firstBit+iFormat[inField].bitSize) THEN inField←inField+1;
IF recIdx< iFormat[inField].firstBit THEN LOOP;
SELECT
PO.GetInQrt[foundTerm, recIdx]
FROM
dontcare => {row ← PW.AbutX[row, "Blank"]};
one => {row ← PW.AbutX[row, "One"]};
zero => {row ← PW.AbutX[row, "Zero"]};
ENDCASE => ERROR;
ENDLOOP;
cell ← PW.AbutY[cell, row]; -- bottom to top?
ENDLOOP };
MainControlPLA:
PO.
PLA ←
PO.NewPLA
[inName: "EUPLA.MainControlIn", outName: "EUPLA.MainControlOut"];
EUControl: PW.UserProc = {RETURN[MainControlCell[] ]};
PW.Register[EUControl, "EUControl"];
GenMainControlPLA[];
END.