DIRECTORY FS, IO, Rope, Convert, OracleGen; GenIOBDBus0Impl: CEDAR PROGRAM IMPORTS FS, IO, Rope, Convert, OracleGen ~ BEGIN outf: IO.STREAM; lineCount : CARD; nr:INT = 7; --number of colums in the right side of the line nl:INT = 5; --number of colums in the left side of the line NbRight : TYPE = [0..nr); NbLeft : TYPE = [0..nl); RightLine: TYPE = ARRAY NbRight OF Rope.ROPE; LeftLine: TYPE = ARRAY NbLeft OF Rope.ROPE; rl: RightLine; ll: LeftLine; comment: Rope.ROPE; Signal : TYPE = {T,F,X}; MDSerialIn,MDExecute,MDAddress : Signal; MDShiftCK,MnDFreeze,MnDReset : Signal; MDSerialOut: Signal; IOWPC,IORPC,nIOWPC,nIORPC: Signal; Address,DataIn,DataOut: INT; --negative Data & Address means X Init: PROC [] RETURNS [] ~ { MDSerialIn _ X; MDExecute _ X; MDAddress _ X; MDShiftCK _ X; MnDFreeze _ X; MnDReset _ X; Address _ 0; DataIn _ -1; --negative INT means X DataOut _ -1; IOWPC _ F; IORPC _ F; MDSerialOut _ F; }; RopeFromSignal: PROC [s: Signal] RETURNS [r: Rope.ROPE] ~ { SELECT s FROM F => r _ "0"; T => r _ "1"; ENDCASE => r _ "X"; }; Inv: PROC [s: Signal] RETURNS [t: Signal] ~ { SELECT s FROM F => t _ T; T => t _ F; ENDCASE => t _ X; }; Send: PROC [] RETURNS [] ~ { nIOWPC _ Inv[IOWPC]; nIORPC _ Inv[IORPC]; IF Address >= 0 THEN ll[0] _ OracleGen.LExtend[OracleGen.Hex[Address],5] ELSE ll[0] _ "XXXXX"; IF DataOut >= 0 THEN ll[1] _ OracleGen.LExtend[OracleGen.Hex[DataOut],2] ELSE ll[1] _ "XX"; ll[1] _ Rope.Concat["XX",ll[1]]; ll[2] _ RopeFromSignal[nIOWPC]; ll[3] _ RopeFromSignal[nIORPC]; ll[4] _ RopeFromSignal[MDSerialOut]; IF DataIn >= 0 THEN rl[0] _ OracleGen.LExtend[OracleGen.Hex[DataIn],2] ELSE rl[0] _ "XX"; rl[0] _ Rope.Concat["XX",rl[0]]; rl[1] _ RopeFromSignal[MDSerialIn]; rl[2] _ RopeFromSignal[MDExecute]; rl[3] _ RopeFromSignal[MDAddress]; rl[4] _ RopeFromSignal[MDShiftCK]; rl[5] _ RopeFromSignal[MnDFreeze]; rl[6] _ RopeFromSignal[MnDReset]; MergeOut; lineCount _ lineCount+ 1; }; MergeOut: PROC [] RETURNS [] ~ { column : INT; r : Rope.ROPE; r _ " "; FOR column IN [0..nl) DO r _ Rope.Cat[r,ll[column]," "]; ENDLOOP; r _ Rope.Cat[r," | "]; FOR column IN [0..nr) DO r _ Rope.Cat[r,rl[column]," "]; ENDLOOP; outf.PutF["%g -- %g %g \n",IO.rope[r],IO.rope[Convert.RopeFromInt[lineCount]],IO.rope[comment]]; comment _ "" }; Write: PROC [Adrs : INT,Da : INT] RETURNS [] ~ { Address _ Adrs; DataOut _ Da; Send; IOWPC _ T; Send; IOWPC _ F; Send; DataOut _ -1; Send; }; ReadAndCheck: PROC [Adrs : INT,Da : INT] RETURNS [] ~ { Address _ Adrs; Send; IORPC _ T; Send; DataIn _ Da; Send; IORPC _ F; DataIn _ -1; Send; }; outf _ FS.StreamOpen["///Chip/IOBDBus0.oracle", $create]; outf.PutF["-- Test D-Bus by PC interface\n"]; outf.PutF[" \n"]; outf.PutF["-- Output :\n"]; outf.PutF["-- Address: A, Data: B, nIOWPC: C, nIORPC: D, MDSerialOut:E \n"]; outf.PutF["-- Input :\n"]; outf.PutF["-- DataIn :M, MDSerialIn:N, MDExecute:O, MDAddress:P, \n"]; outf.PutF["-- MDShiftCK:Q, MnFreeze:R,MnReset:S,\n"]; outf.PutF[" \n"]; outf.PutF["-- A B C D E ~ M N O P Q R S \n"]; outf.PutF["\n"]; lineCount_ 0; Init; Send; comment _ "Test the six bits Out"; Write[600FH,0]; ReadAndCheck[600FH,0]; Write[600FH,1]; ReadAndCheck[600FH,1]; Write[600FH,2]; ReadAndCheck[600FH,2]; Write[600FH,4]; ReadAndCheck[600FH,4]; Write[600FH,8]; ReadAndCheck[600FH,8]; Write[600FH,16]; ReadAndCheck[600FH,16]; Write[600FH,32]; ReadAndCheck[600FH,32]; Write[600FH,0]; comment _ "Test MDSerialOut"; MDSerialOut _ F; ReadAndCheck[600FH,0]; MDSerialOut _ T; ReadAndCheck[600FH,128]; outf.PutF[". \n"]; -- end outf.Close[]; END. €GenIOBDBus0Impl.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Jean Gastinel September 11, 1987 6:55:57 pm PDT Oracle Generation for the DBus Variables for the Oracle File Special variables of the PC-Bus Convert a signal {F,T,X} into the corresponding Rope {0,1,X} t gets the invert of s This Proc convert the variables into ropes rl[i] & ll[i] for generating the line then call MergeOut for writing the line Verification : Send : This proc merge into two Rope Right and Left different elements of the line and write the result in the output stream Start of the Program Here the program start : Create or Append the file Start Generation : Κ·˜codešœ™Kšœ<™œ˜LKšœ   œ˜Kšœ  œ 3œ˜FKšœ  œ "œ˜5Kšœ  œ˜Kšœ  ,œ˜