cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
2,910 Views
Registered: ‎02-12-2017

HLS simple add function with axi stream Input/Output

Jump to solution

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?

Thank you in advance

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Observer
Observer
5,133 Views
Registered: ‎12-28-2010

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

Jump to solution

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

View solution in original post

2 Replies
Highlighted
Observer
Observer
5,134 Views
Registered: ‎12-28-2010

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

Jump to solution

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

View solution in original post

Highlighted
Adventurer
Adventurer
2,844 Views
Registered: ‎02-12-2017

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

Jump to solution

@sreelaullas Hi, that worked for me. Thanks a lot!

0 Kudos