WR Streamers
WR Streamers provide to the user a FIFO-like interface over Ethernet. WR Streamers comprise of two VHDL modules to send and receive data:
- TX steamer takes a series of data words and encapsulates them into Ethernet Frames
- RX streamer does the opposite: decodes Ethernet frames into series of data words
User interface of a TX-RX streamer pair looks like a typical FIFO, with an Ethernet link inside.
Streamers principles of data transfer
- Streamers transfer data words that are of width (n * 16) bits. The width is defined by generic g_data_width that must be identical for the Tx and Rx Steamer.
- Data words can be grouped in blocks of any size with upper limit defined by g_tx_max_words_per_frame, each block has independent sequence number and CRC.
- A stream of data words arranged in one or more blocks is prepended with Streamer Header and encapsulated into a single Ethernet Frame
- Ethernet Frame is sent when one of the following is true:
- a complete block was written to the Tx Buffer of the Tx Streamer, and the number of data words waiting for transmission exceeds the number defined by generic g_tx_threshold
- there are data words in the Tx Buffer, and the time elapsed from the latest write to Tx Streamer exceeded timeout defined by generic g_tx_timeout
- the user explicitly requested transmission the data currently in the Tx Buffer by asserting tx_flush_i
Encapsulation of data words and blocks into Ethernet Frame
The data words that are written to Tx Streamer are grouped into
blocks* of the size defined by the user. Each block has its own
sequence number and CRC.
A collection of blocks is pre-pended with timestamp of transmission
time and sent in the payload of an Ethernet Frame, as depicted in the
figure
below.
Interface of Tx and Rx Streamer modules
To use streamers, the user is required to
-
define configuration of transmission using VHDL generics:
- g_data_width - must be identical for the Tx and Rx Streamer, it defines the width of input/output data in (n*16) bits.
- g_tx_threshold - minimum number of data words in the TX buffer that will trigger transmission of an Ethernet frame.
- g_tx_max_words_per_frame - maximum number of data words in a single Ethernet frame. It also defines the maximum block size.
- g_tx_timeout - transmission timeout (in clk_sys_i cycles), after which the contents of TX buffer are sent regardless of the amount of data that is currently stored in the TX Buffer, so that data in the buffer does not get stuck.
- g_buffer_size - size of RX buffer in the Rx Streamer, in data words.
- g_filter_remote_mac - when it is TRUE, the Rx Streamer receives only packets whose destination MAC equals cfg_mac_remote_i. When false. accepts all incoming frames.
-
provide networking configuration to the following inputs of Tx and
Rx Streamer:
- cfg_mac_local_i - Local MAC address. Leave at 0 when using with the WR MAC/Core, it will insert its own source MAC.
- cfg_mac_target_i - Destination MAC address
- cfg_ethertype_i - Ethertype of Streamer Frames. Default value is accepted by standard configuration of the WR PTP Core
-
provide WR timing (optional, to allow latency measurement):
- clk_ref_i - White Rabbit reference clock
- tm_time_valid_i - Time valid flag
- tm_tai_i - TAI seconds
- tm_cycles_i - Fractional part of the second (in clk_ref_i cycles)
- *write to the Tx Streamer and read from the Rx Streamer data words
using the interfaces in the tables and figure below.
*
/4216
Tx Streamer*
| * I/F name | Description *|
| tx_data_i | Input data word of generic width to be sent by the
Tx Streamer|
| tx_valid_i | HIGH indicates that the tx_data_i contains a valid
data word* |
| tx_dreq_o | Synchronous data request: HIGH indicates that the Tx
Streamer can accommodate a data word in the following clock cycle
|
| tx_last_i | Last data word signal. When asserted, it indicates
the last data word in a block |
| tx_flush_i | Flush input. When asserted, the streamer will
immediately send out all the data that is stored in its TX buffer,
ignoring g_tx_timeout. |
| tx_reset_seq_i | Reset sequence number. When asserted, the internal
sequence number generator used to detect loss of frames is reset to 0.
Advanced feature. |
Rx Streamer*
| * I/F name | Description *|
| rx_data_o | Output data word of a generic width received by the
Rx Streamer |
| rx_valid_o | HIGH indicted that rx_data_o is outputting a valid
data word*. |
| rx_dreq_i | Synchronous data request input: when HIGH, the streamer
can output another data word in the subsequent clock cycle. |
| rx_first_o | HIGH indicates the 1st data word of the block
on rx_data_o. |
| rx_last_o | HIGH indicates the last word of the data block on
rx_data_o. |
| rx_lost_o | Lost output: HIGH indicates that one or more of
blocks* have been lost. |
| rx_latency_o | Latency measurement output: indicates the transport
latency (between the TX streamer in remote device and this streamer), in
clk_ref_i clock cycles. |
| rx_latency_valid_o | HIGH when the latency on rx_latency_o is
valid. |