DIRECTORY
Commander,
DragOpsCross,
IFUPLAInstrDecode,
IO,
PLAOps,
Rope;

IFUPLAInstrDecodeImpl5: CEDAR PROGRAM
IMPORTS Commander, IFUPLAInstrDecode, IO, PLAOps, Rope EXPORTS IFUPLAInstrDecode =
BEGIN OPEN IFUPLAInstrDecode, PLAOps;


GenInstrDecodePLA5:  PUBLIC GenInstrDecodePLAProc = {

instr:				BoolExpr;
userMode0:		BoolExpr	_ BE[m:[userMode0: TRUE],	d:[userMode0: TRUE]];
aOpt:				BoolExpr	_ BE[m:[alpha: 200B],	d:[alpha: 200B]];
bOpt:				BoolExpr	_ BE[m:[alpha: 040B],	d:[alpha: 040B]];
cOpt:				BoolExpr	_ BE[m:[alpha: 100B],	d:[alpha: 100B]];
aux:				BoolExpr	_ BE[m:[alpha: 020B],	d:[alpha: 020B]];
src0:				BoolExpr	_ BE[m:[alpha: 300B],	d:[alpha: 0B]];
src1:				BoolExpr	_ BE[m:[alpha: 300B],	d:[alpha: 100B]];
srTop:				BoolExpr	_ BE[m:[alpha: 200B],	d:[alpha: 200B]];
srPop:				BoolExpr	_ BE[m:[alpha: 300B],	d:[alpha: 300B]];

current _ old;
instr	_ And[current, BE[m:[op: InstrTopSig[4]], d:[op: dROR]]];
Set[s: And[Not[cOpt], aux, userMode0, instr], m:[beta: 200B], d:[beta: 0], out:[condSel: ModeFault]];
Set[s: And[cOpt, userMode0, instr], m:[beta: 200B], d:[beta: 0], out:[condSel: ModeFault]];
Set[s: And[cOpt, userMode0, instr], m:[beta: 300B], d:[beta: 200B], out:[condSel: ModeFault]];

Set[s: And[	Not[aOpt],			aux,	instr],				out:[aReg:[ aBase,	beta47]]];
Set[s: And[	Not[aOpt],		Not[aux],	instr],				out:[aReg:[ l,			beta47]]];
Set[s: And[aOpt,	instr],	m:[beta: 010B],	d:[beta: 000B],	out:[aReg:[ cBase,	beta47]]];
Set[s: And[aOpt,	instr],	m:[beta: 004B],	d:[beta: 000B],	out:[aReg:[ cBase,	beta47]]];
Set[s: And[aOpt,	instr],	m:[beta: 015B],	d:[beta: 014B],	out:[aReg:[ s, offset, zero]]];
Set[s: And[aOpt,	instr],	m:[beta: 015B],	d:[beta: 015B],	out:[aReg:[ s, offset, minus1]]];
Set[s: And[ Not[bOpt],			aux,	instr],					out:[bReg:[ aBase,	alpha47]]];
Set[s: And[ Not[bOpt],		Not[aux],	instr],					out:[bReg:[ l,			alpha47]]];
Set[s: And[bOpt,	instr],	m:[alpha: 010B],	d:[alpha: 000B],	out:[bReg:[ cBase,	alpha47]]];
Set[s: And[bOpt,	instr],	m:[alpha: 004B],	d:[alpha: 000B],	out:[bReg:[ cBase,	alpha47]]];
Set[s: And[bOpt,	instr],	m:[alpha: 015B],	d:[alpha: 014B],	out:[bReg:[ s, offset, zero]]];
Set[s: And[bOpt,	instr],	m:[alpha: 015B],	d:[alpha: 015B],	out:[bReg:[ s, offset, minus1]]];
Set[s: And[ Not[cOpt],		aux,	instr],						out:[cReg:[ aBase,	beta03]]];
Set[s: And[ Not[cOpt],	Not[aux],	instr],						out:[cReg:[ l,			beta03]]];
Set[s: And[cOpt,	instr],	m:[beta: 200B],	d:[beta: 000B],	out:[cReg:[ cBase,	beta03]]];
Set[s: And[cOpt,	instr],	m:[beta: 100B],	d:[beta: 000B],	out:[cReg:[ cBase,	beta03]]];
Set[s: And[cOpt,	instr],	m:[beta: 360B],	d:[beta: 300B],	out:[cReg:[ s, offset, zero]]];
Set[s: And[cOpt,	instr],	m:[beta: 360B],	d:[beta: 320B],	out:[cReg:[ s, offset, minus1]]];
Set[s: And[cOpt,	instr],	m:[beta: 340B],	d:[beta: 340B],	out:[cReg:[ s, offset, one]]];
Set[s: And[aOpt,	instr], m:[beta:	016B],	d:[beta:	016B],	out:[popSa:			TRUE]];
Set[s: And[bOpt,	instr], m:[alpha:	016B],	d:[alpha:	016B],	out:[popSb:			TRUE]];
Set[s: And[cOpt,	instr], m:[beta:	340B],	d:[beta:	340B],	out:[pushSc:			TRUE]];
Set[s: instr,														out:[aluOpIsOp47:	TRUE]];
Set[s: instr,	m:[op:	InstrTopSig[7]],		d:[op:dRADD],	out:[condSel:			OvFl]];
Set[s: instr,	m:[op:	InstrTopSig[7]],		d:[op:dRLADD],	out:[condSel:			IL]];
Set[s: instr,	m:[op:	InstrTopSig[8]],		d:[op:    dRBC],	out:[condSel:			BC]];
Set[s: instr,	m:[op:	InstrTopSig[8]],		d:[op:    dRRX],	out:[
dPCmnd:			Fetch,
dPCmndIsRd0:	TRUE]];
Set[s: instr,	m:[op:	InstrTopSig[8]],		d:[op:    dRFU],	out:[fCtlIsRtOp0:		TRUE]];

instr	_ And[current, BE[m:[op: InstrTopSig[5]], d:[op: dQOR]]];
Set[s: instr,	out: [aluOpIsOp47:	TRUE]];
Set[s: instr, m:[alpha: 300B], d:[alpha: 000B], out:[aReg:[ s, offset, zero]]];
Set[s: instr, m:[alpha: 300B], d:[alpha: 100B], out:[aReg:[ s, offset, zero]]];
Set[s: instr, m:[alpha: 300B], d:[alpha: 200B], out:[aReg:[ cBase, offset, zero]]];
Set[s: instr, m:[alpha: 300B], d:[alpha: 300B], out:[aReg:[ cBase, offset, one]]];
Set[s: And[ Not[bOpt],			aux,	instr],					out:[bReg:[ aBase,	alpha47]]];
Set[s: And[ Not[bOpt],		Not[aux],	instr],					out:[bReg:[ l,			alpha47]]];
Set[s: And[bOpt,	instr],	m:[alpha: 010B],	d:[alpha: 000B],	out:[bReg:[ cBase,	alpha47]]];
Set[s: And[bOpt,	instr],	m:[alpha: 004B],	d:[alpha: 000B],	out:[bReg:[ cBase,	alpha47]]];
Set[s: And[bOpt,	instr],	m:[alpha: 015B],	d:[alpha: 014B],	out:[bReg:[ s, offset, zero]]];
Set[s: And[bOpt,	instr],	m:[alpha: 015B],	d:[alpha: 015B],	out:[bReg:[ s, offset, minus1]]];
Set[s: And[bOpt,	instr], m:[alpha:	016B],	d:[alpha:	016B],	out:[popSb: TRUE]];
Set[s: instr, m:[alpha: 300B], d:[alpha: 000B], out:[cReg:[ s, offset, zero]]];
Set[s: instr, m:[alpha: 100B], d:[alpha: 100B], out:[cReg:[ s, offset, one], pushSc: TRUE]];
Set[s: instr, m:[alpha: 200B], d:[alpha: 200B], out:[cReg:[ s, offset, one], pushSc: TRUE]];
Set[s: instr,	m:[op:	InstrTopSig[7]],		d:[op:  dQADD],	out:[condSel:			OvFl]];
Set[s: instr,	m:[op:	InstrTopSig[7]],		d:[op:dQLADD],	out:[condSel:			IL]];
Set[s: instr,	m:[op:	InstrTopSig[8]],		d:[op:    dQBC],	out:[condSel:			BC]];
Set[s: instr,	m:[op:	InstrTopSig[8]],		d:[op:    dQRX],	out:[
dPCmnd:			Fetch,
dPCmndIsRd0:	TRUE]];

instr	_ And[current, BE[m:[op: InstrTopSig[5]], d:[op: dOR]]];
Set[s: instr,	out: [
aluOpIsOp47:	TRUE,
aReg: [s, offset, minus1],
bReg: [s, offset, zero],
cReg: [s, offset, minus1],
popSa: TRUE ]];
Set[s: instr,	m:[op:	InstrTopSig[7]],		d:[op:  dADD],	out:[condSel:			OvFl]];
Set[s: instr,	m:[op:	InstrTopSig[7]],		d:[op:dLADD],	out:[condSel:			IL]];
Set[s: instr,	m:[op:	InstrTopSig[8]],		d:[op:    dBC],	out:[condSel:			BC]];
Set[s: instr,	m:[op:	InstrTopSig[8]],		d:[op:    dRX],	out:[
dPCmnd:			Fetch,
dPCmndIsRd0:	TRUE]] };

GenInstrDecodePLAXops: GenInstrDecodePLAProc = {	-- best to be explicit about this
single, double, triple, quintuple: BoolExpr;
current _ old;

single _ 				BE[m:[op: InstrTopSig[4]], d:[op: dTrap]];			-- 16 one byte traps
single _ Or[single, BE[m:[op: InstrTopSig[5]], d:[op: VAL[30B]]]];		-- 8 one byte traps

single _ Or[single, BE[m:[op: InstrTopSig[8]], d:[op: x112B]]];			-- 1 one byte trap
single _ Or[single, BE[m:[op: InstrTopSig[8]], d:[op: x117B]]];			-- 1 one byte trap
single _ Or[single, BE[m:[op: InstrTopSig[6]], d:[op: x120B]]];			-- 4 one byte traps
single _ Or[single, BE[m:[op: InstrTopSig[8]], d:[op: x125B]]];			-- 1 one byte trap
single _ Or[single, BE[m:[op: InstrTopSig[5]], d:[op: VAL[130B]]]];	-- 8 one byte traps

quintuple _ 				BE[m:[op: InstrTopSig[4]], d:[op: VAL[040B]]];		-- 16 five byte traps
quintuple _ Or[quintuple, BE[m:[op: InstrTopSig[8]], d:[op: x060B]]];	-- 1 five byte trap
quintuple _ Or[quintuple, BE[m:[op: InstrTopSig[8]], d:[op: x063B]]];	-- 1 five byte trap
quintuple _ Or[quintuple, BE[m:[op: InstrTopSig[8]], d:[op: x064B]]];	-- 1 five byte trap
quintuple _ Or[quintuple, BE[m:[op: InstrTopSig[8]], d:[op: x065B]]];	-- 1 five byte trap
quintuple _ Or[quintuple, BE[m:[op: InstrTopSig[5]], d:[op: VAL[070B]]]];	-- 8 five byte traps

double _ BE[m:[op: InstrTopSig[8]], d:[op: x215B]];	-- 1 two byte trap
double _ Or[double, BE[m:[op: InstrTopSig[8]], d:[op: x223B]]];	-- 1 two byte trap
double _ Or[double, BE[m:[op: InstrTopSig[8]], d:[op: x234B]]];	-- 1 two byte trap
double _ Or[double, BE[m:[op: InstrTopSig[8]], d:[op: x235B]]];	-- 1 two byte trap
double _ Or[double, BE[m:[op: InstrTopSig[8]], d:[op: x236B]]];	-- 1 two byte trap

triple _ BE[m:[op: InstrTopSig[8]], d:[op: x323B]];	-- 1 three byte trap
triple _ Or[triple, BE[m:[op: InstrTopSig[6]], d:[op: x364B]]];	-- 4 three byte traps
triple _ Or[triple, BE[m:[op: InstrTopSig[6]], d:[op: x374B]]];	-- 4 three byte traps

Set[s: And[ current,	single],		out: [
nextMacro:			jump,
pcNext:				fromPCBus,
pcBusSrc:				xopGen,
pcPipeSrc:			seqPC,
push0:					TRUE ]
];
Set[s: And[ current,	double],	out: [
nextMacro:			jump,
pcNext:				fromPCBus,
pcBusSrc:				xopGen,
pcPipeSrc:			seqPC,
push0:					TRUE,
x2ALitSource:		alpha,
cReg:					[s, offset, one],
pushSc:				TRUE ]
];
Set[s: And[ current,	triple],	out: [
nextMacro:			jump,
pcNext:				fromPCBus,
pcBusSrc:				xopGen,
pcPipeSrc:			seqPC,
push0:					TRUE,
x2ALitSource:		alphaBeta,
cReg:					[s, offset, one],
pushSc:				TRUE ]
];
Set[s: And[ current,	quintuple],	out: [
nextMacro:			jump,
pcNext:				fromPCBus,
pcBusSrc:				xopGen,
pcPipeSrc:			seqPC,
push0:					TRUE,
x2ALitSource:		alpBetGamDel,
cReg:					[s, offset, one],
pushSc:				TRUE ]
];
 };

instrDecodePLA: PUBLIC PLAOps.PLA;

GenInstrDecode: Commander.CommandProc = {
BE: IDBE = {
mRef:		REF InstrDecodeIn	_ NARROW[instrDecodePLA.mask];
dRef:		REF InstrDecodeIn	_ NARROW[instrDecodePLA.data];
mRef^ _ m; dRef^ _ d; RETURN[GetBEForDataMask[instrDecodePLA]]};
Set: IDSet = {
res:	REF InstrDecodeOut	_ NARROW[instrDecodePLA.out];
out.kIsRtOp0 _ out.kIsRtOp0 OR (out.x2ALitSource#none);
IF out.aReg.lt=s	OR out.aReg.lt=l	THEN out.aReg.mod _ half;
IF out.bReg.lt=s	OR out.bReg.lt=l	THEN out.bReg.mod _ half;
IF out.cReg.lt=s	OR out.cReg.lt=l	THEN out.cReg.mod _ half;
IF s=NIL
THEN	s	_			BE[m,d]
ELSE	s	_ And[s,	BE[m,d] ];
res^ _ out; SetOutForBE[instrDecodePLA, s]};
SimpleReduce: PROC[pla: PLA] = {
[ ] _ ConvertTermListToCompleteSum[pla.termList, FALSE, FALSE, cmd.out];
[ ] _ FindAMinimalCover[pla.termList, 120, cmd.out]};
filename:	IO.ROPE _ DefaultCMDLine[cmd.commandLine, defaultFile.Cat[".ttt"]];
root:		IO.ROPE	_ filename.Substr[0, filename.Index[0,"."]];
refs:		ARRAY [0..InstrDecodeOutCount) OF IO.ROPE _ [
"IFUPLAInstrDecode.InstrDecodeOut0",
"IFUPLAInstrDecode.InstrDecodeOut1",
"IFUPLAInstrDecode.InstrDecodeOut2",
"IFUPLAInstrDecode.InstrDecodeOut3",
"IFUPLAInstrDecode.InstrDecodeOut4",
"IFUPLAInstrDecode.InstrDecodeOut5",
"IFUPLAInstrDecode.InstrDecodeOut6" ];
curState:			BoolExpr;
instrDecodePLA	_ NewPLA["IFUPLAInstrDecode.InstrDecodeIn", "IFUPLAInstrDecode.InstrDecodeOut"];

curState _ GenInstrDecodePLA1		[BE, Set, curState];
curState _ GenInstrDecodePLA2		[BE, Set, curState];
curState _ GenInstrDecodePLA3		[BE, Set, curState];
curState _ GenInstrDecodePLA4		[BE, Set, curState];
curState _ GenInstrDecodePLA5		[BE, Set, curState];
curState _ GenInstrDecodePLAXops	[BE, Set, curState];
SimpleReduce[instrDecodePLA];
WritePLAFile[filename, cmd.out, instrDecodePLA];
FOR i: INT IN [0..InstrDecodeOutCount) DO
subPla: PLA _ CopyPLASubFields[instrDecodePLA, refs[i] ];
SimpleReduce[subPla];
WritePLAFile[
fileName:	IO.PutFR["%g%g.ttt", IO.rope[root], IO.int[i]],
log:		cmd.out,
pla:		subPla ] ENDLOOP };


defaultFile:		IO.ROPE = "IFUPLAInstrDecode";
doc:				IO.ROPE = "Expects the name of a ttt file";
Commander.Register[key:"GenInstrDecode",		proc: GenInstrDecode,	doc: doc];

END.


��8��IFUPLAInstrDecodeImpl5.mesa
Copyright c 1984 by Xerox Corporation.  All rights reserved.
Last edited by TWilliams, August 27, 1984 4:58:00 pm PDT
Last edited by Curry, July 9, 1986 7:27:24 pm PDT
Herrmann, August 14, 1985 4:07:33 pm PDT
McCreight, January 24, 1986 2:57:45 pm PST


dRR
AReg
BReg
CReg
Stack
Body of microinstruction with exceptions
Quick Arithmetic Logicals
AReg
BReg
CReg
Body of microinstruction with exceptions
Stack Arithmetic Logicals
This should work since:
kIsRtOp0 is already set by LIP and KFC,
x2ALitSource is always set autonomously,
�ÊÀ��˜�šÐbl™Jšœ<™<Jšœ8™8Jšœ1™1Icode™(K™*J™�—šÏk	˜	Jšœ
˜
Jšœ
˜
Jšœ˜Jšžœ˜Jšœ˜Jšœ˜J˜�—šœžœž˜%Jšžœžœžœ˜RJšžœžœ˜&J˜�šœžœ˜5J˜�Jšœ˜Jšœžœžœžœ˜DJšœžœ#˜9Jšœžœ#˜9Jšœžœ#˜9Jšœžœ#˜8Jšœžœ!˜7Jšœžœ#˜9Jšœžœ#˜:Jšœžœ#˜:J˜�Jšœ˜J™�Jšœ™Jšœžœ(˜?Jšœe˜eJšœ[˜[Jšœ^˜^J˜�Jšœ™JšœF˜FJšœH˜HJšœV˜VJšœV˜VJšœX˜XJšœZ˜ZJšœ™JšœH˜HJšœJ˜JJšœY˜YJšœY˜YJšœZ˜ZJšœ\˜\Jšœ™JšœG˜GJšœI˜IJšœV˜VJšœV˜VJšœX˜XJšœZ˜ZJšœW˜WJšœ™JšœGžœ˜NJšœIžœ˜PJšœHžœ˜OJšœ(™(Jšœ-žœ˜4JšœL˜LJšœFžœ˜KJšœHžœ˜Mšœ=˜=Jšœ˜Jšœ
žœ˜—JšœKžœ˜RJ˜�Jšœ™Jšœžœ(˜?Jšœ!žœ˜(Jšœ™JšœO˜OJšœO˜OJšœS˜SJšœR˜RJšœ™JšœH˜HJšœJ˜JJšœY˜YJšœY˜YJšœZ˜ZJšœ\˜\JšœGžœ˜NJšœ™JšœO˜OJšœUžœ˜\JšœUžœ˜\Jšœ(™(JšœN˜NJšœFžœ˜KJšœHžœ˜Mšœ=˜=Jšœ˜Jšœ
žœ˜—J˜�Jšœ™Jšœžœ'˜>šœ˜Jšœ
žœ˜Jšœ˜Jšœ˜Jšœ˜Jšœžœ˜—JšœM˜MJšœEžœ˜JJšœGžœ˜Lšœ<˜<Jšœ˜Jšœ
žœ˜—J˜�—šœ1Ïc!˜RJšœ,˜,Jšœ˜J˜�Jšœ
žœ+Ÿ˜NJšœžœ žœŸ˜WJ˜�Jšœžœ,Ÿ˜TJšœžœ,Ÿ˜TJšœžœ,Ÿ˜UJšœžœ,Ÿ˜TJšœžœ žœŸ˜WJ˜�Jšœžœ žœŸ˜UJšœžœ*Ÿ˜YJšœžœ*Ÿ˜YJšœžœ*Ÿ˜YJšœžœ*Ÿ˜YJšœžœ žœŸ˜^J˜�Jšœ	žœ)Ÿ˜FJšœžœ*Ÿ˜RJšœžœ*Ÿ˜RJšœžœ*Ÿ˜RJšœžœ*Ÿ˜RJ˜�Jšœ	žœ)Ÿ˜HJšœžœ*Ÿ˜UJšœžœ*Ÿ˜UJ˜�šœ%˜%Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœžœ˜Jšœ˜—šœ$˜$Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœžœ˜Jšœ˜Jšœ˜Jšœžœ˜Jšœ˜—šœ$˜$Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœžœ˜Jšœ˜Jšœ˜Jšœžœ˜Jšœ˜—šœ'˜'Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœžœ˜Jšœ˜Jšœ˜Jšœžœ˜Jšœ˜—Jšœ˜—J˜�Jšœžœ˜"J˜�šœ)˜)šžœžœ˜Jšœžœžœ˜7Jšœžœžœ˜7Jšœžœ$˜@—šœ˜Jšœžœžœ˜5šœ™Jšœ'™'Jšœ(™(—Jšœžœ˜7Jšžœžœžœ˜;Jšžœžœžœ˜;Jšžœžœžœ˜;šžœž˜Jšžœžœ˜Jšžœžœ˜—Jšœ,˜,—šÏnœžœžœ˜ Jšœ1žœžœ˜HJšœ5˜5—Jšœ
žœžœ<˜MJšœžœžœ-˜;š	œžœžœžœžœ˜4Jšœ$˜$Jšœ$˜$Jšœ$˜$Jšœ$˜$Jšœ$˜$Jšœ$˜$Jšœ&˜&—Jšœ˜Jšœ_˜_J˜�Jšœ žœ˜3Jšœ žœ˜3Jšœ žœ˜3Jšœ žœ˜3Jšœ žœ˜3Jšœ"žœ˜5Jšœ˜Jšœ0˜0šžœžœžœž˜)Jšœžœ.˜9Jšœ˜šœ
˜
Jšœ
žœžœ
žœ	˜9Jšœ˜Jšœžœ˜———J˜�J˜�Jšœžœžœ˜,Jšœžœžœ$˜3JšœJ˜JJ˜�Jšžœ˜˜�J˜�———�…—����)h��4`��