1
Fork 0
mirror of https://github.com/Steffo99/unimore-hpc-assignments.git synced 2024-11-26 18:14:23 +00:00
hpc-2022-g3/hls/lab1/exercise_6.cpp

22 lines
495 B
C++
Raw Normal View History

2021-05-13 19:40:40 +00:00
#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;
}
}