DIRECTORY FS, IO, Rope, Convert, OracleGen, BitOps; GenIOBDBus1Impl: CEDAR PROGRAM IMPORTS FS, IO, Rope, Convert, OracleGen, BitOps ~ BEGIN outf: IO.STREAM; lineCount : CARD; nr:INT = 1; --number of colums in the right side of the line nl:INT = 4; --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, dregister : INT; --negative Data & Address means X Init: PROC [] RETURNS [] ~ { MDSerialIn _ X; MDExecute _ X; MDAddress _ X; MDShiftCK _ X; MnDFreeze _ T; MnDReset _ T; 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]; IF DataIn >= 0 THEN rl[0] _ OracleGen.LExtend[OracleGen.Hex[DataIn],2] ELSE rl[0] _ "XX"; rl[0] _ Rope.Concat["XX",rl[0]]; 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; comment _ " Write Data out"; DataOut _ -1; Send; }; ReadAndCheck: PROC [adrs : INT,da : INT] RETURNS [] ~ { Address _ adrs; Send; IORPC _ T; Send; comment _ " ReadAndCheck Data"; DataIn _ da; Send; IORPC _ F; DataIn _ -1; Send; }; AssembleDbus: PROC [] RETURNS [da: INT] ~ { IF (MnDReset=T) THEN da _ 32 ELSE da _ 0; IF (MnDFreeze=T) THEN da _ da + 16; IF (MDExecute=T) THEN da _ da + 8; IF (MDSerialIn=T) THEN da _ da + 4; IF (MDAddress=T) THEN da _ da + 2; IF (MDShiftCK=T) THEN da _ da + 1; dregister _ da; }; DBusWrite: PROC [] RETURNS [] ~ { Write[600FH,AssembleDbus[]]; -- Address of the DBus Register is "600FH" }; DBusCheck: PROC [] RETURNS [] ~ { r : INT; IF (MDSerialOut=T) THEN r _ dregister+128 ELSE r _ dregister; ReadAndCheck[600FH,r]; }; SendDBusAddress: PROC [address: CARDINAL] RETURNS [] ~ { adrs: CARDINAL _ address; s: INT; MDAddress _ T; FOR s IN [0..16) DO MDShiftCK _ F; IF (BitOps.WShift[adrs,s-15] MOD 2) = 0 THEN MDSerialIn _ F ELSE MDSerialIn _ T; DBusWrite; MDShiftCK _ T; DBusWrite; ENDLOOP; MDAddress _ F; MDShiftCK _ F; DBusWrite; }; ReadDBusAndCheck: PROC [v: CARD, c: INT _ 16] RETURNS [] ~ { s: INT; value: CARD _ v; MDAddress _ F; MDShiftCK _ F; IF (BitOps.WShift[value,1-c] MOD 2) = 0 THEN MDSerialOut _ F ELSE MDSerialOut _ T; DBusWrite; DBusCheck; FOR s IN [1..c) DO MDShiftCK _ T; IF (BitOps.WShift[value,s-c+1] MOD 2) = 0 THEN MDSerialOut _ F ELSE MDSerialOut _ T; DBusWrite; DBusCheck; MDShiftCK _ F; DBusWrite; ENDLOOP; }; outf _ FS.StreamOpen["///Chip/IOBDBus1.oracle", $create]; outf.PutF["-- Test D-Bus by PC interface\n"]; outf.PutF[" \n"]; outf.PutF["-- Output :\n"]; outf.PutF["-- Address: A, DataOut: B, nIOWPC: C, nIORPC: D \n"]; outf.PutF["-- Input :\n"]; outf.PutF["-- DataIn :M \n"]; outf.PutF[" \n"]; outf.PutF["-- A B C D ~ M \n"]; outf.PutF["\n"]; lineCount_ 0; Init; Send; comment _ "Address of the Display ID path"; SendDBusAddress[0008H]; -- "0000 0000 000 01 000" comment _ "ID of Display : type 8, version 1"; ReadDBusAndCheck[5201H]; -- "0101 001000 000001" comment _ "Address of the Map-Cache ID path"; SendDBusAddress[0028H]; -- "0000 0000 001 01 000" comment _ "ID of Map-Cache : type 9, version 1"; ReadDBusAndCheck[5241H]; -- "0101 001001 000001" comment _ "Address of the Cache ID path"; SendDBusAddress[0048H]; -- "0000 0000 010 01 000" comment _ "ID of Cache : type 5, version 1"; ReadDBusAndCheck[5141H]; -- "0101 000101 000001" comment _ "Address of the IOB ID path"; SendDBusAddress[0068H]; -- "0000 0000 011 01 000" comment _ "ID of IOB : type 7, version 1"; ReadDBusAndCheck[51C1H]; -- "0101 000111 000001" comment _ "Address of the BIC 0 ID path"; SendDBusAddress[0000H]; comment _ "ID of BIC type 2, Version 0"; ReadDBusAndCheck[5080H]; comment _ "Address of the BIC 1 ID path"; SendDBusAddress[0020H]; comment _ "ID of BIC type 2, Version 1"; ReadDBusAndCheck[5081H]; comment _ "Address of the BIC 2 ID path"; SendDBusAddress[0040H]; comment _ "ID of BIC type 2, Version 2"; ReadDBusAndCheck[5082H]; comment _ "Address of the BIC 3 ID path"; SendDBusAddress[0060H]; comment _ "ID of BIC type 2, Version 3"; ReadDBusAndCheck[5083H]; outf.PutF[". \n"]; -- end outf.Close[]; END. ΦGenIOBDBus1Impl.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Jean Gastinel September 14, 1987 8:18:36 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 This Proc send an address on the DebugBus Reading of a path with c transitions of ShiftCK Start of the Program Here the program start : Create or Append the file Start Generation : Address in the DBus is : =0 is for BIC The structure of the Identificator is "0101 cccc ccrr rrrr" cccccc is the Type, rrrrrr is the Version ΚΔ˜codešœ™Kšœ<™