1
Fork 0
mirror of https://github.com/Steffo99/unimore-hpc-assignments.git synced 2024-11-23 00:24:23 +00:00
hpc-2022-g3/hls/lab1/exercise_6.cpp
Gianluca Brilli 3c3ddf4bec HLS lab 1
2021-05-13 21:40:40 +02:00

21 lines
495 B
C++
Executable file

#define SIZE 128
#define N 10
void fir(int * input, int * output) {
#pragma HLS INTERFACE m_axi port=input offset=slave bundle=input_mem
#pragma HLS INTERFACE m_axi port=output offset=slave bundle=output_mem
#pragma HLS INTERFACE s_axilite port=return bundle=params
int coeff[N] = {13, -2, 9, 11, 26, 18, 95, -43, 6, 74};
for (int n = 0; n < SIZE; n++) {
int acc = 0;
for (int i= 0; i< N; i++ ) {
if (n - i >= 0)
acc += coeff[i] * input[n-i];
}
output[n] = acc;
}
}