DIRECTORY Atom, Basics, BitOps, CD, CDCommandOps, CDIO, CDOps, CDProperties, CDSequencer, CDViewer, CommandTool, Core, CoreCDUser, CoreFlat, IO, FS, Ports, Rope, Rosemary, RosemaryUser, Sinix, Sisyph; TRTest: CEDAR PROGRAM IMPORTS Atom, Basics, BitOps, CDCommandOps, CDIO, CDOps, CDProperties, CDViewer, CommandTool, CoreCDUser, CoreFlat, IO, FS, Ports, Rope, Rosemary, RosemaryUser, Sisyph ~ BEGIN CompData, Write, Start, Reset, CK, DecompData, Vdd, Gnd: NAT; ROPE: TYPE = Core.ROPE; Port: TYPE = Ports.Port; Quad: TYPE = BitOps.BitQWord; qZero: Quad = BitOps.BitQWordZero; REProc: TYPE = RosemaryUser.TestEvalProc; TProc: TYPE = PROC [h: Handle, Eval: REProc]; SHIFT: PROC [value: WORD, count: INTEGER] RETURNS [WORD] = Basics.BITSHIFT; BITAND: Basics.BitOp = Basics.BITAND; BITNOT: PROC [WORD] RETURNS [WORD] = Basics.BITNOT; Log2: PROC [n: INT] RETURNS [INT] = BitOps.Log2; logOn: BOOL _ TRUE; cutSet : LIST OF ROPE _ LIST["Logic", "LogicMacro", "DPMacro", "FSM"]; design: CD.Design _ NIL; Handle: TYPE = REF HandleRec; HandleRec: TYPE = RECORD[ tester: RosemaryUser.Tester _ NIL, rootCT: Core.CellType _ NIL, testFlatCell: CoreFlat.FlatCellType _ NIL, testPort: Ports.Port _ NIL, port: Port _ NIL ]; SimpleTest: RosemaryUser.TestProc = { h: Handle _ NEW[HandleRec]; FindDesign[]; h.port _ p; InitPortIndicies[cellType]; Load[h, Eval]; Go[h, Eval]; }; inFile: ROPE _ "AChip3.force.bin"; loadSize: NAT _ 127; Load: TProc ~ { ENABLE Rosemary.Stop => IF reason = $BoolWireHasX THEN RESUME; GetData: PROC RETURNS [q: Quad, done: BOOL _ FALSE] ~ { q _ ALL[0]; FOR i: NAT IN [0..4) DO q _ BitOps.ICIQ[LOOPHOLE[IO.GetHWord[compStream ! IO.EndOfStream => GOTO eof]], q, i*10, 10, 40] REPEAT eof => done _ TRUE; ENDLOOP; }; p: Port _ h.port; done: BOOL _ FALSE; compStream: IO.STREAM _ FS.StreamOpen[fileName: Rope.Concat[inFile, ".com"], accessOptions: $read, wDir: CommandTool.CurrentWorkingDirectory[], streamOptions: FS.binaryStreamOptions]; p[Reset].b _ TRUE; p[Start].b _ TRUE; p[Write].b _ FALSE; Cycle[h, Eval]; p[Start].b _ FALSE; Cycle[h, Eval]; p[Write].b _ TRUE; FOR i: NAT IN [0..loadSize) DO [p[CompData].q, done] _ GetData[]; Cycle[h, Eval]; IF done THEN EXIT; ENDLOOP; p[Write].b _ FALSE; p[Reset].b _ FALSE; Cycle[h, Eval, 4]; }; Go: TProc ~ { p: Port _ h.port; sourceStream: IO.STREAM _ FS.StreamOpen[fileName: inFile, accessOptions: $read, wDir: CommandTool.CurrentWorkingDirectory[], streamOptions: FS.binaryStreamOptions]; p[DecompData].d _ expect; DO p[DecompData].lc _ LOOPHOLE[IO.GetHWord[sourceStream ! IO.EndOfStream => EXIT], CARDINAL]; Cycle[h, Eval]; ENDLOOP; }; Cycle: PROC [h: Handle, Eval: REProc, n: CARDINAL _ 1] ~ { p: Port _ h.port; THROUGH [0..n) DO Eval[TRUE, FALSE, FALSE]; --ignore errors before clock rises p[CK].b _ TRUE; Eval[TRUE, TRUE, FALSE]; --ignore errors during clockEval Eval[TRUE, FALSE, TRUE]; p[CK].b _ FALSE; Eval[TRUE, TRUE, TRUE]; ENDLOOP; }; CDExtract: PROC [comm: CDSequencer.Command] = { design _ comm.design; DoExtract[]; }; Extract: PROC [fileName: ROPE _ NIL, wDir: ROPE] ~ { FindDesign[fileName, wDir]; DoExtract[]; }; DoExtract: PROC ~ { ct: Core.CellType _ NIL; ct _ Sisyph.ExtractSchematicByName["Decompressor.sch", Sisyph.Create[design]]; CDProperties.PutDesignProp[design, $TestarossaCellType, ct]; }; FindDesign: PROC [fileName: ROPE _ NIL, wDir: ROPE _ NIL] ~ { IF design=NIL THEN design _ NARROW[Atom.GetProp[$Testarossa, $Design]]; IF design=NIL THEN design _ CDViewer.FindDesign["Testarossa"]; IF design=NIL THEN { design _ CDIO.ReadDesign[fileName, NIL, wDir]; CDOps.SetMutability[design]; Viewer[]; }; Atom.PutProp[$Testarossa, $Design, design]; }; Viewer: PROC ~ { [] _ CDViewer.CreateViewer[design]; }; StartTest: PROC ~ { RosemaryUser.StartTest[NARROW[CDProperties.GetDesignProp[design, $TestarossaTester], RosemaryUser.Tester]]; }; InitPortIndicies: PROC [ct: Core.CellType] ~ { [CompData, Write, Start, Reset, CK, DecompData] _ Ports.PortIndexes[ct.public, "CompData", "Write", "Start", "Reset", "CK", "DecompData"]; Vdd _ Ports.PortIndex[ct.public, "Vdd"]; Gnd _ Ports.PortIndex[ct.public, "Gnd"]; }; Simulate: PROC = { tester: RosemaryUser.Tester _ NIL; ct: Core.CellType _ NIL; IF design=NIL THEN ERROR; ct _ NARROW[CDProperties.GetDesignProp[design, $TestarossaCellType]]; InitPortIndicies[ct]; Ports.ITDList[ct.public, LIST[CompData, Write, Start, Reset, CK], force]; Ports.ITDList[ct.public, LIST[DecompData], none]; Ports.IPList[ct.public, LIST[CompData], q]; Ports.IPList[ct.public, LIST[DecompData], lc]; [] _ Rosemary.SetFixedWire[ct.public[Vdd], H]; [] _ Rosemary.SetFixedWire[ct.public[Gnd], L]; tester _ RosemaryUser.TestProcedureViewer[cellType: ct, testButtons: LIST["SimpleTest"], name: "Testarossa Tester", displayWires: RosemaryUser.DisplayPortLeafWires[ct], cutSet: CoreFlat.CreateCutSet[labels: cutSet], recordDeltas: logOn]; CDProperties.PutDesignProp[design, $TestarossaTester, tester]; CoreCDUser.SetDesignRootCellType[design, ct]; CoreCDUser.SetRootCellTypeDecoration[ct, Sisyph.mode.decoration]; }; RosemaryUser.RegisterTestProc["SimpleTest", SimpleTest]; CDCommandOps.RegisterWithMenu[ menu: $ProgramMenu, entry: "Extract TR", doc: "", proc: CDExtract ]; END. ΖTRTest.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Last Edited by: Gasbarro December 10, 1987 11:34:50 am PST --PROC [memory: BOOL _ TRUE, clockEval: BOOL _ FALSE]-- ΚΊ˜šœ ™ Icodešœ<™šžœœœ œ˜7Kšœœ˜ šœœœ˜Kš œ œœœœœ˜`˜Kšœœ˜—Kšœ˜—K˜K˜—K˜Kšœœœ˜Kš œ œœœ…œ˜·Kšœ œ˜Kšœ œ˜Kšœ œ˜K˜Kšœ œ˜K˜Kšœ œ˜šœœœ˜Kšœ"˜"K˜Kšœœœ˜Kšœ˜—Kšœ œ˜Kšœ œ˜K˜K˜—K˜šžœ ˜K˜Kš œœœœpœ˜€Kšœ˜š˜Kš œœœœœœ˜ZK˜Kšœ˜—K˜K˜—šžœœ žœ œ ˜:Kšœ˜šœ˜KšœœœœΟc"˜šœœœ˜Kšœ œœ˜.Kšœ˜K˜ K˜—Kšœ+˜+K˜K˜—šžœœ˜K˜#K˜K˜—šž œœ˜JšœœN˜kK˜K˜—šžœœ˜.KšœŠ˜ŠKšœ(˜(Kšœ(˜(K˜—K˜šžœœ˜Kšœœ˜"Kšœœ˜K˜Kšœœœœ˜Kšœœ:˜EKšœ˜Kšœœ,˜IKšœœ˜1Kšœœ˜+Kšœœ˜.Kšœ.˜.Kšœ.˜.K˜K™KšœEœ€˜νKšœ>˜>Kšœ-˜-KšœA˜AKšœ˜K˜—Kšœ8˜8K˜šœ˜Jšœ˜Jšœ˜J˜Jšœ˜Jšœ˜—Kšœ˜K˜J˜—…—LΜ