Trip stack

The trip stack provides logic that records the type and time of trips. This logic is generic in the sense that it is used regardless of the target system – powered, SC, passive, etc. As such it is instantiated outside of the powered-system logic in the top level near the host interface module. Connections are made to the trip stack depending on the target. The time stamp consists of 41 bits, 10 bits for the clock count following a bunch fiducial, and 31 bits counting bunch fiducials. In NSLS-II this resolves to a clock cycle in about eight hours.

Host software reads out the stack through a 48-bit block of three 16-bit wire outs (TSWord0, TSWord1, and TSWord2), five discrete wire ins (, and two trigger ins. One of the discrete bits indicates whether the logic is armed and able to acquire, and the other four indicate the number of unread events recorded. The logic is disarmed during readout. Readout is performed by repeatedly by reading out the three 16-bit wire outs and pulsing one of the trigger ins to advance the events in the stack. The second trigger in is pulsed to arm the logic when readout is completed or to rearm without readout.

The bulk of the logic is implemented in the module TripStack.v. The Matlab function TripStack.m returns the current value of the armed bit, the current number of recorded events, and when requested, a pretty printed list of sources and time stamps of the events.

The number of trip sources is currently configured at eight. This number can be readily changed to another power of two with a corresponding change in the number of bits in the bit fields of the event record. So if the number is increased by double from eight to 16, then the number of bits in the time stamp field is decreased by one to a total range of about four hours instead of eight.