svtGUI: The Single-Board Diagnostic Tool For SVT

Alessandro Barchiesi, Subir Sarkar

Abstract

svtGUI is a lightweight application for standalone single-board diagnostic tests for the Silicon Vertex Trigger (SVT) in CDF. The graphical user interface, built with Gtk+/GNOME, is intuitive and dynamic. An embedded Python interpreter greatly extends the applicability of svtGUI. New tests for a board can be defined and executed by the interpreter dynamically.

1. Introduction

The SVT[1,2] system is composed of 9U Euro-card boards which implement a VME-bus interface for control and diagnostics. The entire SVT hardware consists of about 130 boards distributed in 8 VME crates. Each VME crate houses a powerful, network connected, CPU running VxWorks 5.3.1 Real-Time Operating System. Interactions with the SVT system from workstations running in the CDF-Online environment is accomplished with the help of a library of functions, written in C and built on top of the FISION[3] package for board access via the VME-bus. The library, called svtvme, is now mature and complete and used extensively in the SVT Data Acquisition system.

Several board diagnostic tools, both simple and expert level, exist in the SVT community. We describe below each of them in brief in order to place the development of svtGUI in perspective.

  1. A number of text based and menu driven C programs for individual boards. These programs are simple to use but do not have a consistent layout for all the SVT boards. This has caused them to remain mostly in the expert domain.
  2. Extensive multi-board test suites written with specific goals in mind.
  3. CORBA[4]/Robin remote object protocol based cdfvme/svtDaq[5] that can accomplish multi-board tests. This tool, written in Java, is complete and highly configurable. However, it is complicated, rather heavy with graphics, less intuitive and suffers from overhead of CORBA. The question of maintainability clearly goes against this application framework.
  4. Java Native Interface (JNI)[6] over the svtvme C library which allows Java based User Interface (reused and simplified from svtDaq) to access the SVT boards directly. Applications built on top of JNI are lighter and a lot more efficient for simple tasks.
  5. Interactive Python/JPython[7] scripting, a very simple and powerful way of interacting with the boards. This option has all the power of menu driven, text based tools and it is highly configurable. The Python binding to svtvme is extensively used by the SVT experts. However, although Python is very simple and concise, it is not as common as C.

It is clear from the above discussion that the existing tools are scattered in different places and that a reasonable amount of maintenance effort is required to keep the tools in synchronization with svtvme development. It was natural to build a user-level, light and configurable graphical application, which should follow svtvme development closely, incorporate all the advantages of the existing tools and allow users to interact with all the SVT boards using a single user interface. More specifically, the application should allow, (1) easy access to all the SVT boards in some uniform fashion, (2) diagnostics of individual boards in-situ (to test memories, FIFOs, registers etc.), (3) diagnostics of single boards using standard cabling for I/O of test data. For graphics based interface JNI was a choice, but a C based solution was preferred to keep maintenance overhead low. Gtk+/GNOME[8] offered a sound alternative to Java/JNI.

Gtk+/GNOME is the basis of the GNOME desktop on Linux and will certainly be supported in future. Gtk+/GNOME has a very rich set of graphics widgets. The API is simple to use. The interface builder Glade produces very high quality graphics with very little effort. However, Glade produces a monolithic body of code. Therefore, only the initial svtGUI layout was created by Glade; it was subsequently developed programmatically. A simplified view of the svtGUI components and the hierarchy of libraries which act as the basis for the application is shown in Figure 1. svtGUI is also available as a library, and other applications can use the GUI as well as svtvme components.



Figure 1: A schematic view of the hierarchy of libraries svtGUI is built upon. The three basic building blocks of the application window are (a) GUI components, (b) GUI Action handlers or callbacks and (c) the embedded Python interpreter.

2. Description

svtGUI is a part of the Online SVT related package svtvme. It can be started easily on any Online machine as,

> setup svtvme -d
> svtgui

svtGUI consists of a single application window along-with a file browser. The svtvme C API is Object based and implements a generic SVT board which can be extended using board specific properties. Therefore, one can easily connect to any arbitrary but valid crate/board/slot combination from a single svtGUI window.

The application window, which has a standard GNOME look and feel, consists of the following components as shown in Figure 2, namely

  1. A Menubar and a Toolbar. The Menubar consists of File, Settings and Help menus to do basic tasks like (a) saving output into files, (b) clearing the output area, (c) changing configurations etc. The Toolbar contains buttons to save output of various operations to files.
  2. A panel containing the crate, board and slot selection pull-down lists, and two buttons, (1) MapCrate; lists all the boards present in a crate with their slot numbers and identifiers as shown in Figure 2, and (2) Refresh; opens the board shown in the selection lists and updates global informations.
  3. A notebook containing the following pages
  4. Another notebook widget which contains the input/output areas and a scripting window. Data words can be read from the input area and/or written to the output area. The role of the scripting area is described in Section 3.
  5. A Statusbar at the bottom



Figure 2: Global Status window. This is the default page which summarises the overall status of the board under study.

After the board is selected from the pull-down lists one must perform an svtvme operation to open the board. The Refresh button has been implemented along-side the board selection components for this purpose. As soon as the board is opened, the interface changes itself to show Register, Memory, FIFO, Spy Buffer lists which belong to that board only. The Refresh button checks, (a) the internal consistency of the board just opened, and whether (b) the board is in Run/Test mode, (c) the board output is on HOLD, (d) all the FIFOs are empty, etc. and updates the Global Status window (Figure 2).

It also checks if the Spy Buffers which belong to that board are frozen and updates the Spy Buffer window (Figure 4) with that information along-with the spy pointer value and the pointer overflow bit for the first Spy Buffer.

2.1 Global Board Status

The global status window, which is displayed by default when svtGUI is started, consists of the following elements as shown in Figure 2,

2.2 Board Memory Operations: Read, Write, Test and Check

This panel, shown in Figure 3, allows us to access a single memory in several ways. The Test button calls a standard test function a number of times that writes/reads random patterns to test that hardware works. One can read a number of words starting at an offset and either display the data in the output area or dump to a file. In a similar manner one can write a number of words starting at an offset, where the data could be typed in the input area or taken from a file.



Figure 3: Board memory operations page to carry out read, write and test operations.

2.3 Spy Buffer Reading

As shown in Figure 4 one can select a Spy Buffer from a pull down list of available buffers which belong to the board under consideration. As soon as a buffer is selected, the status of the buffer (pointer value, wrap and freeze bits) is updated. One can read and update the status at any time using the Read button. The Reset button resets the spy pointer and the pointer wrap bit. The Spy Buffer data can be displayed in the output area or dump to a file after reading. The number of words to be read from the end of the buffer (tail) can be specified. Alternatively, the the whole buffer might be read. If needed, only the End of Event (EE) words can be displayed.



Figure 4: Board Spy Buffer access page. The board spy buffers can be frozen locally using the Spy Control (SC) board and individual Spy Buffers can be accessed in different modes and subsequently displayed or saved in a file. The buffers can be cleared as well by resetting the spy pointers.

At the bottom row, we provide facilities to locally freeze/release the board Spy Buffers using the Spy Control board which sits in the same crate as that of the board under investigation.

If might be noted that if one wants to read at a random location of the Spy Buffer, rather than the tail, the memory panel (Subsection 2.2) can be used instead.

2.4 Board Register Read, Write and Test Operations

The board register panel is shown in Figure 5. This is the simplest page of all. At a time one can test, read and write five different registers of a board by selecting them from the pull down lists. As a default the first five registers of the selected board are displayed. The same text fields are used for both read and write operations. Individual Read/Write buttons are provided to read/write single registers, whereas ReadAll, WriteAll, TestAll loop over all the five registers. The ClearAll button clears all the input/output fields. Selecting a new board automatically clears all the input/output fields.



Figure 5: Board register read, write and test operations. Five registers can be accessed simultaneously.

2.5 Board FIFO Related Operations

In this panel, shown in Figure 6, the status is shown for individual FIFOs of a board. One can select a FIFO from a pull-down list and subsequently data from that FIFO can be read and displayed or dumped to a file. The meaning of color codes that indicate a particular state of a FIFO has already been explained in Subsection 2.1.



Figure 6: Board FIFO related operations. Status as well as data from the FIFOs can be accessed.

2.6 Sending Data From a Board

The svtvme library provides a number of functions to facilitate a board send data on its output cable(s) to downstream SVT board(s). One can send,

  1. a number of words once at a specified speed,
  2. a number of words in a loop,
  3. the same data once again,
  4. the same data again in a loop,
  5. the same data again.

svtGUI makes a straight-forward interface to those functions. As shown in Figure 7, one can choose the data words to come from a file or from the input area. Each line in the file or the input area should contain no more than one data word in hexadecimal format. One needs to specify the number of words (10 by default) to be sent as well.



Figure 7: Different modes of sending data from an SVT board to boards downstream.

3. The Python Interpreter

svtGUI provides an interface to all the user level and much of the expert level functionalities of the underlying svtvme library. However, it is impossible for a user interface to meet all the user requirements. This limitation can be overcome in the most efficient way by providing a user-level scripting facility. svtGUI has been largely extended by embedding a Python interpreter. If a feature is found missing, it can be dynamically defined as a Python script and executed by the interpreter using the board handle already in use. One can also define complex board level tests at runtime and execute. Python statements can be executed interactively as well. For example, if one wants to display the last n words of all the buffers of a certain board which is already open one can either type in the following lines in the script area or execute them as a Python script.

# test.py
# One must use 'b' as the board object in Python since the board handle
# is passed from the C side as 'b'
import math
n = 10
print b.what()
print 'Board Test Mode: ', b.isTmode()
spyids = b.getSpyList(20)
for i in spyids:
  print b.isFrozen(i), b.isWrapped(i), b.spyCounter(i)
  if b.isFrozen(i):
    # a great way to print zero padded hex words 
    print map(lambda x: ``%6.6x'' %x, b.readSpyTail(i, n))
  else:
    print 'WARNING: buffer ', i, ' is not frozen!'

The interpreter window is shown in the bottom part of Figures 6, 7. The interactive statements typed in the script area can be saved as a Python script. It is interesting to note that one can open additional boards from the interpreter and operate on them in all possible ways either interactively or using scripts. A trivial example of this use is given below,

  # Be careful not to create the board handle as 'b'
  # for a board opened from the interpreter
  hb = Board(``tstsvt1'', 11, HB) 
  hb.what()
  print hb.printObjects()
  print hb.getRegList(100)
  print hb.getMemList(100)
  print hb.getFifoList(100)
  print hb.getSpyList(100)

The embedded interpreter lacks in one important functionality. The results of the execution of the script go to standard output and standard error and cannot be re-directed to the svtGUI output area. This will be corrected in a future version.

4. Conclusion

svtGUI has proved to be a useful tool to the SVT community as a single-board test-stand. The intuitive user interface implements all the basic functionalities while the Python interpreter embedded within the application meets all the expert level requirements.

5. References

  1. S. Belforte et al., IEEE Trans. Nucl. Sci. 46, 933(1999)
    W. Ashmanskas et al., Nucl. Instr. Meth. A447, 218 (2002)
  2. R. Blair et al. [CDF Collaboration], FERMILAB-PUB-96-390-E
  3. Fision Web site
  4. http://www.corba.org
  5. http://www-cdfonline.fnal.gov/core/cdfvme/index.html
    Userguide for CDFVME Test Stand and Online Software.
    J. Patrick et. al, CDF/PUB/ONLINE/PUBLIC/4624
  6. R. Gordon, Essential JNI: Java Native Interface, Prentice Hall PTR, 1998;
    S. Liang, Java Native Interface: Programmer's Guide and Specification,
    Addison-Wesley, 1999
  7. Python Home Page, Jython Page
  8. Gtk, GNOME pages

Last Modified:
Thu Jun 19 13:01:49 CDT 2003, by Subir