//**************************************************************************************
//*** ECLutvfc7a.TST
//*** Rev.H                                                July 9.1979
//*** Rev.F                                                February16.1979
//*** Rev.B										August 4.1978        
//*** V. Vysin                                             
//**************************************************************************************

//**************************************************************************************
//To include the following definition files in the compilation
get "tester.d"
get "ECLutvfc.d"

//**************************************************************************************
//{ODataM: Odata.00, Odata.01, Odata.02, Odata.03, Odata.04, Odata.05, Odata.06, Odata.07}
//{ODataL:  Odata.08, Odata.09, Odata.10, Odata.11, Odata.12, Odata.13, Odata.14, Odata.15}
//{OData0: Odata.00, Odata.01, Odata.02, Odata.03}
//{OData1: Odata.04, Odata.05, Odata.06, Odata.07}
//{OData2: Odata.08, Odata.09, Odata.10, Odata.11}
//{OData3: Odata.12, Odata.13, Odata.14, Odata.15}
//{IAddr: Iaddr.0, Iaddr.1, Iaddr.2, Iaddr.3, Iaddr.5, Iaddr.6, Iaddr.7}


let Test72() be
[
   Start()

// we shall now be testing the A clock channels

      {ODataL} = 1
      ClkCR()      //clears Gray counter

      {ODataL} = #200 ;   // bit 8 =1
      ClkCR()         // clkB goes up
      for g = 0 to 3 do
      [
         Select(g)
         Compare("IOAttn'",{IOAttn'},1,"ClockA behind times",1,g)
         ResetIMeF()
      ]
      ClkCR()        // ClkA goes up now
      for g = 0 to 3 do
      [
         Select(g)
         Compare("IOAttn'",{IOAttn'},0,"ClockA behind times",2,g)
         ResetIMeF()
      ]
       ClkCR()        // ClkA should not change now,ClkB went down
      for g = 0 to 3 do
      [
         Select(g)
         Compare("IOAttn'",{IOAttn'},0,"ClockA behind times",3,g)
         ResetIMeF()
      ]
      ClkCR()         // clkA went down
      for g = 0 to 3 do
      [
         Select(g)
         Compare("IOAttn'",{IOAttn'},1,"ClockA behind times",4,g)
         ResetIMeF()
      ]
//We now shall test ClockB channels and the DropClock gating          
      [
         DisplayString("*nA-clock channels are in A1 shape")
         DisplayString("*nMove the marked test clip to position d-2 ")
         DisplayString("*nAfter  having done so, press any key on the keyboard ! ")
         while Endofs(keys) do[]
         Breakpoint(9)
      ]
      {ODataL} = 1
      ClkCR()      //clears Gray counter
      {ODataL} = #200 ;   // bit 8 =1
      for g = 0 to 3 do
      [
         Select(g)
         Compare("IOAttn'",{IOAttn'},1,"ClockB behind times",5,g)
         ResetIMeF()
      ]
      ClkCR()        // ClkB goes up now
      for g = 0 to 3 do
      [
         Select(g)
         Compare("IOAttn'",{IOAttn'},0,"ClockB behind times",6,g)
         ResetIMeF()
      ]
      ClkCR()
      ClkCR()      // this brought the B clock down again
      for g = 0 to 3 do
      [
         Select(g)
         Compare("IOAttn'",{IOAttn'},1,"ClockB behind times",7,g)
         ResetIMeF()
      ]
      SetVS()
      NClk(1)       // sets SendControl
      NClk(1)        // sets DropClockB'
      {ODataL} = #200 ;   // bit 8 =1
      ClkCR()     // sets ClkB,but output blocked by DropClock
      for g = 0 to 3 do
      [
         Select(g)
         Compare("IOAttn'",{IOAttn'},1,"ClockB behind times",8,g)
         ResetIMeF()
      ]
      ResetVS()
      [
         DisplayString("*nWould you now please press q to quit or any other key for test repetition?")
         while Endofs(keys) do[]
         unless Endofs(keys) do
         [
            let ch = Gets(keys)
            switchon (ch& #177) into
            [
               case $q:
               case $Q: finish
            ]
         ]
      ]
      Stop()
]

and Select(g) be
[
   {Iaddr.6}= 1- g rem 2
   {Iaddr.7}= 1-(g-g rem 2) rshift 1
   {IValid'} =0
   EClock()         // sets IMeF
]
and SetVS() be
[
   Switch()
   NClko(8)        // PreO,AllowWU =0,PreVS=1
   MLpulse()
   NClk(1)
]

and ResetVS() be
[
   Reset()                  // PreO,PreVS =0
   MLpulse()
   NClk(1)
]