//**************************************************************************************
//RDC1.tst
//Processor Interface Tests
//By J. F. Cameron
July 11, 1978
//Last modified by J. F. Cameron
June 12, 1980
//**************************************************************************************
//**************************************************************************************
//To include the following definition files in the compilation
get "tester.d"
get "RDC.d"

//**************************************************************************************
//To define bus structure
//{Iaddr: Iaddr.0, Iaddr.1, Iaddr.2, Iaddr.3, Iaddr.4, Iaddr.5, Iaddr.6, Iaddr.7}

//**************************************************************************************
//Test11
To test:Caddr Register
let Test11() be
[
L11: Start()
{RUN} = 0
{RUN} = 1
SetCaddr(00b)//Clears Caddr Register

//SubTest 11.1.n; L11oads Caddr Register with "0"s; checks previous load
for n = 0 to 3 do
[
if not Compare("SROut’", {SROut’}, 1, "Failure, Caddr register , or SROut’.", 3, 1, n) goto L11
{SRIn’} = 0
SRClock()
]

//SubTest 11.2.n; L11oads Caddr Register with "1"s; checks previous load
for n = 0 to 3 do
[
if not Compare("SROut’", {SROut’}, 0, "Failure, Caddr register, or SROut’.", 3, 2, n) goto L11
{SRIn’} = 1
SRClock()
]

//SubTest11.3.0; Checks last bit loaded
if not Compare("SROut’", {SROut’}, 1, "Failure, Caddr register, or SROut’.", 3, 3) goto L11

if Stop() goto L11
return
]

//Test12
To test:ICompare; IMeF
let Test12() be
[
L12: Start()
{RUN} = 0
{RUN} = 1

//SubTest12.1.0; Checks that IMeF is reset
if not Compare("IMeF", {IMeF}, 0, "IMeF not reset; check IMe’ gate.", 3, 1) goto L12
let iaddrval1 = table[ 200b; 300b; 340b; 360b; 160b; 060b; 020b; 000b ]
SetCaddr(00b)
for n = 0 to 7 do
[
//SubTest12.2.n; Checks that IMeF is reset when Caddr and Iaddr are not equal
{Iaddr} = iaddrval1!n
{IValid’} = 0
EClock()
if not Compare("IMeF", {IMeF}, 0, "IMeF not reset; possible failure of*n ICompare, IMe’ gate, or IMeF.", 2, 2, n) goto L12

//SubTest12.3.n; Checks that IMeF is set when Caddr and Iaddr are equal
test n ls 4
ifso {SRIn’} = 0
ifnot {SRIn’} = 1
SRClock()
EClock()
if not Compare("IMeF", {IMeF}, 1, "IMeF not set; possible failure of*n ICompare, IMe’ gate, IValid receiver, or IMeF.", 2, 3, n) goto L12

//SubTest12.4.n; Checks that IMeF is reset when IValid is false
{IValid’} = 1
EClock()
if not Compare("IMeF", {IMeF}, 0, "IMeF not reset; possible failure of*n IValid receiver, or IMeF.", 2, 4, n) goto L12
]

if Stop() goto L12
return
]

//Test13
To test:OMeF
let Test13() be
[
L13: Start()
{RUN} = 0
{RUN} = 1
//SubTest13.1.0; Checks that OMeF is reset
if not Compare("OMeF", {OMeF}, 0, "OMeF not reset; check OMe’ gate.", 3, 1) goto L13

//SubTest13.2.0; Checks that OMeF is set when Caddr and Oaddr are equal
SetCaddr()//Default Caddr is 12b
{Iaddr} = 240b
{AdvancePipe’} = 0
EClock()
{AdvancePipe’} = 1
{MC2StartXport} = 1
EClock()
{MC2StartXport} = 0
{OValid’} = 0
EClock()
if not Compare("OMeF", {OMeF}, 1, "OMeF not set; possible failure of*n Iaddr pipe, Oaddr register, AdvancePipe’ receiver, MC2StartXport receiver, OValid’*n receiver, OMe’ gate, or OMeF.", 1, 2) goto L13

//SubTest13.3.0; Checks that OMeF remains set when Caddr and IAddr are not equal
{Iaddr} = 200b
{AdvancePipe’} = 0
EClock()
{AdvancePipe’} = 1
EClock()
if not Compare("OMeF", {OMeF}, 1, "OMeF not set; possible failure of*n Iaddr pipe, or Oaddr register.", 2, 3) goto L13

//SubTest13.4.0; Checks that OMeF is reset when OValid is false
{OValid’} = 1
EClock()
if not Compare("OMeF", {OMeF}, 0, "OMeF not reset; possible failure*n of OValid’ receiver, or OMe’ gate.", 2, 4) goto L13

//SubTest13.5.0; Checks that OMeF is reset when Caddr and OAddr are not equal
{OValid’} = 0
{MC2StartXport} = 1
EClock()
{MC2StartXport} = 0
EClock()
if not Compare("OMeF", {OMeF}, 0, "OMeF not reset; possible failure*n of Iaddr pipe, Oaddr register, MC2StartXport receiver.", 2, 5) goto L13

if Stop() goto L13
return
]