Appending Multiple Digital Test Patterns to Reduce Test Time

Knowledge Base Article # Q200333

Read Prior Article Read Next Article
Summary The following article describes how to streamline a digital application by merging digital test patterns into one compressed file that can be loaded once and accessed for each digital test. The examples provided use the GtDio6x and ATEasy software packages to program and control PXI GX5960 series or the GX5296 digital IO boards.
  
Login to rate article

Introduction

Digital test programs, especially semiconductor test programs generated from multiple simulation files such as STIL, WGL, VCD, EVCD or ATP normally encompass a large number of test vectors. This number of digital test vectors is compounded by the required number of digital tests. This greatly reduces the overall test throughput as the digital instrument is required to load and reload these digital patterns for each test. The large memory capacity and the direct memory access of the Marvin Test Solutions GX5296 allows these digital test vectors to be loaded once at program load time and directly accessed for each test.

The following article describes how to streamline a digital application by merging digital test patterns using the provided driver function GtDio6xFileAppend to generate a single compressed file that can be loaded once at program load time.

This article assumes that the reader has some basic knowledge of the GX5296 or GX5960 series of dynamic digital instruments. As the GX5296 uses the GtDio6x driver, this example can also be easily applied to any of the GX5960 series of digital instruments. For a complete example of using this functionality, refer to the GX5296TestsUsingOneFile program included at the end of this article.


The benefits of using the appended file approach are as follows:
  • Provides a group of digital test sequences that can be quickly accessed without reloading the digital file
  • Designed to easily run using the appended file or the existing digital files
  • Appended file is created in a nondestructive manner that does not change existing files
  • Easily sustainable to update and/or add additional test functionality
  • Provides a location for a preamble step that runs prior to the test to set up the device under test (DUT) prior to running a test
  • Tests can be placed in any order as test identity is located within the appended file


The Preamble Step

Often digital tests require some sort of preamble to set up the DUT to a certain state prior to running a test. Each test in an appended file can be described as a block of one or more Steps. The first block of steps is reserved to provide a preamble for DUT setup and a launch point to jump to the desired test (Refer to Figure 1).

If the timing of the preamble step requires a different timing than the preceding tests, then the timing set used in the preamble step can be programmed to a unique timing set and or Clock Per Vector (CPV) setting.

If no preamble step is necessary to setup the DUT then the Preamble Step 0 should be at least 10 vectors in length with all used channels set to dynamic and all vectors set to tristate. This can easily be created using Dio6xEasy and saved to a file. The Preamble step used in this example is one step in length.

 Organizing Merged Files
Figure 1 – The Preamble Step and Step Sequencing


GtDio6xFileAppend Driver Function

The GtDio6xFileAppend function has several options that allow the user to customize appending files as follows. The GtDio6xFileAppend function is nondestructive, meaning that it will retain the original files while creating a new appended file. Also, the procedure does not require any hardware to run.
ParametersComment
sFirstFileNameThe first or main file name to append to the destination file
sAppendedFileNameFile name to add after the first file to the destination file
sDestinationFileNameAppended or destination file name
dwStartStepStarting step to append at, use -1 to append at after the last step
dwNumberOfStepsToAppendThe number of steps to append, use -1 to append all steps
dwVectorOffsetVector memory offset to begin appending at, use -1 to append after last vector
dwNumberOfVectorsThe number of vectors to append, use -1 to append all vectors
dwFlagsAllows the user to control which sections of the file to append. See flag definition below
nStatusReturn status 0 if success negative if failure


The dwFlags parameter allows the user to control which sections of the file to append. Each bit represents a section of the file as follows:
FlagsDefinitionComment
0x0000File Append AllAppend all, this is the default
0x0001Ignore number of channelsDon't error if the number of channels in each file is not equal
0x0002Remove Last Step FlagRemoves all last step flags from the appended file
0x0004Remove first file last Step FlagRemoves all last step flags from the first or main file

  

File Append Procedure

The GX5296TestsUsingOneFile ATEasy test program FileAppend Procedure (shown below) is used to create the appended test file. As previously stated, each merged file is separated by its last step flag. To further identify the location of each test, this procedure marks the first step of each appended test file with its filename (without extension). To simplify programming, this procedure adds the file path and extension (.Dio6x) to each filename string.  The the main goal of this procedure is to combine all digital test files into a single file. The default (-1) is used for all GtDio6xFileAppend options. The dwFlag parameter is set to zero.

Procedure FileAppend (sFirstFile, sAppendedFile, sDestinationFile) : Void
  sFirstFile          Val String       First file used to apppend
  sAppendedFile       Val String       File to append to the first
  sDestinationFile    Val String       Appended file destination
  StepCount           Long             Step count of test files
  nFileHandle         Short            File Handle
  sFirst              String           Saved base first file name
  sAppend             String           Saved base Append file name
  sDestination        String           Saved base Destination file name          
{
  !Save basic file names to set the step names
  sFirst = sFirstFile
  sAppend = sAppendedFile
  sDestination = sDestinationFile

  !Add the file path to each file name files are stored in the directory DioFiles
  sFirstFile = GetDir(aGetDirCurrent)+sFirstFile+".dio6x"
  sAppendedFile = GetDir(aGetDirCurrent)+sAppendedFile+".dio6x"
  sDestinationFile = GetDir(aGetDirCurrent)+sDestinationFile+".dio6x"

  !Append the files to the destination file
  Dio File Append(sFirstFile, sAppendedFile,sDestinationFile,-1,-1 ,-1 ,-1,0)

  !Open the first file to get the Step size
  if sFirst <> sDestination
      !Don't mofify existing files
      Dio File Open(sFirstFile,adio6xFileOpenModeRead, adio6xFileBoardTypeGx5296)
  else
      Dio File Open(sFirstFile,adio6xFileOpenModeReadWrite, adio6xFileBoardTypeGx5296)
  endif

  Dio File Get Handle(nFileHandle)
  Dio Get Step Count(lStepCount,nFileHandle)

  !Determine if destination file is already open
  if sFirst <> sDestination
     !Close first file and open destination
     Dio File Close(nFileHandle)
     Dio File Open(sDestinationFile,adio6xFileOpenModeReadWrite,adio6xFileBoardTypeGx5296)
     Dio File Get Handle(nFileHandle)
  endif

  !Name the appended step
  Dio Set Step Name(lStepCount,sAppend,nFileHandle)
  if sFirst <> sDestination
     !Name the preamble step
     Dio Set Step Name(0,sFirst,nFileHandle)
  endif
  Dio File Close(nFileHandle)
}


Loading the Appended File from an ATEasy Test Program

In order to use the appended file, the programmer must find a method to load the file only once. This is best performed by creating a new driver to place the FileAppend procedures and other routines. The load file command used to load the appended file could then be placed in the driver's OnInitProgram event. The advantage of using a separate driver to load the file is that it will be loaded prior to the start of the main program and therefore will not affect the test time. To simplify this example, the appended file is loaded on the first run of a DUT. This means that the test time of the first DUT test run will be increased by the load time of the appended file. The test time of all other runs will be unaffected.

In either case, two system level global variables are required to use appended files in a program. The first is a flag to determine the appended file load state, and the second is an array of structures that contains each appended file name, location and T0 Clock. A program local variable bUseAppendFile is used to allow the programmer to easily switch from using the appended file to using the original digital files.  Recall that the FileAppend function is nondestructive and therefore the original files remain unchanged. When using an appended digital file, the user must be careful not to use any DIO reset commands after loading the file.

The ATEasy program OnInit event contains the code to selectively load the appended file. The user only needs to change the bUseAppendFile variable to False to switch modes and bypass loading the appended file and use the original digital files. When the appended file is enabled, the PrepareDioFile procedure determines if the appended file needs to be created. If no appended file exists, the program will create the appended file as shown.

Procedure PrepareDioFile(sAppendFileName, nTotalTests, asTestNames): Void
--------------------------------------------------------------------------------
sAppendFileName: Val String    ! Name of appended file
nTotalTests: Val Short         ! Number of tests to append
asTestNames: Val String[]      ! List of file names to append
nCntr: Short                   ! Counter
pstFileStatus: structFileStatus! Get file status structure
{
   !Create the appended file if it does not exist
   sAppendFileName=GetDir(aGetDirCurrent)+"\\"+sAppendFileName+".dio6x"
   if FileGetStatus(sAppendFileName,pstFileStatus) <> True
       !Append Preamble to first Scan test and create the appended file
       asTestNames[0]=GetDir(aGetDirCurrent)+asTestNames[0]+".dio6x"
       asTestNames[1]=GetDir(aGetDirCurrent)+asTestNames[1]+".dio6x"
       FileAppend(asTestNames[0],asTestNames[1],sAppendFileName)
       For nCntr=2 to nTotalTests-1
           !Append all other test files to the appended file
           asTestNames[nCntr]=GetDir(aGetDirCurrent)+asTestNames[nCntr]+".dio6x"
           FileAppend(sAppendFileName,asTestNames[nCntr],sAppendFileName)
       next
   endif
}
Once the appended file has been loaded, the last step flag of the Preamble step is set to False. This is required, as a Jump instruction cannot be placed on a last step. The procedure GetAllStartingStepInfo gets the location of each named step from the passed asTestList variable array and sets test name, step address and T0 clock information for each test name. An error will occur if the test name is not found. The test name is not case sensitive. For more information regarding the GetAllStartingStepInfo procedure refer to the GX5296TestsUsingOneFile example.

Procedure OnInit(): Void Public! Occurs when a program has started.
  sFileName             String         Filename of appended string
  nTotalTests           Short          Total number of test in appended file
  asTestList            String[1]      Array of test names in appended file
{
  !Log Total test time in OnEnd event
  dTstTimer=Tick()
  !Set to false to use original digital files
  bUseAppendFile=True
  !Set the name of the append file
  sFileName="GX5296TestsUsingOneFile"
  !Set the total tests in appended file including preamble step
  nTotalTests=3
  !List all test names,
  redim asTestList[nTotalTests]
  asTestList = {"GX5296TestsUsingOneFilePreamble","GX5296TestsUsingOneFileScan1",\
                "GX5296TestsUsingOneFileScan2,GX5296TestsUsingOneFileScan3"}
  !Load appended file if enabled and not loaded
  if (bUseAppendFile=True) AND (m_bAppendFileLoaded<>True)  
      !Create appended file if necessary
      PrepareDioFile(sFileName,nTotalTests,asTestList)
      !Add file path and extention                           
      sFileName=GetDir(aGetDirCurrent)+sFileName+".dio6x"    
      !Load the Appended file
      Dio File Load(sFileName,0,0,0,0)
      !The preamble step cannot have its last step flag set
      Dio Set Step Last(0,False)
      !Creates the m_aStep array of starting steps and clocks
      GetAllStartingStepInfo(nTotalTests,asTestList)
      !Prevent the file from being reloaded
      m_bAppendFileLoaded=True
  endif
}


GtDio6xFileLoad Driver Function Flags

The GtDio6xFileLoad(nHandle, pszFileName, dwFileStartStepOrVector, dwStartStepOrVector, dwNumOfStepsOrVectors, dwFlags, pnStatus) function provides a simple method to load only the portions of the digital file that are required to run a test. The definitions of the dwFlags are as follows:
FlagDefinitionComment
0x0000File Load AllLoad the complete file
0x0001File Load VectorsLoad the file Vector memory
0x0002File Load RecordLoad the Record memory
0x0004File Load Channel SettingsLoad the Channel settings
0x0008File Load Step SettingsLoad the step settings
0x0010File Load Timing SettingsLoad the timing setting
0x0020File Load General SettingsLoad the General settings
0x0040File Load Disable Unused ChannelsUnused channels will be set to disabled
0x0080File Load Reset DomainReset Domain performed prior to load
0x0100File Load Reset Unused Channels DataVector memory of Unused channels will be 'Z'
0x1000File Load File Load Range Of Vectors Load a range of vectors specified StartStep and NumSepsOrVectors


Using the Appended Files in a ATEasy Test Program

A typical test program normally contain some sort of shorts and opens testing, some digital only tests and maybe some mixed digital/analog tests. As the shorts and opens test alone changes the channel mode of the DIO, clearly the channel state of the DIO must be restored prior to any digital testing. Also the timing of one or more of the appended files may need to be changed to restore the DIO to the same state as the original file. If the test requirements do not require any changes in the channel settings, sequencer or the timing, then the file load step can be omitted since the digital resources would already be loaded. This example assumes that the channel timing and general settings would need to be reloaded for each test run.

The System Global flag bUseAppendFile determines if the test will use the original or appended file. When using the appended file, the same load file command is executed with the flags set to only load the Channel, Timing and General settings. The program also calls the procedure GetStartingStepInfo to get the clock and starting step for the test. Recall that during the appended file load, the last step flag of the last preamble step is cleared.

To match the timing of each test, the GtDio6xSetClock function sets the T0 clock and CPV of the preamble step (Step 0) to match the test file. The test file is then load with the indicated flags.

Unless the start address precedes the Preamble step address, the starting step is programmed as a jump location on the preamble last step (Refer back to Figure 1).  

The RunBurst procedure simply executes the digital burst and waits for its completion with a programmed timeout. When the burst has been completed, the Real Time Compare error counter of each board is queried and the total number of failures is reported. For more information regarding the GetStartingStepInfo and the RunBurst procedures, refer to the GX5296TestsUsingOneFile example.

Procedure RunDigitalTest(sfileName): Void    Runs test sequence from test or appended file
  sfileName              Var String          Input File Name
  dClock                 Double              T0 Clock from test file
  lCpv                   Long                Clocks Per Vector from append file
  lErrorAddressCount     Long                RTC Error Address count per board
  lFailures              Long                RTC Fail count per board
  lStartStep             Long                Starting step of test in appended file
  lTotFailures           Long                RTC Totlal Failures found
  nBrdCnt                Long                Number of found boards
  nCntr                  Short               Board counter
  nFileLoadFlags         Short               Flags used to load file
  nHandle                Short               Handle of each board to get RTC data
  sTestFile              Short               Modified file name with path and extention
{
  sTestFile = GetDir(aGetDirCurrent)+sfileName+".dio6x"
  if bUseAppendFile = True
      !Get the Preamble step CPV value
      Dio Get Step Clock(0,dClock, lCpv)
      !Search appended file for the test name and get the starting Step and Clock
      GetStartingStepInfo(sFileName,lStartStep,dClock)
      !Set the preamble step to dClock
      Dio Set Step Clock(0,dClock, lCpv)
      !Only Load Channel, Timing and General Settings
      nFileLoadFlags = 0x20+0x10+0x4
  else
       nFileLoadFlags = 0
  endif

  Dio File Load(sTestFile,0,0,0,nFileLoadFlags)

  if bUseAppendFile = True
      ! Set Jump address for burst
      if lStartStep=1
          !Remove any Step 0 jump command
          Dio Set Step Control(0,adio6xControlActionNone, lStartStep, \
              adio6xControlConditionUnconditional, 1,0,0)
      else
          !Set the jump command
          Dio Set Step Control(0,adio6xControlActionJump, lStartStep, \
              adio6xControlConditionUnconditional, 1,0,0)
      endif
  endif

  !Run the digital burst and wait for completion with timeout
  RunBurst()

  !Get the total number of boards in the domain
  Dio Get Board Count(nBrdCnt)

  !Find the total error count of all boards in domain
  nCntr=0
  lTotFailures=0
  repeat
      if nCntr=0
          Dio Get MasterHandle(nHandle)
      else
          Dio Get SlaveHandle(1,nCntr,nHandle)
      endif
      ! Get board Error Count
      Dio Get RealTimeCompare ErrorCount(lErrorAddressCount,lFailures,nHandle)
      lTotFailures = lTotFailures+lFailures
      nCntr=nCntr+1
  until nCntr=nBrdCnt

  TestResult = lTotFailures
  Test.Type=atestTypePrecise
  !Expected value
  Test.Value=0
}


Calling Digital Tests

The ATEasy test program includes three examples of SCAN files generated using provided STL files and converted using Dio6xFIT. For an example of file conversion see Knowledge Base article #200330. The calls to the following tests assume that DUT power has already been applied to the unit. The Test Type used for these tests is Precise and the expected value is 0, for zero errors for a pass condition. Recall that the RunDigitalTest procedure shown above sets the TestResult variable to the total number of Real Time Compare errors found.

Test 1.1 : "Scan Test 1"
--------------------------------------------------------------------------------
  Id = Test3
  Type = Precise
{
  !Execute Scan chain 1
  RunDigitalTest("GX5296TestsUsingOneFileScan1")
}

Test 1.2 : "Scan Test 2"
--------------------------------------------------------------------------------
  Id = Test7
  Type = MinMax
{
  !Execute Scan chain 2
  RunDigitalTest("GX5296TestsUsingOneFileScan2")
}

Test 1.3 : "Scan Test 3"
--------------------------------------------------------------------------------
  Id = Test6
  Type = MinMax
{
  !Execute Scan chain 3
  RunDigitalTest("GX5296TestsUsingOneFileScan3")
}


GX5296 File Append Example

The following is a link to the GX5296TestsUsingOneFile.Zip ATEasy test program. Download this file and extract the files onto your hard drive. The contents of the compressed ZIP file are as follows:
Gx5296 Append Example FilesDescription
GX5296TestsUsingOneFile.wspATEasy Workspace file                                                                        
GX5296TestsUsingOneFile.prgATEasy Program file
GX5296TestsUsingOneFile.sysATEasy System file
GX5296TestsUsingOneFile.prjATEasy Project file
GX5296TestsUsingOneFileScan1.dio6xScan Test 1 digital file
GX5296TestsUsingOneFileScan2.dio6xScan Test 2 digital file
GX5296TestsUsingOneFileScan3.dio6xScan Test 1 digital file
GX5296TestsUsingOneFilePreamble.dio6xPreamble digital file
GX5296TestsUsingOneFile.dio6xAppended Test file


GX5296TestsUsingOneFile.zip
Article Date 5/29/2020 , 7/28/2023
Keywords ATE, STIL, WGL, VCD, EVCD, ATP, GX5296, GX5960, GtDio6x, ATEasy


Login to rate article

1 ratings | 4 out of 5
Read Prior Article Read Next Article