cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
benedetto73
Adventurer
Adventurer
999 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
Reply
4 Replies
gabed
Xilinx Employee
Xilinx Employee
885 Views
Registered: ‎03-21-2018

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
------------------------------------------------------------------------------
shameera
Moderator
Moderator
847 Views
Registered: ‎05-31-2017

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
Reply
shameera
Moderator
Moderator
796 Views
Registered: ‎05-31-2017

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
Reply
benedetto73
Adventurer
Adventurer
750 Views
Registered: ‎09-30-2019

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
Reply