Table of Contents |
---|
This is a short specification document to help the firmware developer engineer to integrate the DaqMux in his firmwarewith the application and the amc-carrier-core.
The DaqMux was originally developed as an oscilloscope to transmit streams from the FPGA to software for debugging purposes. Then it started being used as a data streamer by the application to software, and it's configurations were exported to EPICS/software.
The DaqMux can perform the following functionalities
Figure 1 shows the DaqMux instantiated in the Common platform firmware in the application side.
...
For convenience, everything except for the AppCore is available and instantiated in the amc-carrier-core RTL. That allows the application firmware developer to concentrate on core of the application. Also, there is less margin for error.
Anchor | ||||
---|---|---|---|---|
|
Table 1: DaqMux generics list and description
Generic name | default value | Description |
---|---|---|
TPD_G | 1 | Simulation variable; register clock to output delay in nanoseconds |
DECIMATOR_EN_G | True | Decimator enable |
WAVEFORM_TDATA_BYTES_G | 4 | Output lane width in bytes |
FRAME_BWIDTH_G | 10 | Power of two, which defines AXI stream transaction size in words (4 bytes)(i.e. when FRAME_BWIDTH_G = 12 → 210 x 4 = 4096 bytes) |
BAY_INDEX_G | - | Index of the DaqMux |
N_DATA_IN_G | 16 | Number of input data lanes (N_DATA_IN_G must be between 1 and 29) |
N_DATA_OUT_G | 4 | Number of output data lanes (must be between 1 and 16) |
Table 2: IO port list and description
Category | Name | Direction | Clock domain | Width | Description |
---|---|---|---|---|---|
Clock & reset logic | axiClk | Input | - | 1 | AXI Lite clock |
axiRst | Input | axiClk | 1 | AXI Lite reset | |
devClk_i | Input | - | 1 | Development clock | |
devRst_i | Input | Synced to devClk_i in DaqMux (for some reason) | 1 | Development logic reset | |
wfClk_i | Input | - | 1 | Ouput lanes' clock | |
wfRst_i | Input | wfClk_i | 1 | Output lanes' reset | |
DaqMux control signals and timing information | trigHw_i | Input | Synced to devClk_i in DaqMux | 1 | Trigger signal to start the DaqMux streaming
|
trigCasc_i | Input | Synced to devClk_i in DaqMux | 1 | Cascaded trigger input. Can be used along with trigHw_i when enabled in the register file
| |
trigCasc_o | Output | devClk_i | 1 | Output trigger signal connected to the SW Trigger Enable control register
| |
armCasc_i | Input | Synced to devClk_i in DaqMux | 1 | Cascaded trigger Arm. Arms the trigger and prepares DaqMux for trigger arrival
| |
armCasc_o | Output |
devClk_i | 1 | Output cascade signal connected to the Arm HW Trigger control register
| |||
freezeHw_i | Input | Synced to devClk_i in DaqMux | 1 | Adds invalid flag to the streams that are forwarded, and they will be discarded in one of the posterior blocks in the pipeline
| |
timeStamp_i | Input | Synced to devClk_i in DaqMux | 64 | Time stamp coming from the AMC carrier core | |
bsa_i | Input | Synced to devClk_i in DaqMux | 128 | BSA information coming from the AMC carrier core | |
dmod_i | Input | Synced to devClk_i in DaqMux | 192 | Dmod timing information coming from the AMC carrier core | |
AXI Lite register memory mapped interface for reading and writing to register file | axilReadMaster | Input | axiClk | 1 | AXI Lite record containing Read Address channel
Read data channel
|
axilReadSlave | Output | axiClk | 1 | AXI Lite record containing Read Address channel
Read data channel
| |
axilWriteMaster | Input | axiClk | 1 | AXI Lite record containing Write address channel
Write data channel
Write ack channel
| |
axilWriteSlave | Output | axiClk | 1 | AXI Lite record containing Write address channel
Write data channel
Write ack channel
| |
Input lane array - data valid based | sampleDataArr_i | Input | devClk_i | N_DATA_IN_G | Input data stream array of 32-bit words |
sampleValidVec_i | Input | devClk_i | N_DATA_IN_G | Input valids with each valid corresponding to the respective stream in that cycle | |
linkReadyVec_i | Input | devClk_i | N_DATA_IN_G | Indicate that the stream source is ready. If is 0, the DaqMux sets the Stream Error control register to 1. | |
| rxAxisMasterArr_o | Output | wfClk_i | N_DATA_OUT_G | AXI compliant output data stream array of 32-bit words. Nonetheless, the type of rxAxisMasterArr_o is defined as follows in the AxiStreamPkg.vhd file
|
rxAxisSlaveArr_i | Input | wfClk_i | N_DATA_OUT_G | AXI streams data ready signals | |
rxAxisCtrlArr_i | Input |
Synced to devClk_i in DaqMux | N_DATA_OUT_G | AXI stream control signals as follows
If pause is 1, the DaqMux will not start and error is set. |
...
Represents status(DONE_C) signal in the AxiStreamDmaRingWrite module of the waveforEngine. Not clear what is the meaning of this flag. Found this comment in that module
|
Table 3: DaqMux register address mapping and description
Register name | Address | Access | Bits | Alias | Description |
---|---|---|---|---|---|
Control | 0x0 | RW | 0 | SW Trigger Enable | Triggers DAQ on all enabled channels. Must be set to 1, then set to 0 again. |
1 | Cascade Trigger enable | Enabling/disabling cascaded trigger
| |||
2 | Auto Rearm HW Trigger | Enabling/disabling hardware automatic trigger. If disabled it has to be rearmed by Arm Hw Trigger
| |||
3 | Arm HW Trigger | Arms the hardware trigger on rising edge. After trigger occurs the trigger has to be rearmed using this register. | |||
4 | Trigger Clear Status | Trigger status will be cleared (On the rising edge). | |||
5 | Daq Mode | Select the data acquisition mode ( Stream stops if Error occurs )
| |||
6 | Packet Header Enable | Add 128-bit header (otherwise only data will be inserted)(Applies only to Triggered mode only)
| |||
7 | SW Freeze Buffer | Freezes all enabled circular buffers | |||
8 | HW Freeze Buffer Enable | Enabling/disabling hardware freeze buffer request
| |||
Status | 0x1 | RO | 0 | Software Trigger Status | Software Trigger Status (Registered on first trigger until cleared by Trigger Clear Status - Control[4] ). |
1 | Cascade Trigger Status | Cascade Trigger Status (Registered on first trigger until cleared by Trigger Clear Status - Control[4] ) | |||
2 | HW Trigger Status | Hardware Trigger Status (Registered on first trigger until cleared by Trigger Clear Status - Control[4] ) | |||
3 | HW Trigger Armed Status | Hardware Trigger Armed Status (Registered on rising edge Arm HW Trigger - Control[3] - and cleared when hardware trigger occurs ) | |||
4 | Combined Trigger Status | Combined Trigger Status (Registered when trigger condition is met until cleared by Trigger Clear Status - Control[4] ) | |||
5 | Freeze Buffers Status | Freeze buffer occurred (Registered on first freeze until cleared by Trigger Clear Status - Control[4] ) | |||
Decimation | 0x2 | RW | 15:0 | Decimation Rate Divisor | Sample rate divider (Decimator):
|
|
|
|
|
|
DataSize | 0x3 | RW | 31:0 | Data Buffer Size |
Number of 32-bit words to forward at each trigger (Ignored in continuous mode) (if enabled header will be included in the first 14 words of data). Minimum size is 14 (the size of the header). | |||||
TimeStamp | 0x4 | RO | 31:0 | Timestamp[31:0] | Timestamp [31:0] - secPastEpoch |
0x5 | RO | 31:0 | Timestamp[63:32] | Timestamp [63:32] - nsec | |
BSA | 0x6 | RO | 31:0 | bsa(0) | edefAvgDn |
0x7 | 31:0 | bsa(1) | edefMinor | ||
0x8 | 31:0 | bsa(2) | edefMajor | ||
0x9 | 31:0 | bsa(3) | edefInit | ||
TrigCount | 0xA | RO | 31:0 | Trigger Count | Counts valid data acquisition triggers |
DbgInputValid | 0xB | RO | 31:0 | Debug Input Valid | All DaqMux AXI input streams valid signals |
DbgLinkReady | 0xC | RO | 31:0 | Debug Link Ready | All DaqMux AXI input streams ready signals |
InputMuxSel | 0x10 | RW | 4:0 | Input Mux Select[0] | 0x1x: Stream x: Channel select |
Multiplexer 0 - Disabled, 1 - Test, 2 - Ch0, 3 - Ch1, 4 - Ch2 etc.(up to Ch29) Test mode will output counter data | ||
0x11-0x1E | 4:0 | Input Mux Select[1] |
-[14] |
0x1F | 4:0 | Input Mux Select[ |
15] |
DaqStatus | 0x20- |
0x2F (one register for each of the 16 (enabled) lanes) | RO | 0 | Stream Pause |
(rxAxisCtrlArr_i port signal) Raw diagnostic stream control pause (Waveform engine bufferDone signal. When an AXI frame is completely written to DRAM, this bit is set) | ||
1 | Stream Ready | Debug flag: Raw diagnostic stream control Ready (Waveform engine FIFO output stream ready signal) |
2 | Stream Overflow |
(rxAxisCtrlArr_i port signal) Raw diagnostic stream control Overflow (set to 0 in waveform engine) | ||
3 | Stream Error | Debug flag: Error during last Acquisition (Raw diagnostic stream control Ready or incoming data valid dropped) |
4 | Data source ready | Debug signal: The data source is ready. If not, DaqMux sets error signal to 1 |
5 | Stream Enable | Debug signal: Output stream enabled |
31:6 | Frame Count | Number of 4096 word frames sent |
DataFormat | 0x30- |
0x3F (one register for each of the 16 (enabled) lanes) | RW | 4:0 | Sign Bit Position | Indicating sign extension point (all bits after sign bit will be overwritten with sign) |
5 | Data Width | Data width 32-bit or 16-bit
| ||
6 | Sign enable | Signed/unsigned
| ||
7 | Decimation Averaging Enable | Decimation Averaging
|
The DaqMux has two data acquisition (Daq) modes: Trigger mode and continuous mode. You may think that continuous mode does not need a trigger, but The names are deceiving because both modes need a trigger to operate. A more appropriate description maybe may be automatic (continuous) and manual (trigger) modes. Read through the following section to dive further.
The
Trigger mode allows the user to also see a header in the beginning of each acquired packet.
Data Header structure
...
The DaqMux block diagram is shown in Figure 2.
Figure 2: DaqMux Block diagram
The block diagram is composed of the following blocks:
A state machine diagram of the DaqMux operation is shown in Figure 3. For more detailed explanations, see the following sections.
Figure 3: DaqMux operation state machine
As mentioned earlier, the continuous mode multiplexes raw data, and outputs either the raw data or the down sampling with or without averaging. It is activated with a trigger, and terminated upon error or lane disabling. After termination a new trigger is required. detailed state transition is described as follows:
The continuous mode starts in the presence of all of the following conditions
And one of the following conditions:
In the stream data state one of the following is transmitted from the multiplexed lanes
In continuous mode, the stream state is exited in the following conditions
The trigger mode multiplexes raw data, and outputs a burst number of words upon trigger arrival. The bust may or may not contain a header (not available in continuous mode), and the burst data can be either the raw data or the down sampling with or without averaging. It is activated with a trigger, and terminated upon error . After termination a new trigger is required. detailed state transition is described as follows:
The continuous mode starts in the presence of all of the following conditions
And one of the following conditions:
In the stream data state a burst of predefined number of the following is forwarded
The stream state is exited in the following conditions
The header data is 14 32-bit words as follows:
The maximum clock frequency has not been evaluated, nonetheless, this logic was used with clock frequencies as follows
As mentioned earlier, the AppTop which contains the DaqMux is already instantiated. The firmware application developer will need to develop the APPCore. The following (just informative) DaqMux ports are routed to the waveform engine in the amc-carrier-core, where the rest of the magic moving this data to the DRAM and from the DRAM to the CPU memory happens.
Signals timngStamp_i , bsa_i, and dmod_i come from the timingTrig record that is also provided by the amc-carrier core.
The signals that the application firmware developer needs to worry about are as follows:
LinkReady signals: Mapped to valids of all stream except for debug