Compilation errors on a .cpp file for review

Hi,

I was looking at the the following IP Hierarchies tutorial :

https://pynq.readthedocs.io/en/v2.1/overlay_design_methodology/overlay_tutorial.html

and tried to run c-synthesis on the following .cpp file :

mult_constant.cpp :

typedef ap_axiu<32,1,1,1> stream_type;

void mult_constant(stream_type* in_data, stream_type* out_data, ap_int<32> constant) {
#pragma HLS INTERFACE s_axilite register port=constant
#pragma HLS INTERFACE ap_ctrl_none port=return
#pragma HLS INTERFACE axis port=in_data
#pragma HLS INTERFACE axis port=out_data
out_data->data = in_data->data * constant;
out_data->dest = in_data->dest;
out_data->id = in_data->id;
out_data->keep = in_data->keep;
out_data->last = in_data->last;
out_data->strb = in_data->strb;
out_data->user = in_data->user;

}

But got few compilation errors :

INFO: [HLS 200-10] Analyzing design file ‘mult_constant.cpp’ …
ERROR: [HLS 200-70] Compilation errors found: In file included from mult_constant.cpp:1:
mult_constant.cpp:1:9: error: unknown type name ‘ap_axiu’
typedef ap_axiu<32,1,1,1> stream_type;
^
mult_constant.cpp:1:16: error: expected unqualified-id
typedef ap_axiu<32,1,1,1> stream_type;
^
mult_constant.cpp:3:6: error: variable has incomplete type ‘void’
void mult_constant(stream_type* in_data, stream_type* out_data, ap_int<32> constant) {
^
mult_constant.cpp:3:20: error: use of undeclared identifier ‘stream_type’
void mult_constant(stream_type* in_data, stream_type* out_data, ap_int<32> constant) {
^
mult_constant.cpp:3:33: error: use of undeclared identifier ‘in_data’
void mult_constant(stream_type* in_data, stream_type* out_data, ap_int<32> constant) {
^
mult_constant.cpp:3:85: error: expected ‘;’ after top level declarator
void mult_constant(stream_type* in_data, stream_type* out_data, ap_int<32> constant) {
^
;
6 errors generated.
Failed during preprocessing.
while executing
“source C:/Users/kncyp/PYNQ_Z2/multiply_dma/vivado_hls/multiply_dma_prj/solution1/csynth.tcl”
invoked from within
“hls::main C:/Users/kncyp/PYNQ_Z2/multiply_dma/vivado_hls/multiply_dma_prj/solution1/csynth.tcl”
(“uplevel” body line 1)
invoked from within
“uplevel 1 hls::main {*}$args”
(procedure “hls_proc” line 5)
invoked from within
“hls_proc $argv”
Finished C synthesis.

Anyone knows how to resolve them ?

Hi @kanugent.
What Vivado-HLS version are you using?

Have you included this?

#include "ap_axi_sdata.h"

The definition for ap_axiu is there. You should be able to solve the problem including that header.

Mario

Hi Mario,

I am using Vivado HLS 2019.2 for this one.
I added the header as you proposed and it all synthesised ok now. Thanks for your help to this matter :-).

So those headers how do we know which one to use? Is there a documentation available that gives such info?

Regards,
Kevin

Hi Kevin,

The documentation is the Vivado-HLS user guide Documentation Portal
Also, in this hub Vivado 2020.1 - High-Level Synthesis (C based)
Examples (included in the tool) are also a good source of information.

Mario