DIRECTORY Atom, CacheMicroMachine, IO, Rope USING [ROPE], ViewerIO; CacheMicroMachineImpl: CEDAR PROGRAM IMPORTS Atom, IO, ViewerIO EXPORTS CacheMicroMachine = BEGIN OPEN CacheMicroMachine, Rope; LogicBlockRec: TYPE = RECORD[ name: ROPE, decodes: LIST OF DecodeRec _ NIL]; DecodeRec: TYPE = RECORD[ timing: TimingType, decode: ATOM]; Grant: TYPE = [0..1]; tree: ARRAY Grant OF ARRAY SequenceNumber OF ARRAY CycleNumber OF LIST OF ATOM _ ALL[ALL[ALL[NIL]]]; granted: Grant; curSequence: SequenceNumber; curCycle: CycleNumber; registeredBlocks: LIST OF LogicBlockRec _ NIL; currentBlock: ROPE _ NIL; LogicBlock: PUBLIC PROC[blockName: Rope.ROPE] = { registeredBlocks _ CONS[[blockName], registeredBlocks]; }; NewDecode: PUBLIC PROC[d: ATOM, t: TimingType] = { registeredBlocks.first.decodes _ CONS[[t, d], registeredBlocks.first.decodes]; }; Master: PUBLIC PROC = {granted _ 1}; Slave: PUBLIC PROC = {granted _ 0}; Sequence: PUBLIC PROC [number: SequenceNumber] = { curSequence _ number; }; Cycle: PUBLIC PROC [number: CycleNumber, decodes: LIST OF ATOM] = { tree[granted][curSequence][number] _ decodes; FOR d: LIST OF ATOM _ decodes, d.rest UNTIL d=NIL DO FOR lb: LIST OF LogicBlockRec _ registeredBlocks, lb.rest UNTIL lb=NIL DO FOR rd: LIST OF DecodeRec _ lb.first.decodes, rd.rest UNTIL rd=NIL DO IF d.first=rd.first.decode THEN GOTO Found; ENDLOOP; REPEAT Found => NULL; FINISHED => ERROR; ENDLOOP; ENDLOOP; }; SetState: PUBLIC PROC [slave: BOOL, sequence: SequenceNumber, cycle: CycleNumber] = { granted _ IF slave THEN 0 ELSE 1; curSequence _ sequence; curCycle _ cycle; }; Decode: PUBLIC PROC[decode: ATOM] RETURNS [asserted: BOOL] = { FOR d: LIST OF ATOM _ tree[granted][curSequence][curCycle], d.rest UNTIL d=NIL DO IF d.first=decode THEN RETURN[TRUE]; ENDLOOP; RETURN[FALSE]; }; Analysis: PUBLIC PROC = { out: IO.STREAM; numberOfDecodes: INT _ 0; numberOfDecodesUsedOnce: INT _ 0; numberOfDecodeUses: INT _ 0; numberOfDecodesInSequence: INT _ 0; nCycles: INT; [out: out] _ ViewerIO.CreateViewerStreams["Microcode Analysis"]; out.PutF["Cache M Bus controller microcode analysis\n"]; FOR lb: LIST OF LogicBlockRec _ registeredBlocks, lb.rest UNTIL lb=NIL DO numberOfDecodesInBlock: INT _ 0; numberOfDecodesUsedOnceThisBlock: INT _ 0; numberOfDecodeUsesInBlock: INT _ 0; numberOfDecodesInSequenceInBlock: INT _ 0; out.PutF["\nBlock name = %g\n", IO.rope[lb.first.name]]; FOR rd: LIST OF DecodeRec _ lb.first.decodes, rd.rest UNTIL rd=NIL DO numberOfSequencesDecodeUsed: INT _ 0; numberOfCycles: INT _ 0; numberOfDecodes _ numberOfDecodes + 1; numberOfDecodesInBlock _ numberOfDecodesInBlock + 1; FOR m: Grant IN Grant DO FOR s: SequenceNumber IN SequenceNumber DO seenThisSequence: BOOL _ FALSE; FOR c: CycleNumber IN CycleNumber DO IF tree[m][s][c]#NIL THEN numberOfCycles _ numberOfCycles + 1; FOR d: LIST OF ATOM _ tree[m][s][c], d.rest UNTIL d=NIL DO IF d.first=rd.first.decode THEN { numberOfDecodeUses _ numberOfDecodeUses + 1; numberOfDecodeUsesInBlock _ numberOfDecodeUsesInBlock + 1; IF NOT seenThisSequence THEN { seenThisSequence _ TRUE; EXIT; }; }; ENDLOOP; ENDLOOP; IF seenThisSequence THEN { numberOfSequencesDecodeUsed _ numberOfSequencesDecodeUsed + 1; numberOfDecodesInSequence _ numberOfDecodesInSequence + 1; numberOfDecodesInSequenceInBlock _ numberOfDecodesInSequenceInBlock + 1; }; ENDLOOP; ENDLOOP; nCycles _ numberOfCycles; out.PutF[" %g=%g", IO.rope[Atom.GetPName[rd.first.decode]], IO.int[numberOfSequencesDecodeUsed]]; IF numberOfSequencesDecodeUsed=1 THEN numberOfDecodesUsedOnceThisBlock _ numberOfDecodesUsedOnceThisBlock +1; ENDLOOP; numberOfDecodesUsedOnce _ numberOfDecodesUsedOnce + numberOfDecodesUsedOnceThisBlock; out.PutF["\nNumber of decodes = %g\n", IO.int[numberOfDecodesInBlock]]; out.PutF["Number of decode uses = %g\n", IO.int[numberOfDecodeUsesInBlock]]; out.PutF["Number of decodes used once = %g\n", IO.int[numberOfDecodesUsedOnceThisBlock]]; out.PutF["Number of decode uses excluding multiple cycles within a sequence = %g\n", IO.int[numberOfDecodesInSequenceInBlock]]; ENDLOOP; out.PutF["\nNumber of decodes = %g\n", IO.int[numberOfDecodes]]; out.PutF["Number of decode uses = %g\n", IO.int[numberOfDecodeUses]]; out.PutF["Number of decodes used once = %g\n", IO.int[numberOfDecodesUsedOnce]]; out.PutF["Number of decode uses excluding multiple cycles within a sequence = %g\n", IO.int[numberOfDecodesInSequence]]; out.PutF["Number of cycles = %g\n", IO.int[nCycles]]; out.PutF["\n"]; }; END. ~[Indigo]Cache>Rosemary>Cache.df=>CacheMicroMachineImpl.Mesa Last Edited by: Barth, July 12, 1984 5:16:28 pm PDT Κ^– "cedar" style˜JšœC™CJ™3J˜codešΟk ˜ K˜Kšœ˜Kšœ˜Jšœœœ˜Kšœ ˜ —K˜šΠbxœœ˜$Kšœœ ˜Kšœ˜—K˜Kšœœ˜#K˜šœœœ˜Kšœœ˜ Kšœ œœ œ˜"—šœ œœ˜Kšœ˜Kšœœ˜—K˜Kšœœ ˜K˜Kšœœœœœœ œœœœœœœœ˜dKšœ˜Kšœ˜Kšœ˜Kšœœœœ˜.Kšœœœ˜K˜šΟn œœœœ˜1Kšœœ ˜7Kšœ˜—K˜šŸ œœœœ˜2Kšœ!œ)˜NKšœ˜—K˜KšŸœœœ˜$K˜KšŸœœœ˜#K˜šŸœœœ˜2Kšœ˜Kšœ˜—K˜š Ÿœœœ œœœ˜CKšœ-˜-š œœœœœœ˜4š œœœ+œœ˜Iš œœœ'œœ˜EKšœœœ˜+Kšœ˜—š˜Kšœ œ˜Kšœœ˜—Kšœ˜—Kšœ˜—Kšœ˜—K˜šŸœœœœ3˜UKšœ œœœ˜!Kšœ˜Kšœ˜Kšœ˜—K˜š Ÿœœœ œœ œ˜>š œœœœ0œœ˜QKšœœœœ˜$Kšœ˜—Kšœœ˜Kšœ˜—K˜šŸœœœ˜Kšœœœ˜Kšœœ˜Kšœœ˜!Kšœœ˜Kšœœ˜#Kšœ œ˜ Kšœ@˜@Kšœ8˜8š œœœ+œœ˜IKšœœ˜ Kšœ"œ˜*Kšœœ˜#Kšœ"œ˜*Kšœ œ˜8š œœœ'œœ˜EKšœœ˜%Kšœœ˜Kšœ&˜&Kšœ4˜4šœ œ˜šœœ˜*Kšœœœ˜šœœ ˜$Jšœœœ%˜>š œœœœœœ˜:šœœ˜!Kšœ,˜,Kšœ:˜:šœœœ˜Kšœœ˜Kšœ˜K˜—K˜—Jšœ˜—Jšœ˜šœœ˜Jšœ>˜>Jšœ:˜:JšœH˜HJ˜——Jšœ˜—Kšœ˜—Kšœ˜Kšœœ'œ#˜bKšœœH˜mKšœ˜—KšœU˜UKšœ'œ˜GKšœ)œ!˜LKšœ/œ(˜YKšœUœ(˜Kšœ˜—Kšœ'œ˜@Kšœ)œ˜EKšœ/œ˜PKšœUœ!˜xKšœ$œ˜5Kšœ˜Kšœ˜—K˜Kšœ˜—…—tP