//**************************************************************************************
//RDC8.tst
//Error Detection & Control 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"

//**************************************************************************************
//Test81
To test:CRC Generation

let Test81() be
[
L81: Start()
EnableDevClk()

//Clear CRC Register
{dSyncTime} = 1
for n = 0 to 2 do//Generate ByteClk
[
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
]

//Set 1 into CRC Register
{dSyncTime} = 0
{dCRCShift} = 1
{dECCShift} = 1
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
{dECCShift} = 0
{dCRCWrite} = 1
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)

//SubTest81.1.n; checks CRC generation
let crcd = 0
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
IData(Test)
crcd = (idt & 2b) rshift 1
if not Compare("CRC Data", crcd, 1, "CRC generation incorrect;*n check CRC Generator, CRC control terms, or DevWrtData gate.", 2, 1) goto L81
for n = 1 to 12 do
[
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
IData(Test)
crcd = (idt & 2b) rshift 1
if not Compare("CRC Data", crcd, 0, "CRC generation incorrect;*n check CRC Generator, CRC control terms, or DevWrtData gate.", 2, 1, n) goto L81
]
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
IData(Test)
crcd = (idt & 2b) rshift 1
if not Compare("CRC Data", crcd, 1, "CRC generation incorrect;*n check CRC Generator, CRC control terms, or DevWrtData gate.", 2, 1, 13) goto L81
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
IData(Test)
crcd = (idt & 2b) rshift 1
if not Compare("CRC Data", crcd, 0, "CRC generation incorrect;*n check CRC Generator, CRC control terms, or DevWrtData gate.", 2, 1, 14) goto L81
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
IData(Test)
crcd = (idt & 2b) rshift 1
if not Compare("CRC Data", crcd, 1, "CRC generation incorrect;*n check CRC Generator, CRC control terms, or DevWrtData gate.", 2, 1, 15) goto L81

if Stop() goto L81
return
]

//Test82
To test:ECC Generation

let Test82() be
[
L82: Start()
EnableDevClk()

{dWriteGate} = 1
{dECCShift} = 1
{dECCClear} = 1
OData(TestRegLd, 405b)//Generate ByteClk
OData(TestRegLd, 404b)
for n = 0 to 48 do//Clear ECC Register and Deserializer
[
OData(TestRegLd, 401b)
OData(TestRegLd, 400b)
]
{dECCClear} = 0
{dDataTime} = 1
OData(TestRegLd, 401b)
OData(TestRegLd, 400b)

//Set Deserializer to 000001b
for n = 0 to 5 do
[
OData(TestRegLd, 401b)
OData(TestRegLd, 400b)
]
OData(TestRegLd, 403b)
OData(TestRegLd, 402b)
OData(TestRegLd, 403b)
OData(TestRegLd, 402b)

//Set 1 into ECC Register
for n = 0 to 14 do
[
OData(TestRegLd, 403b)
OData(TestRegLd, 402b)
]
{dECCClear} = 1
{dECCWrite} = 1
{dDataTime} = 0
//Generate ByteClk; Set 1 into ECC Register
OData(TestRegLd, 403b)
OData(TestRegLd, 402b)

//SubTest82.1.n; checks ECC generation
let eccd = 0
for n = 0 to 7 do
[
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
IData(Test)
eccd = (idt & 2b) rshift 1
if not Compare("ECC Data", eccd, 0, "ECC generation incorrect;*n check ECC Generator, ECC control terms, or DevWrtData gate.", 2, 1, n) goto L82
]
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
IData(Test)
eccd = (idt & 2b) rshift 1
if not Compare("ECC Data", eccd, 1, "ECC generation incorrect;*n check ECC Generator, ECC control terms, or DevWrtData gate.", 2, 1, 8) goto L82
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
IData(Test)
eccd = (idt & 2b) rshift 1
if not Compare("ECC Data", eccd, 0, "ECC generation incorrect;*n check ECC Generator, ECC control terms, or DevWrtData gate.", 2, 1, 9) goto L82
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
IData(Test)
eccd = (idt & 2b) rshift 1
if not Compare("ECC Data", eccd, 1, "ECC generation incorrect;*n check ECC Generator, ECC control terms, or DevWrtData gate.", 2, 1, 10) goto L82
for n = 11 to 19 do
[
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
IData(Test)
eccd = (idt & 2b) rshift 1
if not Compare("ECC Data", eccd, 0, "ECC generation incorrect;*n check ECC Generator, ECC control terms, or DevWrtData gate.", 2, 1, n) goto L82
]
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
IData(Test)
eccd = (idt & 2b) rshift 1
if not Compare("ECC Data", eccd, 1, "ECC generation incorrect;*n check ECC Generator, ECC control terms, or DevWrtData gate.", 2, 1, 20) goto L82
for n = 21 to 28 do
[
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
IData(Test)
eccd = (idt & 2b) rshift 1
if not Compare("ECC Data", eccd, 0, "ECC generation incorrect;*n check ECC Generator, ECC control terms, or DevWrtData gate.", 2, 1, n) goto L82
]
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
IData(Test)
eccd = (idt & 2b) rshift 1
if not Compare("ECC Data", eccd, 1, "ECC generation incorrect;*n check ECC Generator, ECC control terms, or DevWrtData gate.", 2, 1, 29) goto L82
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
IData(Test)
eccd = (idt & 2b) rshift 1
if not Compare("ECC Data", eccd, 0, "ECC generation incorrect;*n check ECC Generator, ECC control terms, or DevWrtData gate.", 2, 1, 30) goto L82
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
IData(Test)
eccd = (idt & 2b) rshift 1
if not Compare("ECC Data", eccd, 1, "ECC generation incorrect;*n check ECC Generator, ECC control terms, or DevWrtData gate.", 2, 1, 31) goto L82

if Stop() goto L82
return
]

//Test83
To test:ECC Check

let Test83() be
[
L83: Start()
EnableDevClk()

//Clear ECC Register
{dECCShift} = 1
{dECCClear} = 1
for n = 0 to 33 do//Generate ByteClk
[
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
]
{dECCClear} = 0
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)

//Check ECC
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
for n = 0 to 7 do
[
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
]
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
for n = 0 to 8 do
[
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
]
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
for n = 0 to 7 do
[
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
]
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
OData(TestRegLd, 407b)
OData(TestRegLd, 406b)
{dECCClear} = 1
{dECCWrite} = 1
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)

//SubTest83.1.n; checks Syndrome
let eccd = 1
for n = 0 to 31 do
[
OData(TestRegLd, 405b)
OData(TestRegLd, 404b)
IData(Test)
eccd = (idt & 2b) rshift 1
if not Compare("ECC Syndrome", eccd, 0, "ECC check incorrect;*n check ECC Generator, ECC control terms, or DevWrtData gate.", 2, 1, n) goto L83
]

if Stop() goto L83
return
]

//Test84
To test:Control; Compare(verify); Buf Par Check

let Test84() be
[
L84: Start()
DisplayString("*nTest 84 not written yet.")

//Test Body

if Stop() goto L84
return
]