IFUAsmBCDecode:
CEDAR
PROGRAM
IMPORTS CMos, Commander, IFUAsm, IFUPW, PW, Rope =
BEGIN
GND: Rope.ROPE = IFUPW.GND;
VDD: Rope.ROPE = IFUPW.VDD;
bcDecodeSeq: BOOL ← IFUAsm.sequential;
BCDecodeXBufTop:
LIST
OF
REF =
IFUPW.LISTn[
"XBus." ];
BCDecodeXBuf:
PROC[design:
CD.Design]
RETURNS[cell:
PW.ObjName] = {
cell ←
IFUPW.IFUGVCellRow[
design: design,
name: "BCDecodeXBuf",
type: IFUPW.LISTn["GVInv"],
top: BCDecodeXBufTop,
ctl: LIST[NIL],
in: LIST[IFUPW.List4["XNegB.", "XBus.1", "XBus.2", "XNegC."]],
out: LIST[IFUPW.List4["XPosB.", "XNegB.", "XNegC.", "XPosC."]],
bot: BCDecodeSetupTop,
seq: bcDecodeSeq ]};
BCDecodeSetupTop:
LIST
OF
REF =
IFUPW.LISTn[
"XBus.",
IFUPW.List4["XPosB.", "XNegB.", "XNegC.", "XPosC."],
IFUPW.List4["XNegB.", NIL, NIL, "XNegC."] ];
BCDecodeSetup:
PROC[design:
CD.Design]
RETURNS[cell:
PW.ObjName] = {
cell ←
IFUPW.SwitchBoxRow[
design: design,
name: "BCDecodeSetup",
rowType: CMos.met2,
topSeq: bcDecodeSeq,
top: BCDecodeSetupTop,
left: NIL,
right: NIL,
bot: BCDecoderTop,
botSeq: bcDecodeSeq,
fixGV: TRUE ]};
decodeCtls:
IFUPW.List =
LIST[
"XPosB.0", "XNegB.0", "XPosB.1", "XNegB.1", "XPosB.2", "XNegB.2", "XPosB.3", "XNegB.3",
"XPosB.4", "XNegB.4", "XPosB.5", "XNegB.5", "XPosB.6", "XNegB.6", "XPosB.7", "XNegB.7",
"XPosC.0", "XNegC.0", "XPosC.1", "XNegC.1", "XPosC.2", "XNegC.2", "XPosC.3", "XNegC.3",
"XPosC.4", "XNegC.4", "XPosC.5", "XNegC.5", "XPosC.6", "XNegC.6", "XPosC.7", "XNegC.7"];
BCDecoderTop:
LIST
OF
REF =
IFUPW.LISTn[
"XBus.",
IFUPW.List4["XPosB.", "XNegB.", "XNegC.", "XPosC."] ];
BCDecoder:
PROC[design:
CD.Design]
RETURNS[cell:
PW.ObjName] = {
cell ←
IFUPW.IFUDecoderRow[
design: design,
name: "BCDecoder",
top: BCDecoderTop,
ctl: decodeCtls,
val: decodeVals,
out: LIST[decodeOut0, decodeOut1, decodeOut2, decodeOut3],
bot: BCDecodeOutTop,
seq: bcDecodeSeq ]};
BCDecodeOutTop:
LIST
OF
REF =
IFUPW.LISTn[
"XBus.",
LIST[decodeOut0, decodeOut1, decodeOut2, decodeOut3] ];
BCDecodeOut:
PROC[design:
CD.Design]
RETURNS[cell:
PW.ObjName] = {
cell ←
IFUPW.SwitchBoxRow[
design: design,
name: "BCDecodeOut",
rowType: CMos.met2,
topSeq: bcDecodeSeq,
top: BCDecodeOutTop,
left: NIL,
right: decodeOuts,
bot: BCDecoderBot,
botSeq: bcDecodeSeq,
fixGV: TRUE ]};
BCDecoderBot:
LIST
OF
REF =
IFUPW.LISTn[
"XBus."];
decodeVals: REF IFUPW.ValArray ← NEW[IFUPW.ValArray];
decodeOut0: IFUPW.List ← NIL;
decodeOut1: IFUPW.List ← NIL;
decodeOut2: IFUPW.List ← NIL;
decodeOut3: IFUPW.List ← NIL;
decodeOuts: IFUPW.List ← NIL;
ProcRegName:
PROC[reg:
IFUPW.ProcessorReg]
RETURNS[
PW.
ROPE] = {
RETURN[
SELECT reg
FROM
ifuXBus => "XBus",
ifuStatus => "Status",
ifuFPModeAlu => "FPModeAlu",
ifuFPModeMult => "FPModeMult",
ifuFPMaskFlags => "FPMaskFlags",
ifuSLimit => "SLimit",
ifuYoungestL => "YoungestL",
ifuYoungestPC => "YoungestPC",
ifuEldestL => "EldestL",
ifuEldestPC => "EldestPC",
ENDCASE => NIL ]};
newDesign: PW.ROPE ← IFUAsm.rootName.Cat["BCDecode"];
dataColRows:
LIST
OF
IFUPW.RowProc ←
LIST[
BCDecodeXBuf,
BCDecodeSetup,
BCDecoder,
BCDecodeOut ];
CDAssemble:
PW.UserProc=
{RETURN[IFUPW.AssembleList[design, dataColRows]]};
CTAssemble: Commander.CommandProc =
{[ ] ← IFUPW.AssembleList[IFUAsm.refDesign, dataColRows, newDesign, cmd]};
IFUAsm.RegDataColRows [procs: dataColRows, name: newDesign.Cat["Cell"]];
Commander.Register [proc: CTAssemble, key: newDesign.Cat["Cell"]];
PW.Register [userProc: CDAssemble, name: newDesign.Cat["Cell"]];
FOR byte:
INT
DECREASING
IN [0..
IFUPW.rngByte)
DO
FOR bit:
INT
DECREASING
IN [0..
IFUPW.rngBit)
DO
decodeVals[byte][bit] ← 240+(byte MOD 2)*8 + bit ENDLOOP ENDLOOP;
FOR reg:
CARDINAL
DECREASING
IN [248..248+8)
DO
name: PW.ROPE ← Rope.Cat[ProcRegName[LOOPHOLE[reg]], "FromXBus"];
decodeOut3 ← CONS[name, decodeOut0];
decodeOuts ← CONS[name, decodeOut0];
ENDLOOP;
FOR reg:
CARDINAL
DECREASING
IN [240..240+8)
DO
name: PW.ROPE ← Rope.Cat[ProcRegName[LOOPHOLE[reg]], "FromXBus"];
decodeOut2 ← CONS[name, decodeOut0];
decodeOuts ← CONS[name, decodeOut0];
ENDLOOP;
FOR reg:
CARDINAL
DECREASING
IN [248..248+8)
DO
name: PW.ROPE ← Rope.Cat[ProcRegName[LOOPHOLE[reg]], "ToXBus"];
decodeOut1 ← CONS[name, decodeOut0];
decodeOuts ← CONS[name, decodeOut0];
ENDLOOP;
FOR reg:
CARDINAL
DECREASING
IN [240..240+8)
DO
name: PW.ROPE ← Rope.Cat[ProcRegName[LOOPHOLE[reg]], "ToXBus"];
decodeOut0 ← CONS[name, decodeOut0];
decodeOuts ← CONS[name, decodeOut0];
ENDLOOP;
END.