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
Did you mean:
Highlighted
2,708 Views
Registered: ‎02-12-2017

## HLS simple add function with axi stream Input/Output

Hi everyone,

i would like to build a simple IP-Core with the sum function and the IP Block shall have one AXIS Input and one AXIS output.

With following code I get it, but the thing is that Port B shall be an Output, but in Block design it is shown as input stream?

```#include<stdio.h>

int sum(int num1, int num2, int A[50], int B[50]) {
#pragma HLS INTERFACE axis register both port=A
#pragma HLS INTERFACE axis register both port=B

int num3;
num3 = num1 + num2;
return (num3);

int i;

for(i = 0; i < 50; i++){
B[i] = A[i] + 5;
}
}```

when I left the function with sum as follows, I get the input A and output B as this code is an example from Xilinx HLS:

```void test(int A[50], int B[50]) {
#pragma HLS INTERFACE axis register both port=A
#pragma HLS INTERFACE axis register both port=B

int i;

for(i = 0; i < 50; i++){
B[i] = A[i] + 5;
}
}
```

So how can I manage it? Any ideas?

Tags (2)
1 Solution

Accepted Solutions
Observer
4,931 Views
Registered: ‎12-28-2010

## Re: HLS simple add function with axi stream Input/Output

Hi,

Check the following code.

#include<stdio.h>

int sum(int num1, int num2, int A[50], int B[50]) {
#pragma HLS INTERFACE axis register port=A
#pragma HLS INTERFACE axis register port=B

int num3;
num3 = num1 + num2;

int i;

for(i = 0; i < 50; i++){
B[i] = A[i] + 5;
}

return (num3);
}

Regards,

Sreela

2 Replies
Observer
4,932 Views
Registered: ‎12-28-2010

## Re: HLS simple add function with axi stream Input/Output

Hi,

Check the following code.

#include<stdio.h>

int sum(int num1, int num2, int A[50], int B[50]) {
#pragma HLS INTERFACE axis register port=A
#pragma HLS INTERFACE axis register port=B

int num3;
num3 = num1 + num2;

int i;

for(i = 0; i < 50; i++){
B[i] = A[i] + 5;
}

return (num3);
}

Regards,

Sreela