Manuals >User's Guide >Creating Graphic User Interfaces
Print version of this Book (PDF file)
prevnext

Random Numbers (Example)

The random numbers example model is an example of a setup with a custom GUI that demonstrates how to use IC-CAP PEL functions to generate random numbers.

The random numbers example model file is located in the product directory:

 ${ICCAP_ROOT}/model_files/misc/random_example.mdl

After you load the example model file, double-click on the Random model icon (by default the model is in AutoExecute mode) to display the following windows:

    • Random Numbers Window
    • Random Histogram Plot

Random Numbers Window

The Random Numbers window includes the following three sections that you can interactively modify by selecting either a fixed seed or varying seed value (seed = val(system$("date +%s"))) push buttons...):

    • Using Function `random'
    • Using Function `rand_flat' (uses function rand_seed() initially)
    • Using Function `rand_gauss' (uses function rand_seed() initially)

Random Histogram Plot

Depending upon which push buttons you select in the Random Numbers window, you can interactively modify the random histogram plot ( randPlot).

Details about how this example works:

  1   To create your own IC-CAP graphical user interface (GUI) items or see how the existing model's GUI items were created, you need to do one of the following before loading your IC-CAP *.mdl:
     From the IC-CAP/Main window, select Tools > Options > View GUI Pages.
     Or if you plan to do a lot of IC-CAP GUI programming you can add the ICCAP_VIEW_GUI_PAGES=1 variable to your iccap.cfg file.

  2   Load the random_example.mdl example model file into IC-CAP 2006B (or greater) Main window, then right-click and select Edit.

  3   If you go to the example model file's Macros tab, you will see that the following random/random DUT Setup's transform, plot, and custom GUI get invoked when you first AutoExecute the example random model.

The following shows the example's Macros tab defining the AutoExecute macro:

  4   The heart of this example is the random/random DUTs-Setups' PEL transform called random_data. Depending upon which buttons you select in the custom GUI window, the following key PEL functions can be executed:
     Using function random:

   return random(42) 
   return random(val(system$("date +%s")))
     Using function rand_flat or rand_gauss:
   x=rand_seed(42) 
   or
   x=rand_seed(val(system$("date +%s")))
   i=0
   while i < size(X)
      if randType=="rand_flat" then
         nums[i]=rand_flat()
      endif
      if randType=="rand_gauss" then
         nums[i]=rand_gauss(gaussMean, gaussSigma)
      endif
      i=i+1
   endwhile
   return nums

  5   The random/random DUTs-Setups' Plots tab defines the histogram plot that will be used with the custom GUI (Note: Data-set is set to random_data transform results; Header is set on the fly based upon which button you select).

  6   Finally, the random/random DUTs-Setups' Setup GUI Items tab shows how the custom GUI window was constructed. Notice that all the Push Button GUI items are defined to have a Button Pressed Callback action to execute the random_data transform via an iccap_func() statement.


prevnext