HotRIO master rx

This module receives HotRIO packets from the PCS and checks the parity bits. The module outputs the received packet and the parity error flag.

Ports

Name

Mode

Description

Type

clk_i

IN

Input clock signal, must be connected to the RX clock of the PCS

std_logic

rstn_i

IN

Active-low reset signal, synchronized to the clock internally

std_logic

rx_pcs_data_i

IN

8-bit interface from the PCS

std_logic_vector(7 downto 0)

rx_pcs_kchar_i

IN

k-character flag

std_logic

hotrio_packet_o

OUT

Contains the HotRIO packet received

hotrio_packet_t*

packet_new_o

OUT

Flag that indicates that a packet has been received, even if not valid

std_logic

packet_valid_o

OUT

Flag that indicates that a valid packet has been received and is available in the hotrio_packet output

std_logic

pulse_2us_o

OUT

Pulse that signals that a “2us” marker has been received

std_logic

pulse_1ms_o

OUT

Pulse that signals that a “1ms” marker has been received

std_logic

pulse_1s_o

OUT

Pulse that signals that a “1s” marker has been received

std_logic

sync_o

OUT

High when the internal state machine is synchronized with the incoming data

std_logic

cnt_err_kchar_o

OUT

Counts the k-character errors, when an unexpected k-char is received

std_logic_vector(CONFIG_DATA_WIDTH - 1 downto 0)**

cnt_err_data_o

OUT

Counts the data errors, for example for when a non-HotRIO marker is received

std_logic_vector(CONFIG_DATA_WIDTH - 1 downto 0)**

cnt_err_hrio_pid_o

OUT

Counts the number of non-HotRIO frames received

std_logic_vector(CONFIG_DATA_WIDTH - 1 downto 0)*

cnt_err_parity_o

OUT

Counts the number of parity errors detected

std_logic_vector(CONFIG_DATA_WIDTH - 1 downto 0)*

cnt_packets_received_o

OUT

Counts the amount of packets received (even if with errors)

std_logic_vector(CONFIG_DATA_WIDTH - 1 downto 0)*

cnt_valild_packets_received_o

OUT

Counts the amount of valid HotRIO frames received

std_logic_vector(CONFIG_DATA_WIDTH - 1 downto 0)*

* Defined in the Globals package

Dependencies

Name

Motivation

globals

Types definition and HotRIO constants

signal_cdc

Used to synchronize the reset signal to the internal clock domain

Implementation details

This module is implemented in a single state machine.

The state machine consists on seven states: SYNC, MARKER, PROTOCOL_ID, FRAME_ADDRESS, FRAME_PAYLOAD, FRAME_CONTROL and WAIT_FRAME.

The state machine starts in the SYNC state. In this state, the module waits for a HotRIO marker as defined in the global package. While in this state, the sync_o is kept to zero. If a k-character is received in states other than SYNC or MARKER, a check is implemented that flags an error and the SYNC state is selected. This will not be specified in the description of the various states as it’s the same for every one.

The MARKER state is used when the state machine is synchronized with the incoming data, it checks the received marker and if it matches drives the corresponding pulse output. If a non-HotRIO marker is received, the cnt_err_data counter is incremented and the SYNC state selected.

The PROTOCOL_ID state checks that the incoming packet is an HotRIO packet. If the protocol ID is correct, the state machine moves to the FRAME_ADDRESS state. However, if the protocol is not recognized, the WAIT_FRAME state is selected.

The WAIT_FRAME state is used when a non-HotRIO frame is received. During this state all the received data is forwarded without alteration. The length of the frame is not specified, it waits for a k-character. If a valid HotRIO k-character s received, the PROTOCOL_ID state is selected. If an unknown k-character is received, the SYNC state is selected.

In the FRAME_ADDRESS state, the address of the frame is received.

The FRAME_PAYLOAD state is used to receive the payload of the HotRIO packet byte-by-byte. A counter is used to keep track of the bytes received, the number of bytes in a HotRIO packet is defined in the global package as HOTRIO_BYTES_IN_PACKET.

The last state is the FRAME_CONTROL. In this state, the control byte is received. This byte contains the parity bits of the HotRIO packet that are checked against the generated bits to detect errors. The hotrio_packet output is updated with the received data even if an error has been detected. The packet_valid flag is asserted if the packet is valid, however, the packet_new flag is asserted in any case.

../../_images/hotrio_master_rx_sm.png

Note

The diagram of the state machine doesn’t contain the state transitions in case of error from all the states to SYNC. Moreover, the transitions names don’t correspond to the real signals names.