<> <> <> <<>> <> <> <<>> DIRECTORY FS, IO, Rope, Convert, OracleGen, BitOps; GenFullBDDBus2Impl: 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 _ F; 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 [] ~ { IOWPC _ T; DataOut _ da; Address _ adrs; Send; IOWPC _ F; DataOut _ -1; Send; comment _ " Write Data out"; }; 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; }; SendDBusData: PROC [value: LONG CARDINAL, count: INT _ 16] RETURNS [] ~ { <> <<>> FOR s: INT DECREASING IN [0..count) DO MDShiftCK _ F; IF (BitOps.DShift[value,-s] MOD 2) = 0 THEN MDSerialIn _ F ELSE MDSerialIn _ T; DBusWrite; MDShiftCK _ T; DBusWrite; ENDLOOP; }; ReadDBusAndCheck: PROC [value: CARD, count: INT _ 16] RETURNS [] ~ { <> <<>> s: INT; MDAddress _ F; MDShiftCK _ F; IF (BitOps.WShift[value,1-count] MOD 2) = 0 THEN MDSerialOut _ F ELSE MDSerialOut _ T; DBusWrite; DBusCheck; FOR s IN [1..count) DO MDShiftCK _ T; IF (BitOps.WShift[value,s-count+1] MOD 2) = 0 THEN MDSerialOut _ F ELSE MDSerialOut _ T; DBusWrite; DBusCheck; MDShiftCK _ F; DBusWrite; ENDLOOP; }; SendShiftClock: PROC [] RETURNS [] ~ { <> FOR i: NAT IN [0..4) DO MDShiftCK _ T; DBusWrite; MDShiftCK _ F; DBusWrite; ENDLOOP; }; SendReset: PROC [] RETURNS [] ~ { MnDReset _ F; FOR lenghtReset: INT IN [0..4) DO DBusWrite; ENDLOOP; MnDReset _ T; DBusWrite; }; AdDBus: PROC [bd,hyb,Int,ci,pth: CARDINAL _0] RETURNS [ad: CARDINAL _0] ~ { <
> <<>> << =0 is for BIC>> <<>> ad _ BitOps.WShift[bd,12]+BitOps.WShift[hyb,8]; ad _ ad+BitOps.WShift[Int,5]+BitOps.WShift[ci,3]+pth; }; IdCte: PROC [t,v:CARDINAL] RETURNS [id:CARDINAL] ~ { <> <> <<>> id _ 5000H + BitOps.WShift[t,6] + v; }; ResetOn: PROC [] RETURNS [] ~ { << This proc set reset>> MnDReset _ F; DBusWrite; }; ResetOff: PROC [] RETURNS [] ~ { << This proc remove reset>> MnDReset _ T; DBusWrite; }; <> <> <> <<>> outf _ FS.StreamOpen["FullBDDBus2.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; SendShiftClock; -- for autoload Dbus constant ResetOn; comment _ "Address of the MAP-Cache path Nb 4 for Stop Generation"; SendDBusAddress[AdDBus[bd:0,hyb:2,Int:1,ci:1,pth:4]]; -- "0000 0010 001 01 000" comment _ "Stop Flip-Flop On"; SendDBusData[value:1,count:1]; ReadDBusAndCheck[value:1,count:1]; FOR sometime: INT IN [0..10) DO --tempo Send; ENDLOOP; ResetOff; FOR sometime: INT IN [0..6) DO --tempo Send; ENDLOOP; comment _ "Stop Flip-Flop Off"; SendDBusData[value:0,count:1]; FOR lotofline: INT IN [0..200) DO Send; ENDLOOP; <> <<>> << Hybrid 0 contains only the Arbiter 1>> <<>> <> <> <> <> <<>> <> <<>> << Hybrid 0 contains only the Arbiter 0>> <<>> <> <> <> <> <<>> <<>> << Hybrid 1 contains 7 BICs>> <<>> <> <> <> <> << >> <> <> <> <> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <<>> << Hybrid 2 contains Display, MapCache, Cache IOB & 4 BICs>> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <> <> <> <> <<>> <<>> <<>> <<>> outf.PutF[". \n"]; -- end outf.Close[]; END.