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] ]; PO.WritePLAFile["MainControl.pla", ,MainControlPLA] }; 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]}; 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. üEUPLAMainControl.mesa Copyright c 1984 by Xerox Corporation. All rights reserved. Last edited by Curry, April 10, 1985 2:12:52 pm PST Write it out just for the hell of it Define some utility procs If you want to read in a modified .pla file Êž˜šœ™Jšœ<™