![]() |
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.
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.
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.
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
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.
The global status window, which is displayed by default when svtGUI is started, consists of the following elements as shown in Figure 2,
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.
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.
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.
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.
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.
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,
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.
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.
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.