UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor
Contributor
327 Views
Registered: ‎09-30-2019

C++ confusion: hls::stream or ap_fifo when reading from a real FIFO?

The use case is: reading (LOTS OF) data from  a device via a FIFO 128 bit wide.

 

The confusion is on the input type.

Option #1

       void kernel(hls::stream<ap_uint<128>> & input, ....)

Option #2

       void kernel(volatile unsigned char * input, ...)

       #pragma HLS interface ap_fifo port=input

 

What are the differences?

Thanks a lot.

 

Tags (3)
0 Kudos
4 Replies
Xilinx Employee
Xilinx Employee
213 Views
Registered: ‎03-21-2018

Re: C++ confusion: hls::stream or ap_fifo when reading from a real FIFO?

Option 1 has a 128-bit unsigned integer type is defined and used to create a stream variable. Which would by default be implemented as a FIFO. It is read from and written to sequentially (cannot be read again). If included on the top level interface, will be implemented as an ap_fifo.

Option 2 implements the unsigned pointer as a FIFO using the pragma. Will require sequential reads/writes.The ap_fifo port-level I/O protocol supports the following:
• Allows the port to be connected to a FIFO
• Enables complete, two-way empty-full communication
• Works for arrays, pointers, and pass-by-reference argument types


Cheers
------------------------------------------------------------------------------
Don't forget to reply, give kudo and accept as solution
------------------------------------------------------------------------------
Moderator
Moderator
175 Views
Registered: ‎05-31-2017

Re: C++ confusion: hls::stream or ap_fifo when reading from a real FIFO?

Hi @benedetto73 ,

In addition to the @gabed post, ap_fifo is an interface directive which is used to implement the ports with the standard FIFO interface. 

whereas, hls::stream is a class that models streams using ap_fifo by default but can also be implemented as a handshake interface using ap_hs or axis interface.

0 Kudos
Moderator
Moderator
124 Views
Registered: ‎05-31-2017

Re: C++ confusion: hls::stream or ap_fifo when reading from a real FIFO?

Hi @benedetto73 ,

If your query has been answered or your issue is solved, can you please kindly mark the response which helped as a solution (click on "Accept as solution" button below the reply) ?

If the issue is not solved/answered, please reply to this thread giving more information on your current status.

0 Kudos
Contributor
Contributor
78 Views
Registered: ‎09-30-2019

Re: C++ confusion: hls::stream or ap_fifo when reading from a real FIFO?

Thanks @shameera.
Your answer is probably good, however it is for hardware people.
If you want to communicate with a software developer you need to use software categories.
0 Kudos