Developer Guide

Intel oneAPI DPC++/C++ Compiler Handbook for Intel FPGAs

ID 785441
Date 5/08/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Host Pipes RTL Interfaces

This section provides a summary of interfacing with host pipes in your IP based on the choice of protocol.

Host pipes support Avalon® streaming and memory-mapped interfaces. Refer to the Intel® Avalon Interface Specifications for details about these protocols.

For Avalon® memory-mapped protocols, register addresses in the CRA are specified in the generated kernel header file in the project directory. Refer to Register Map Header File for further details on CRA agent registers.

protocol_name::avalon_streaming_uses_ready

This is the default protocol.

This protocol allows the sink to backpressure by deasserting the ready signal. The sink signifies that it is ready to consume data by asserting the ready signal. On the cycle where the sink asserts the ready signal, the source must wait for the ready_latency signal to cycle before responding with valid and data signals, where the property specifies the ready_latency in the host pipe declaration.

Host-to-Device Pipe

When the uses_valid property is set to false and the ready signal is asserted by the kernel and sampled by the host, the host must wait ready_latency cycles before the value on the data interface is sampled by the kernel and consumed.

When the uses_valid property is set to true and the ready signal is asserted by the kernel and sampled by the host, the host must wait ready_latency cycles before inserting the valid signal. The data interface is not sampled or consumed by the kernel until the valid signal is asserted.

Device-to-Host Pipe

When the uses_valid property is set to true and the host asserts the ready signal, the kernel replies with valid=1 and qualified data (if available) ready_latency cycles after the corresponding ready was first asserted.

When the uses_valid property is set to false and the host asserts the ready signal, the kernel replies with qualified data ready_latency cycles after the corresponding ready was first asserted.

protocol_name::avalon_streaming

With this choice of protocol, the ready signal is not exposed by the host pipe, and the sink cannot backpressure.

The valid signal qualifies data transfer from source to sink per cycle when the uses_valid property is set to true. When the uses_valid property is set to false, the source implicitly provides a valid output on every cycle, and the sink assumes a valid input on every cycle.

Host-to-Device Pipe

When the uses_valid property is set to false, the kernel samples and processes the value on the host pipe data interfaces on each cycle.

When the uses_valid property is set to true, the kernel samples and processes the value on the host pipe data interface on each cycle that the valid signal is asserted.

Device-to-Host Pipe

When the uses_valid property is set to false, the host must sample and process values on the host pipe data interface every clock cycle. Failure to do so causes the data to be dropped.

When the uses_valid property is set to true, the host must sample and process values on the host pipe data interface every clock cycle that the valid signal is asserted. Failure to do so causes the data to be dropped.

protocol_name::avalon_mm

With this protocol, an implicit ready signal is held high, and the sink cannot backpressure.

The uses_valid property must also be set to true. Both the valid and data signals for the pipe are stored in registers implemented in the CRA agent.

Device-to-Host Pipe

Because the sink (host) cannot backpressure, data must be immediately consumed when it is available or it might be lost.

For an RTL IP core kernel, the surrounding system should be carefully architected to ensure that read timing is in sync with write timing for the IP without handshaking. Simulating such designs in the HLS flow might result in undefined behavior because the generated testbench might not be able to guarantee this timing.

Host-to-Device Pipe

The host writes a 1 to the valid register to indicate that the value in the data register is qualified. When the kernel has consumed this data, the kernel automatically clears the value in the valid register. A cleared valid register signifies that the host is free to write a new value into the data register.

protocol_name::avalon_mm_uses_ready

With this protocol, an additional register in the CRA is created to hold the ready signal. You must set the uses_valid property to true.

Host-to-Device Pipe

The kernel writes a 1 to the ready register when it is available to receive data. The host writes a 1 to the valid register to indicate that the value in the data register is qualified.

Device-to-Host Pipe

The kernel writes a 1 to the valid register to indicate that the value in the data register is qualified. This value is held in the data register until the host writes a 1 to the ready register, which signifies that the host has consumed valid data from the data register. The kernel clears the ready register when the kernel has written subsequent qualified data and the valid register.

Avalon Streaming Sideband Signals

IMPORTANT:
Support for Avalon streaming interface sideband signals has beta-level support. The implementation of sideband signal support might change in a future release.

Enable Avalon streaming sideband signal support by using the StreamingBeat struct provided by the pipes_ext.hpp header file. The StreamingBeat struct generates sideband signals only when used with a host pipe. Other types of pipes do not support sideband signals.

To use the StreamingBeatstruct, include the pipes_ext.hpp header file:

$INTELFPGAOCLSDKROOT/include/sycl/ext/intel/prototype/pipes_ext.hpp

Using the StreamingBeat struct with the uses_packets property set to true adds two additional 1-bit signals to the Avalon interface, start_of_packet (sop), and end_of_packet (eop).

Assert the sop signal when you send the first beat of the packet along with a valid signal assertion. Assert the eop signal when you send the last beat, along with a valid signal assertion. You can assert sop and eop signals in the same cycle for a single packet transfer transaction. The sop signal can also be asserted on the cycle immediately after the eop signal was asserted for the previous packet.

The third property for the StreamingBeatstruct signifies use_empty. When use_empty is set to true, it adds an empty signal that is bits long. The empty signal indicates the number of symbols that are empty during the eop cycle.

Empty symbols are always the last symbols in the data. That is, the symbols carried by low-order bits when first_symbol_in_high_order_bits is true, or the high-order bits if first_symbol_in_high_order_bits is set to false.

You must set use_empty for all packet interfaces that carry more than one symbol of data that have a variable length packet format.

The following example uses the StreamingBeatstruct with the uses_packets and use_empty properties both set to true. The size of the PipeData type is forced to a multiple of the kBitsPerSymbol value, which is passed to the associated host pipe declaration.

using PipeData = ac_int<kBitsPerSymbol * kSymbolsPerBeat, false>;
using StreamingBeatData = sycl::ext::intel::experimental::StreamingBeat<PipeData, true, true>;

When you define the host pipe, set the data type to the StreamingBeatData struct:

using H2DPipe = sycl::ext::intel::experimental::pipe<H2DPipeID, StreamingBeatData>;

The following code example instantiates a StreamingBeat struct and writes to the pipe (from the host):

bool sop = true;
bool eop = false;
int empty = 0;
PipeData data = ...
StreamingBeatData in_beat(data, sop, eop, empty);
H2DPipe::write(q, in_beat);

The following code example reads from the pipe and extracts the sideband signals (from device):

StreamingBeat in_beat = H2DPipe::read();
PipeData in_data = in_beat.data;
bool sop = in_beat.sop;
bool eop = in_beat.eop;
int empty = in_beat.empty;