这是我要实现的伪代码:
这是我当前的代码:
extern "C" {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int ParPrefix(
const unsigned int *in1, // Read-Only Vector
unsigned int *out, // Output Result
int size // Size in integer
)
{
#pragma HLS INTERFACE m_axi port=in1 bundle=aximm1
#pragma HLS INTERFACE m_axi port=out bundle=aximm1
int stages = ceil(log2(size)); // Number of stages
// Compute prefix sum for each stage
for (int i = 0; i < stages; i++) {
for (int j = 0; j < size; j++) {
if (j >= pow(2, i)) {
int k = j - pow(2, i);
out[j] = in1[j] + in1[k];
} else {
out[j] = in1[j];
}
}
}
return 0;
}
}
我正在对照这段代码检查它:
我得到这个作为我的输出:
关于我做错了什么有什么想法吗?
见上文......................