This library contains a class “DTH” which can be used to access the functionalities of the DTH.
Contents:
A class with high and low level functionalities for the DTH.
The class is derived from the pyHal PCIDevice. Inherited methods from the PCIDevice are not further documented here. But all methods are listed.
The constructor of the DTH class
This constructor needs to have all arguments which the constructor of the PCIDevice C++ class, from which it inherits, has. The reason is that the C++ constructor is called immediately when the python constructor is called and not only when “super()” is called as in pure python classes. Default parameters are set to the correct values for board version p1-v2 (the DTH Kit).
The constructor expects a file “DTH_control_parameters.json” in the working directory holding some essential configuration parameters. An example file is shown here. The entries are mostly self explaining:
{
"sourceIp" : "192.168.01.16",
"destIp" : "192.168.1.100",
"sourcePort0" : 10000,
"destPort0" : 10000 ,
"sourcePort1" : 10010,
"destPort1" : 10000 ,
"FF_CDR" : 1,
"SR0" : 1,
"SR1" : 1,
"FED_ID0" : 1230,
"FED_ID1" : 1231
}
The SRn parameters indicate which of the possible SlinkRocket links are active. For each Slink Rocket link a dedicated TCP/IP stream is set up and hence source and destination ports need to be defined for every link. Each Slink Rocket Link is associated with a FED_ID. FF_CDR stands for FireFly CDR and can be used to explicitely switch on (‘1’) or off (‘0’) the CDR.
Resets the entire DTH logic.
The following components are reset:
Reset if the Slink sender logik in the DTH of the DTH-Kit.
The firmware of the DTH-Kit includes some SlinkRocket sender cores for test purposes (with a loopback-connector). These Slink sender blocks are reset by this function. This logic DOES NOT send a reset to Slink sender cores implemented in other boards (e.g. FEDs). No command is sent via the Slink.
Read some information from the Slink sender Core.
This function sends a “read” command over the Slink Rocket link to the sender core and sends back the result to the DTH.
Parameters: |
|
---|
Write some data to the Slink sender Core.
This function sends a “write” command over the Slink Rocket link to the sender core.
Parameters: |
|
---|
Set up the DTH for loop mode with internal Slink Sender. The Receiver part of the DTH is initialised. This includes the TCP/IP link with the MAC, the logic receiving (and checking) the Slink Rocket data and the FireFlies. In addition the internal SlinkRocket sender of the DTH-Kit is reset.
Start the event generator feeding the SlinkRocket sender of the DTH Kit.
The internal Slink senders of the DTH Kit which are active according to the configuration file, are initialised. The FED_IDs specified in the configuration file are set. The event size is hardcoded to 8000 (dec) words. The time between 2 fragments is set to 10ns. Then the event generator is started.
Stop the internal event generator which feeds the internal Slink Rocket sender of the DTH Kit.
Setup the DTH Slink Receivers,
Performs the following actions:
Enable the Serdes of the MAC for the TCP/IP link.
Set the main parameters if the TCP configuration.
The functions sets the IP numbers (source and destination) and the port numbers (source and destination for all TCP/IP streams) which are defined in the json configuation file (essentially port numbers of the TCP streams and one IP addresses for the source and one for the destination).
Setup the analog parameters of the Serdes of the TCP/IP link.
In particular this function sets the pre and post emphasis and the differential voltage to hardcoded values.
Afterwards the function waits for 2 seconds to let the electronics settle with the new parameters.
Set the FED_IDs of the built-in the SlinkRocket senders.
The FED_IDs for the data generated in the internal event generator which feeds the internal SlinkRocket sender cores of the DTH Kit are set. The numbers are defined in the json configuration file. Only enabled SlinkRocket links are configured.
Send an ARP request and wait for the answer.
Up to 5 ARP requests are sent. After each request the program polls for a reply. If a reply is received the program returns with an error code (see below). If no reply is received after some time another ARP request will be sent out (up to 5 request max).
Returns: |
|
---|
Opens the TCP/IP connections of the enabled SlinkRocket streams.
It sends a connection request to the receiver and waits for the acknowledgement, If the latter does not come withing approximately 20 seconds the connection attempt fails with an error.
Returns: |
|
---|
Close the TCP/IP connections of the enabled SlinkRocket links.
Put the SlinkRocket receiver serdes of the disabled links in loopback mode.
This action is necessary for the clock distribution in the serdes quads of the XILINX FPGAs. In order to not use too many clocking resources the serdes in the quads which are not used are put into loopback mode (at the nead end PCs) so that the clock can be easily recovered also from the links not used and the downstream logic can function correctly.
Set up the FireFly optics.
The following actions are executed:
- The logic is reset. The I2C switches for the I2C chains going to the FireFly logic are reset.
- The FireFlys are enabled.
- The status of al Fireflies is read.
- For each firefly the use of the CDR is configured according to the json configuration file. (Note: For 16Gbps links the CDR is always disabled.)
Check if the SlinkRocket links which are enabled are up.
Send the “DAQ-on” command to all SlinkRocket sender IP cores on enabled SlinkRocket links.
Parameters: |
|
---|
Send the “DAQ-off” command to all SlinkRocket sender IP cores on enabled SlinkRocket links.
The DTH is configured to receive data from a FED.
Parameters: | interactive – if True the program asks the user to hit a key when the FED is configured and ready to send data. Otherwise the method assumes the FED is already configured correctly. |
---|
The following steps are executed in sequence:
The DTH is configured to work with the internal event generators.
Parameters: | interactive – if True the program asks the user to hit a key when the FED is configured and ready to send data. Otherwise the method assumes the FED is already configured correctly. |
---|
The following steps are executed in sequence:
Generate 1 event in the internal event generator (in front of the internal Slink sender).
Parameters: |
|
---|
Generate fragments with the event generator in front of the internal SlinkRocket sender in a loop.
Parameters: |
|
---|
Stop the internal event generator in front of the SlinkRocket sender.
Parameters: |
|
---|
Setup the DTH for usage with the event generators in the SlinkRocket sender IPs connected to the various channels.
The following steps are executed in sequence:
Generate a single event fragment in the event generators of the SlinkRocket IPs.
The fragment parameters are hard-coded: The fragment length is 256 128-bit words; the event number is 1. The FEDIds are set to the values in the json configuration file.
Parameters: |
|
---|
Generate event fragments in a loop in the event generator of selected SlinkRocket sender cores.
The parameters of the event fragments are hardcoded to a length fo 65538 128 bit words, no waiting time between event fragments, and the first event number is ‘1’. FED IDs are set to the values in the json configuration file.
Parameters: |
|
---|
Stop the event generators of selected SlinkRocket sender cores.
Parameters: |
|
---|
A utility function used internally to read out items from the hardware and return them in a dictionary.
Parameters: |
|
---|---|
Returns: | A dictionary with the Status information read from the hardware. |
Function to read status information for the 100G MAC serdes of the DAQ link.
Parameters: |
|
---|---|
Returns: | A dictionary with the Status information read from the hardware. |
Set TCP parameters to specific values or default values.
The default values are hardcoded in the constructor.
Parameters: |
|
---|
Set some analog parameters of the serdes of the DAQ TCP/IP link.
For more details on these values please refer to the Transceiver data sheets.
Parameters: |
|
---|
Set some analog parameters of the serdes of the SR transceiver.
For more details on these values please refer to the transceiver data sheets.
Parameters: |
|
---|
Resets the serdes of the Slink Rocket receiver core.
Send a ping packet over the DAQ link to the receiver NIC in the PC and wait one second.
Generate a sync lost error for test purposes.
This function only works in loop back mode with the internal event generator in front of the internal Slink-Sender core. This function sets the event number of the event generator to 8.
Generate a FED_ID error for test purposes.
This function only works in loop back mode with the internal event generator in front of the internal Slink-Sender core. This function inverts the bits of the FED_ID for the event generator.
Generate a crc errors for test purposes.
This function only works in loop back mode with the internal event generator in front of the internal Slink-Sender core.
Read data from the SlinkRocket channels and “throw them away”.
This enable the user to send data via the Slink Rocket to the Slink Rocket receiver where the packets are tested for CRC errors. However data is not transferred to the DAQ unit in the DTH but dat is “thrown away” after the Slink receiver. Hence no backpressure is created. This allows some basic Slink checks without having a functional DAQ setup.
Resynchronise the SlinkRocket links.
The sequence numbers are reset to 0 in the connceted SlinkRocket sender IPs.
Parameters: | interactive – If True the user is asked for confirmation for each SlinkRocket channel. |
---|
Generic routine to read addresstable items from the hardware adn optionally to some simple operation on them.
Parameters: |
|
---|
Display and color code a value.
A helper function to repetitively display values and mark them in color if they change. A value is compared to a second value and colored differently when the comparsions reveals unequal values.
Parameters: |
|
---|
Helper function to display an array of items and monitor changes.
This function is intended to be used in loops which repetitively read out lists of items from the hardware. The items are displayed and color coded in case the read values change.
Parameters: |
|
---|
Reset some counters related to the 100G MAC.
Monitor some status information of the FPGA.
Temperature and Voltages are read and displayed.
Parameters: |
|
---|
Read and display status information for the SlinkRocket sender core.
Parameters: |
|
---|
Read and display status information for the SlinkRocket serdes (receiver and sender).
Parameters: |
|
---|
Read and display some counters in the SlinkRocket receiver.
Parameters: |
|
---|
Read and display status information from the FireFly optics.
Parameters: |
|
---|
Monitor a list of items until the user presses a key.
Parameters: |
|
---|
Monitor interactively backpressure.