3

In the end what I want to do is to use a streaming interface with single precision floating point arrays in Vivado Design Suite to build hardware accelerators. HLS User Guide UG902 shows that is possible to create HW accelerators (starting from C, C++, SystemC, OpenCL code) using different interfaces.

If you want to use an AXI4 streaming interface, HLS synthesizes the signals TREADY and TVALID but it doesn't synthesize the signal TLAST necessary to connect the RTL interface generated to Zynq Processing System (ARM9 cores in my case). In order to solve this problem, Xilinx gives you the possibility to use this library

#include "ap_axi_sdata.h"

Inside there is the struct - template:

#include "ap_int.h"
template<int D,int U,int TI,int TD>
struct ap_axis{
ap_int<D> data;
ap_uint<D/8> keep;
ap_uint<D/8> strb;
ap_uint<U> user;
ap_uint<1> last;
ap_uint<TI> id;
ap_uint<TD> dest;
};

I have two problems:

  • If I want to use only TLAST and not the others, I try to set up U, TI and TD to zero but I get an error.
  • If I want to use 'float' and not 'ap_int' and I try to change it inside the template I get another error.

How can I handle and manage streaming interface in HLS with floating point data without encountering these two problems?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Leos313
  • 5,152
  • 6
  • 40
  • 69
  • 1
    That's not even close to C! C is not C++ is not C. – too honest for this site Jul 08 '16 at 10:42
  • Dear friend, [here](http://www.xilinx.com/support/documentation/sw_manuals/xilinx2014_1/ug902-vivado-high-level-synthesis.pdf) pag 313, you can find this sentence: 'IMPORTANT: The term “C code” as used in this guide refers to code written in C, C++, SystemC, and OpenCL API C, unless otherwise specifically noted.'. – Leos313 Jul 11 '16 at 10:00

1 Answers1

4

For me the simplest way to solve that, it is to declare your own struct data type, without using the library that you mentioned above. By default VivadoHLS implement the AXIS interfaces with the signals TDATA, TVALID and TREADY. If you also need TLAST and single precision single point data you should declare your own data type, which should be something like this:

struct my_data{
  float data;
  bool last;
};

I can give you an example about how you should use it:

void my_function(my_data input[25], my_data output[25])
{
#pragma HLS INTERFACE axis port=output
#pragma HLS INTERFACE axis port=input
#pragma HLS INTERFACE s_axilite port=return


    float tmp_data;
    float tmp_last;

    int k=0;

    for(k=0;k<25;k++)
        {
            tmp_data[k] = input[k].data;
            tmp_last[k] = input[k].last;
        }


        for(k=0;k<25;k++)
        {
            output[k].data = tmp_data[k];
            output[k].last = tmp_last[k];
        }
     }

If you do this, after synthesis you'll get this result: enter image description here

In order to avoid errors you must pay attention to: Whenever you use the data of your stream interfaces you should be careful to manage the rest of the signals of the interface.

haggai_e
  • 4,689
  • 1
  • 24
  • 37
Arturete
  • 133
  • 2
  • 12
  • 1
    I have just tried and it seems to work perfectly. After the synhesis of HLS, the RTL ip generated was connected without error to the system. The validation design gives me NO errors. Thank you so much – Leos313 Jul 08 '16 at 10:56