| Data Input |
There is 1 streaming input, which is the
multiplexed1 input from the
TrL module, the RT
module, and the ETV module.
|
||||||||||||||||||||||||||||||||||||
| Configuration and Control Inputs |
|
||||||||||||||||||||||||||||||||||||
| Output |
Unlike all the other modules in the L1 trigger design, this module does not send any output as an Avalon-ST stream. Instead, the L1 FIFO module sends any output information by responding to register read requests. Register read requests are a feature of the DCRC in general, not specific to the trigger. MIDAS (or any computer program which connects to the DCRC via the DCRC's ethernet port using the telnet protocol) sends a code that signals a read request. This is followed by a hexadecimal number indicating the address of the register to read. Then, the DCRC sends back a 16-bit value, which is the response to the read request. Note that, if MIDAS (or other telnet client) needs to obtain some information which is longer than 16 bits, such as a 72-bit set of trigger primitives, then multiple read requests are required. The L1 FIFO module responds to read requests that specify any of seventeen different addresses. Those addresses are listed in the DCRC Register map, and are not reproduced here because they may be subject to future changes. Five of the addresses are used to read out the information (the trigger primitives) that are stored in the trigger FIFO. Three addresses are used to read out the information stored in the veto FIFO. The remaining nine addresses are used to obtain the number of entries in the trigger FIFO, the number of entries in the veto FIFO, the amount of live time accumulated in this series (three registers), the amount of dead time accumulated in this series (three registers), and the number of triggers lost due to dead time. The seventeen register addresses that the L1 FIFO module responds to are as follows:
Note that the five addresses used to read out the trigger FIFO and the three addresses used to read out the veto FIFO all return information from the current FIFO "head". Repeated reads will return the same information. To "pop" either FIFO and move on to the next FIFO entry, write to the respective register addresses listed above. The trigger FIFO length and veto FIFO length registers always contain the number of entries currently in the respective FIFOs. The live-time scaler, dead-time scaler, and lost-trigger counter are set to 0 at the beginning of a data-taking series or when a reset occurs. |
||||||||||||||||||||||||||||||||||||
| Internal Registers |
This module requires some information to be retained from one time step to the next. It will be stored in internal registers. They are mentioned and named here in order to simplify the detailed description of the module's functionality given below. Note that the information in the "live-time scaler", "dead-time scaler", and "lost-trigger counter" internal registers is accessible via register read requests (see the outputs section above).
|
||||||||||||||||||||||||||||||||||||
| Error bits |
The module detects and reports several possible erroneous conditions via a register read. The value read out consists of 16 bits; the most-significant bits are unused.
|
||||||||||||||||||||||||||||||||||||
| Functionality |
Brief description of functionality:
The L1 FIFO module performs three tasks: it stores information needed by the L2 trigger, it provides that information to the L2 trigger via register read requests, and it tracks trigger dead time. The L2 trigger needs this information both to make the L2 trigger decision and to read out each event. The L2 trigger needs the set of trigger primitives associated with each L1 trigger: the peak timestamp, the peak amplitude, the trigger word, and the trigger logic bits (all as described on the Peak Search and Trigger Logic pages). These are stored into a "trigger FIFO" located in the FPGA internal memory, and they can be read by the L2 trigger via register read requests. More details are below. There are some periods of time during which, for a variety of reasons, the L1 trigger is unable to record triggers. There are two sources of trigger dead time: external vetos generated by the ETV module, and overflow of the trigger FIFO (when the trigger FIFO is full, no more L1 triggers can be recorded). At the start and end of every such "veto period", a timestamp and type code will be recorded into a "veto FIFO", also located in the FPGA internal memory. The timestamp will indicate the time at which the veto period started or ended. The type code will indicate whether the timestamp represents the start or end of a veto period as well as some indication about the cause of the veto period. The timestamp and type code can also be read by the L2 trigger via register read requests. More details are below. Each input word either represents an L1 trigger or else it represents a veto start or stop. The L1 FIFO module must identify which is which and write the information to the appropriate FIFO. This determination is based on the trigger word and the peak amplitude. For normal, data-based triggers, the trigger word will have at least one bit set. For veto start/stop inputs, as well as for special purpose triggers (random triggers and external triggers), all the bits of the trigger word will be zeros. If the trigger word is all zeros, then the final determination is made based on the peak amplitude, which will be set to a code indicating the type of input: 0 for random triggers, 1 for veto starts, 2 for veto stops, and 3 or more for external triggers. When a normal trigger, a random trigger, or an external trigger is received, it will be written to the trigger FIFO if we are not in a veto period and if the trigger logic bits are not all zeros. When a veto start or veto stop is received, or when the trigger FIFO becomes full or is emptied again, an entry will be written to the veto FIFO and the "veto state" internal register will be adjusted. When a veto start is received or when the trigger FIFO becomes full, the "veto state" internal register will be incremented. When a veto stop is received or when the trigger FIFO is read out (and therefore no longer full), the "veto state" internal register will be decremented. In addition to recording the beginning and end of each veto period, the L1 FIFO module also tracks the amount of live time and dead time during the series, as well as the number of triggers that were received but not written to the trigger FIFO during veto periods. Each time the least-significant bit of the "current timestamp" changes, the "veto state" internal register is checked. If the "veto state" internal register is zero, then the "live-time scaler" internal register is incremented. If the "veto state" internal register is non-zero, then the "dead-time scaler" internal register is incremented instead. When a trigger is received during a veto period, the "lost-trigger counter" internal register is incremented. These three internal registers can each be read out via register read requests. FIFO Technical DetailsBoth FIFOs, the trigger FIFO and the veto FIFO, are implemented as Altera SCFIFO IP Cores (also known as "lpm_fifo"). This IP Core has the following input signals (that we will use):
Trigger FIFO Technical DetailsFor the trigger FIFO, which stores the trigger primitives, we will use an 80-bit wide FIFO which is 256 entries deep. That is, "lpm_width" will be set to 80, "lpm_numwords" will be set to 256, and "lpm_widthu" will be set to 16. Additionally, "lpm_showahead" will be set to "ON", meaning that the FIFO head will be available on the "q" signal at all times, and thus the "rdreq" signal is only used to pop the FIFO. The trigger FIFO is 80 bits wide because that is the smallest multiple of 16 bits that is large enough to hold a set of trigger primitives (which is 72 bits: 32-bit peak timestamp, 16-bit peak amplitude, 16-bit trigger word, and 8-bit trigger logic bits). Using a multiple of 16 makes it easier set up the FIFO readout registers "Trigger FIFO Words 0-4". When a normal trigger, random trigger, or external trigger is received, the trigger logic bits are checked. As long as at least one of the trigger logic bits is set, then the "veto state" internal register is also checked. If the "veto state" internal register is zero, then the trigger will be written to the trigger FIFO. This is accomplished by setting the "data" signal to the trigger primitives (note that the 8 trigger logic bits are padded with 8 zero bits to fill the trigger primitives out to 80 bits -- this is done to make the register readout slightly easier), and then asserting the "wrreq" signal for one clock cycle. After writing to the trigger FIFO, the trigger FIFO "full" signal will be checked. If the trigger FIFO has become full, then an entry will be written to the veto FIFO and the "veto state" internal register will be incremented. Some of the output registers ("trigger FIFO words 0-4" and "trigger FIFO length") must use information from the trigger FIFO's signals.
The control input register "trigger FIFO pop" uses the trigger FIFO's signals as well. When a write request for the "trigger FIFO pop" register address is received, the "rdreq" signal will be asserted for one clock cycle. This pops the trigger FIFO. Note that, before the trigger FIFO is popped, the trigger FIFO "full" signal will be checked. If the trigger FIFO was full before being popped, then it will no longer be full after being popped, and so an entry will be made in the veto FIFO and the "veto state" internal register will be decremented. Veto FIFO Technical DetailsFor the veto FIFO, which stores the veto period information, we will use a 48-bit wide FIFO which is 256 entries deep. That is, "lpm_width" will be set to 48, "lpm_numwords" will be set to 256, and "lpm_widthu" will be set to 16. Additionally, "lpm_showahead" will be set to "ON", meaning that the FIFO head will be available on the "q" signal at all times, and thus the "rdreq" signal is only used to pop the FIFO. The 48-bit width of the veto FIFO is chosen because it is the smallest multiple of 16 bits that is large enough to hold all the information it needs to store (the 32-bit timestamp plus a few bits for the veto type code). Using a multiple of 16 makes it easier set up the FIFO readout registers "Veto FIFO Words 0-2". When a veto start or veto stop is received from the ETV module, or when the trigger FIFO becomes full or is emptied again, the received timestamp (for external vetos) or the current timestamp (for full-trigger-FIFO vetos), along with the veto type code described above is written to the veto FIFO. This is accomplished by setting the "data" signal to the timestamp and veto type code and then asserting the "wrreq" signal for one clock cycle. Vetos should be rare enough that the veto FIFO will never become full. During testing and early operations at SNOLAB, we will check to see that the veto FIFO does not ever become close to full. If it is not deep enough, then we will increase the veto FIFO depth enough that it will never become full during normal operations. We note that, while there may occasionally be some pathological conditions which would cause the veto FIFO to fill much faster than normal, any data series during which this occurs would almost certainly be marked bad for physics analysis. Furthermore, such a pathological condition would be obvious because the veto FIFO would contain many more entries than normal. Thus, no special handling of a full veto FIFO is needed. Some of the output registers ("veto FIFO words 0-2" and "veto FIFO length") must use information from the veto FIFO's signals.
The control input register "veto FIFO pop" uses the veto FIFO's signals as well. When a write request for the "veto FIFO pop" register address is received, the "rdreq" signal will be asserted for one clock cycle. This pops the veto FIFO. More detailed description (including data transfer information):The L1 FIFO module performs four tasks in parallel. Each of the subheadings below describes a sequences of steps which must be performed when certain events occur, such as an input being received or a register read request being received. The full list of tasks is:
Steps to perform when an input is received:
Steps to perform when the least-significant bit of the "current timestamp" input changes:
Steps to respond to a register read request:As previously mentioned, this module responds to register read requests on 17 different register addresses: 5 register addresses for reading out the trigger FIFO, 3 register addresses for reading out the veto FIFO, 1 register address for the number of entries currently in the trigger FIFO, 1 register address for the number of entries currently in the veto FIFO, 3 register addresses for the live-time scaler, 3 register addresses for the dead-time scaler, and 1 register address for the number of triggers lost due to a full FIFO. Here we describe how the module responds to a read request for each of these addresses.
Steps to handle a register write request:This module takes action based upon writes to two register addresses, one is used to pop the trigger FIFO and one is used to pop the veto FIFO. Note that the value that is "written" to these registers is completely ignored; the action of sending a write request causes the L1 FIFO module to perform some actions. Further note that the telnet client does not expect any response to a write request.
Subroutine to write to the trigger FIFO
Subroutine to record a veto
Reset Signal:When the reset signal is asserted,
|
||||||||||||||||||||||||||||||||||||
| Notes |
|