WR Streamers
WR Streamers provide to the user a FIFO-like interface over Ethernet. WR Streamers comprise of 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
Streamers principles of data transfer
- Tx Streamer 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 encapsulated into an Ethernet Frame. At transmission, the frame is timestamped and the timestamp included in the frame.
- Ethernet Frame is sent when one of the following is true:
- a complete block was written to the 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 buffer of the Tx Streamer, and the time elapsed from the latest write to Tx Streamer exceeded timeout defined by generic g_tx_timeout,
- the user asserts tx_flush_i to explicitly request transmission of the data that has been written to the buffer of the Tx Streamer.
Encapsulation of data words and blocks into Ethernet Frame
The number of data words grouped into blocks is specified by the
user who indicates the last data word. Inside the frame, each
block* ends with a CRC and an escape code (0xCAFE).
The Streamer Frame consists of a transmission timestamp and a collection
of blocks, it is sent in the payload of an Ethernet Frame, as
depicted in the figure below.
Each block starts with an ID number
- the ID number of the block that immediately follows the Ethernet Header, is the sequence number of the frame
- the ID number of the subsequent blocks, is the inter-frame sequence number of the block*
Interface of Tx and Rx Streamer modules
-
Transmission configuration:
- g_data_width - generic defines the width of input/output data in (n*16) bits, it must be identical for the Tx and Rx Streamer.
- g_tx_threshold - generic defines minimum number of data words in the buffer of the Tx Streamer that will trigger transmission of an Ethernet Frame.
- g_tx_max_words_per_frame - generic defines maximum number of data words in a single Ethernet Frame. It also defines the maximum block size.
- g_tx_timeout - generic defines transmission timeout (in clk_sys_i cycles), after which the content of the buffer in the Tx Streamer is sent regardless of the amount of data that is currently stored in the buffer, so that data in the buffer does not get stuck.
- g_buffer_size - generic defines size of the buffer in the Rx Streamer, in data words.
- g_filter_remote_mac - generic, when it is TRUE, the Rx Streamer receives only packets whose destination MAC equals cfg_mac_remote_i. When false, it accepts all incoming frames.
-
Networking configuration (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
-
WR timing input (optional, to allow latency measurement, Tx and Rx
Streamer):
- 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)
-
FIFO-like interface (Tx and Rx Streamer):
- the figure and tables below provide information on interfaces that are used to write data words to the Tx Streamer and read data words from the Rx Streamer
- waveform with the described signals is available here:
/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. |
More information:
- White Rabbit PTP Core Hands-on Training materials that uses WR Streamers (see these slides from day 1 and day 2)
- Applications:
Features to be added in future:
- configurable delay of publishing data received by rx_streamer, so that the latency between transmission and reception is fixed at ns-level
- statistics: number of lost frames, avg/max/min latency
Project Status
Date | Event |
2013-03-15 | Streamers developed for White Rabbit Core Hands-on Training by Tom |
2016-03-07 | Tom's streamers included into wr-cores proposed_master and documented with a wiki page (now can be found here) |
2016-03-31 | Layout of streamer's frame modified slightly to make it backward compatible with the version used in B-train, wiki updated |
4 March 2016