SLAC PEP-II
BABAR
SLAC<->RAL
Babar logo
HEPIC E,S & H Databases PDG HEP preprints
Organization Detector Computing Physics Documentation
Personnel Glossary Sitemap Search Hypernews
Unwrap page!
Det. Search
Who's who?
Meetings
FAQ
Images
Archive
Systems
Performance
Intern. region
Vertex Tracker
Drift chamber
DIRC
Calorimeter
IFR
LST
Magnet
Electronics
Trigger
Operations
Run Coordination
Contact Experts
Shift Takers Info
Operations Manual
Electronic Logbook
Ops Hypernews
Shift Signup
Check this page for HTML 4.01 Transitional compliance with the
W3C Validator
(More checks...)

ZPD test library command reference

[Getting Started]  [Basic Commands]  [Basic Tests]  [Algorithm Tests]  [Diagnostic Mem]  [TSF → ZPD]  [LUTs]  [Crate Map]  [L1DctTeststand Commands

Getting Started

Checking out and compiling the libraries

Loading the libraries in a ROM:
< /detector/trg/zpd/zpdlib Load the library at the teststand
< zpd/zpdlib Load the library at IR2
slot n Set the slot number for subsequent commands

If the load library command indicates a crate map problem, see the crate map section below.


Basic Commands

slot n Send commands to board in slot n
slotmask mask Set slot mask. Use this to write to multiple boards. Multiple board reads are not supported.
setblock n Set memory block number
r16 addr, nwords 16-bit word read
r32 addr, nwords 32-bit word read
w16 addr, value 16-bit write
w32 addr, value 32-bit write
wb16 addr, nwords, v0, v1 ... 16-bit block write (up to 10 words)
wb32 addr, nwords, v0, v1 ... 32-bit block write (up to 10 words)
setrun mode set run mode (0=off, 1=run mode)
setonce mode set oneshot mode (0=continuous, 1=oneshot)
startmem Send startmem command
setled value Set LEDs
showled [n] Show LED value, repeating n times
showleds slotmask Show LED values from boards in the slotmask (useful for testing dlink phases of multiple boards)
userst Send User Reset (0x1e)
dcmreset Send Reframe / DCM-reset command (0x14)
clr addr, nwords, [value] Clear memory
gomem Shortcut for setrun 1; startmem; setrun 0
enablemem mask Set CSR3 bits
wrcsr n, value Write CSR n
rdcsr n Read CSR n

ZPD Super Test

zpdtest will run a series of tests on each ZPD (memory, bus, consistency, algorithm, dlink phase).


Basic Tests

memtest addr, nword, [longWord], [randSeed] Write/read random numbers to/from specified memory
diagmemtest [verbose] Write/read random numbers to/from diagnostic memories
megabustest [verbose] Test Decoder/Driver → Finder/Fitter connectivity across Megabus
frbustest [verbose] Test Finder/Fitter → Decision Module connectivity across fit results buses
basictest [slot] Performs the diagnostic memory test, the megabus test, and the frbustest. Use no arguments (i.e. slot=0) to autodetect and test all boards in the crate; use slot=-1 to test slot 0.
ledtest mask, loop, maxerr Write and read LED values for boards in slots given by the mask. This tests whether the dlink outputs from each board are in phase.
zpdver Check the ZPD firmware versions

Algorithm Tests

ZPD algorithm tests

algotest ["filename"], [source], [dest], [nTicks]

The source file is generated using L1Zpdtools/L1ZpdSimuDump. Source and destination are numeric codes for the ZPD diagnostic memories:

0 - Input segments
1 - Megabus (in Finder/Fitter)
2 - Finder results
3 - Fitter results
4 - Combined Fitter results (in Decision Module)
5 - Decision bits output

e.g. to test the algorithms from the input segments through the Fitter results,

algotest "algotest.txt",1,4

Simply running algotest is equivalent to running algotest "algotest.txt",1,5

Input test vector files are generated with L1ZpdTools/zpdSimuDump.

Algorithm tests with and without IP corrections

algotest.txt has IP corrections turned off; algotest_ipcorr.txt has IP=(0.1, 0.3) turned on. If you need to change the IP corrections , you can regenerate the test vector file with the -i <IPx> <IPy> option of L1ZpdTools/zpdSimuDump.

TSF algorithm tests

tsfalgotest "filename", [nEvents], [offset], [verboseIn], [verboseOut]

TSF → ZPD algorithm tests

This test requires the ZPDs and the TSFs to be the in the same crate or in two different crates controled by the same ROM on links A and B. Load a crate map which describes which boards are where and how they are connected. Then run:

fullalgotest "filename", [nEvents], [tsfOutOffset], [zpdInOffset], [zpdFitOffset]

For each event, this will test TSF in → TSF out first. If that passes, it will check the ZPD input memory. If that passes, it will check the ZPD fit results. If any stage has an error, the difference between expected and found will be printed and the test will move onto the next event.


Diagnostic Memory Interpretation

These commands read diagnostic memories and print the results in human readable formats.

zseg [nTicks] Prints the hex values of the segment data in memory, formatted by superlayer, sector, and order.
zsegmem [firstTick], [lastTick] Prints the segment data decoded into cell location, phi, and dphi ordered by superlayer, sector, and order.
findermem [firstTick], [lastTick] Prints the decoded finder results
fittermem [firstTick], [lastTick] Prints the decoded fitter results


TSF → ZPD Utilities

[There are more; this needs to be updated]
tplayin "filename", nEvents, [offset], [verbose] Load simulation data into the TSF input memory and play it.
tplayout "filename", nTicks Load simulation data into the TSF output memory and play it.
tzp [nLoops], [verbose] Random number TSF output → ZPD input test.

Reading / Writing / Checking LUTs

XtcAscii format LUT files are produced by the dumpZpdLut program in the L1DctConfig package. The following commands can read and write files in this format for loading, dumping, or checking the LUTs in the hardware:
zcheckluts "filename", [maxerr] Compare ZPD LUT contents with the values in the file. e.g.
zcheckluts "./DczConfig/zpd/zpdFinder.lut"
zloadluts "filename" Load the ZPD luts from the text file.
zdumpluts "filename" Dump the ZPD hardware LUT contents into a file.
zdumpgenluts "filename" Dump just the generic LUTs.
zdumpfinderluts "filename" Dump just the Finder LUTs.
zdumpfitterluts "filename" Dump just the Fitter LUTs.
zdumpdmluts "filename" Dump just the Decision Module LUTs.
showcuts Print out the Decision Module cuts

Crate Map

Crate maps are text files which contain information about which boards are where. The format for each line is: board num crate slot. The "crate" column is currently unused.
Example ZPD map file:
zpd  0  0  3
zpd  1  0  5
zpd  2  0  7
blt  0  0  10
TSF map file:
tsfx  0  0  3
tsfx  1  0  5
tsfy  0  0  7

The crate map commands are:
makemap Scans the crate and makes a map of what is found
ldmap "mapName" Load a crate map file
printmap Print the current crate map in the crate map file format
showmap [crate] Show the current crate map in a human friendly format
showcrate [linkb] Show what is actually in the crate by scanning the slots and reading CSR bits
checkmap [linkb] Compare the map with what is found in each slot
clearmap Removes all entries from the map
mapAddZpd sector slot Add a ZPD to the crate map
mapAddTsfx sector slot Add a TSFx to the crate map
mapAddTsfy sector slot Add a TSFy to the crate map


L1DctTeststand Commands

A few useful L1DctTeststand commands:
zpdCheck Consistency check of ZPD basic parameters and version numbers
zpdLoadXtc "file.xtc" Load an xtc file into ZPD memory (e.g. zpdLoadXtc "./DczConfig/zpd/zpdIpCorr.lut")
configTsfs tsfxmask, tsfymask Run the TSF configuration code without needing to load fcgui, etc.