~
BEGIN
outf: IO.STREAM;
lineCount : CARD;
nr:INT = 7; --number of colums in the right side of the line
nl:INT = 7; --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;
Special variables of the Debug-Bus
Signal : TYPE = {T,F,X};
nDSerialOut,MDSerialIn,MDExecute,MDAddress : Signal;
MDShiftCK,MnFreeze,MnDReset : Signal;
MDSerialOut,nDSerialIn,nDExecute,nDAddress : Signal;
nDShiftClock,DFreeze,DReset : Signal;
Init:
PROC []
RETURNS [] ~ {
nDSerialOut ← F;
MDSerialIn ← F;
MDExecute ← F;
MDAddress ← F;
MDShiftCK ← F;
MnFreeze ← F;
MnDReset ← F;
MDSerialOut ← X;
nDSerialIn ← X;
nDExecute ← X;
nDAddress ← X;
nDShiftClock ← X;
DFreeze ← X;
DReset ← X;
};
RopeFromSignal:
PROC [s: Signal]
RETURNS [r: Rope.
ROPE] ~ {
Convert a signal {F,T,X} into the corresponding Rope {0,1,X}
SELECT s
FROM
F => r ← "0";
T => r ← "1";
ENDCASE => r ← "X";
};
Inv:
PROC [s: Signal]
RETURNS [t: Signal] ~ {
t gets the invert of s
SELECT s
FROM
F => t ← T;
T => t ← F;
ENDCASE => t ← X;
};
MergeOut:
PROC []
RETURNS [] ~ {
This proc merge into two Rope Right and Left different elements of the line
and write the result in the output stream
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 ← ""
};
Send:
PROC []
RETURNS [] ~ {
This Proc convert the variables into ropes rl[i] & ll[i] for generating the line
then call MergeOut for writing the line
nDSerialIn ← Inv[MDSerialIn];
nDExecute ← Inv[MDExecute];
nDAddress ← Inv[MDAddress];
nDShiftClock ← Inv[MDShiftCK];
DFreeze ← Inv[MnFreeze];
DReset ← Inv[MnDReset];
ll[0] ← RopeFromSignal[nDSerialOut];
ll[1] ← RopeFromSignal[MDSerialIn];
ll[2] ← RopeFromSignal[MDExecute];
ll[3] ← RopeFromSignal[MDAddress];
ll[4] ← RopeFromSignal[MDShiftCK];
ll[5] ← RopeFromSignal[MnFreeze];
ll[6] ← RopeFromSignal[MnDReset];
rl[0] ← RopeFromSignal[MDSerialOut];
rl[1] ← RopeFromSignal[nDSerialIn];
rl[2] ← RopeFromSignal[nDExecute];
rl[3] ← RopeFromSignal[nDAddress];
rl[4] ← RopeFromSignal[nDShiftClock];
rl[5] ← RopeFromSignal[DFreeze];
rl[6] ← RopeFromSignal[DReset];
MergeOut;
lineCount ← lineCount+ 1;
};
SendAddress:
PROC [address:
CARDINAL]
RETURNS [] ~ {
This Proc send an address on the DebugBus
adrs: CARDINAL ← address;
s: INT;
MDAddress ← T;
MDSerialOut ← X;
FOR s
IN [0..16)
DO
MDShiftCK ← F;
IF (BitOps.WShift[adrs,s-15] MOD 2) = 0 THEN MDSerialIn ← F
ELSE MDSerialIn ← T;
Send;
MDShiftCK ← T;
Send;
ENDLOOP;
MDAddress ← F;
MDShiftCK ← F;
Send;
};
ReadandCheck:
PROC [v:
CARD, c:
INT ← 16]
RETURNS [] ~ {
Reading of a path with c transitions of ShiftCK
s: INT;
value: CARD ← v;
MDAddress ← F;
MDShiftCK ← F;
IF (BitOps.WShift[value,1-c] MOD 2) = 0 THEN MDSerialOut ← F
ELSE MDSerialOut ← T;
Send;
FOR s
IN [1..c)
DO
MDShiftCK ← T;
IF (BitOps.WShift[value,s-c+1] MOD 2) = 0 THEN MDSerialOut ← F
ELSE MDSerialOut ← T;
Send;
MDShiftCK ← F;
Send;
ENDLOOP;
};
Start of the Program
Here the program start :
Create or Append the file
outf ← FS.StreamOpen["///Chip/BackLinkDBus1.oracle", $create];
outf.PutF["-- Test D-Bus for Oracle\n"];
outf.PutF[" \n"];
outf.PutF["-- Output :\n"];
outf.PutF["-- nDSerialOut: A, MDSerialIn: B, MDExecute: C, MDAddress: D, \n"];
outf.PutF["-- MDShiftCK: E,MnFreeze: F, MnDReset:G\n"];
outf.PutF["-- Input :\n"];
outf.PutF["-- MDSerialOut:M, nDSerialIn:N, nDExecute:O, nDAddress:P, \n"];
outf.PutF["-- nDShiftClock:Q, DFreeze:R,DReset:S,\n"];
outf.PutF[" \n"];
outf.PutF["-- A B C D E F G ~ M N O P Q R S \n"];
outf.PutF["\n"];
Start Generation :
lineCount← 0;
Init;
Send;
comment ← "Address of the Arbiter 0 ID path";
SendAddress[0];
comment ← "ID of the Arbiter type:1, Version 5";
ReadandCheck[5045H];
comment ← "Address of the Arbiter 1 ID path";
SendAddress[2000H];
comment ← "ID of the Arbiter type:1, Version 3";
ReadandCheck[5043H];
comment ← "Address of the BIC 0 ID path";
SendAddress[0100H];
comment ← "ID of BIC type 2, Version 8";
ReadandCheck[5088H];
comment ← "Address of the BIC 1 ID path";
SendAddress[0120H];
comment ← "ID of BIC type 2, Version 9";
ReadandCheck[5089H];
comment ← "Address of the BIC 2 ID path";
SendAddress[0140H];
comment ← "ID of BIC type 2, Version 10";
ReadandCheck[508AH];
comment ← "Address of the BIC 3 ID path";
SendAddress[0160H];
comment ← "ID of BIC type 2, Version 11";
ReadandCheck[508BH];
comment ← "Address of the BIC 4 ID path";
SendAddress[0180H];
comment ← "ID of BIC type 2, Version 12";
ReadandCheck[508CH];
comment ← "Address of the BIC 5 ID path";
SendAddress[01A0H];
comment ← "ID of BIC type 2, Version 13";
ReadandCheck[508DH];
comment ← "Address of the BIC 6 ID path";
SendAddress[01C0H];
comment ← "ID of BIC type 2, Version 14";
ReadandCheck[508EH];
outf.PutF[". \n"]; -- end
outf.Close[];