DIRECTORY Commander, Convert, Core, CoreCreate, CoreDirectory, CoreOps, CoreProperties, Drot, DrotBool, DrotCover, IO, Process, Rope, SymTab, ViewerIO, ViewerTools; TestDrot: CEDAR MONITOR IMPORTS Commander, Process ~ BEGIN OPEN DrotBool, DrotCover, Drot; MakeGenerator: Commander.CommandProc = TRUSTED {Process.Detach[FORK Gen]}; Gen: PUBLIC PROC ~ { }; FromLogicToCell: PROC [tree: Dag, ctcoll: Treeset, out: IO.STREAM] ~ { }; Disp: PUBLIC PROC [tree: Dag, out: IO.STREAM] ~ { }; Commander.Register[key: "Gen", proc: MakeGenerator, doc: "Standard cells from logic equations"]; END. ΆTestDrot.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Csaba Gabor August 21, 1987 2:17:27 pm PDT Bertrand Serlet August 21, 1987 4:32:43 pm PDT This test code has to be revisited!! Debugging Procedures tree: Dag _ MakeNewBoolTree[]; ctcoll: Treeset _ MakeNewCTreeSet[]; gettinginput : BOOL _ TRUE; in, out: IO.STREAM; be: ROPE; dummy : INT _ 0; [] _ MakeNewNodeB[tree, NIL, prim, "Gnd"]; [] _ MakeNewNodeB[tree, NIL, prim,"Vdd"]; [in: in, out: out] _ ViewerIO.CreateViewerStreams["Logic Generator"]; AssembleCTree[ctcoll]; IO.PutF[out, "Enter Boolean expressions, to terminate sequence\n"]; WHILE gettinginput DO IO.PutF[out, "> "]; ViewerTools.SetSelection[ViewerIO.GetViewerFromStream[in]]; be _ IO.GetLineRope[in]; IF Rope.IsEmpty[be] THEN EXIT ELSE IF Rope.Fetch[be,0] = ': THEN { be _ Rope.Substr[be,1,Rope.Length[be] - 1]; IF InputOK[be] THEN AddInputToCover[be,ctcoll] ELSE IO.PutF[out, " Problem with cover expression. Please enter anew.\n"]} ELSE IF InputOK[be] THEN AugmentBoolTreeBySingleExpression[tree, be] ELSE IO.PutF[out, " Problem with input expression. Please enter anew.\n"]; dummy _ dummy + 1; ENDLOOP; FromLogicToCell[tree, ctcoll, out]; dummy _ dummy + 1; foo: Core.CellType; FOR ctiter: Dag _ ctcoll^.top, ctiter^.next UNTIL ctiter = NIL DO RemoveOrs[ctiter]; ENDLOOP; IO.PutF[out, "Done with first pass\n"]; TwoifyAllTrees[ctcoll]; IO.PutF[out, "Done with second pass\n"]; SimplifyDag[tree]; IO.PutF[out, "Done with third pass\n"]; EstablishLevels[tree]; IO.PutF[out, "Done with fourth pass\n"]; TwoifyTree[tree]; IO.PutF[out, "Done with fifth pass\n"]; ReduceFanout[tree, 4]; IO.PutF[out, "Done with sixth pass\n"]; RemoveOrs[tree]; IO.PutF[out, "Done with seventh pass\n"]; WHILE RemoveAllIdenticalLinks[tree] OR RemoveDuplicateNodes[tree] DO ENDLOOP; IO.PutF[out, "Done with pass seven and a half\n"]; BufferNecessaryNodes[tree]; ReduceFanout[tree, 4]; KillHangingNodes[tree, FALSE]; IO.PutF[out, "Done with pass seven and three quarters\n"]; ProduceTotalCovering[tree, ctcoll]; IO.PutF[out, "Done with eighth pass\n"]; foo _ FromDagToCellType[tree]; IO.PutF[out, "Done\n"]; Given a tree, this will display it on stream out -- iter: Node _ tree^.csucs; WHILE iter # NIL DO kiter: Kidptr _ iter^.kidlist; piter: Kidptr _ iter^.parlist; IO.PutF[out, "\n%3g: ", IO.int[iter^.number]]; SELECT iter^.type FROM and => IO.PutF[out," and"]; nand => IO.PutF[out,"nand"]; or => IO.PutF[out," or"]; nor => IO.PutF[out," nor"]; not => IO.PutF[out," not"]; buf => IO.PutF[out," buf"]; ENDCASE => IO.PutF[out,"prim"]; IO.PutF[out, Rope.Concat[" ",Rope.Concat[iter^.inname, Rope.Concat[" ", iter^.varname]]]]; IF iter^.output THEN IO.PutF[out, Rope.Concat["*^*",iter^.outname.first]]; IF iter^.sim THEN IO.PutF[out," Sim "]; IO.PutF[out, " %3g\n", IO.int[iter^.level]]; IO.PutF[out, " Kids: "]; WHILE kiter # NIL DO IO.PutF[out, "%3g", IO.int[kiter^.child^.number]]; IF kiter^.next # NIL THEN IO.PutF[out, ","] ELSE IO.PutF[out, "\n"]; kiter _ kiter^.next; ENDLOOP; IO.PutF[out, " Pars: "]; WHILE piter # NIL DO IO.PutF[out, "%3g", IO.int[piter^.child^.number]]; IF piter^.next # NIL THEN IO.PutF[out, ","]; piter _ piter^.next; ENDLOOP; iter _ iter^.next; ENDLOOP; IO.PutF[out,"\n"] Κe– "cedar" style˜codešœ ™ K™