Skip to content

Commit

Permalink
Cleanup and fix tb for hbm_ram example
Browse files Browse the repository at this point in the history
  • Loading branch information
bartokon committed Jun 7, 2023
1 parent 4d2d3ea commit 943a69c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/hbm_ram.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "hbm_ram.hpp"
#include <stdio.h>

static double calculate_sum(
double d0,
Expand Down Expand Up @@ -60,6 +59,5 @@ void hbm_ram(unsigned int indexes[512], double data_hbm[512][4], double out[512]
#pragma HLS INTERFACE mode=m_axi bundle=gmem2 port=out
for (auto i = 0; i < 512; ++i) {
out[i] = ram_access(indexes[i], data_hbm);
printf("%d: %d \n", i, out[i]);
}
}
10 changes: 6 additions & 4 deletions src/tb_hbm_ram.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#include "hbm_ram.hpp"
#include <stdio.h>
#include <math.h>

int main(void) {
unsigned int indexes[512];
double data[512][4] = {1};
double data[512][4];
double out[512];
for (auto i = 0; i < 512; ++i) {
indexes[i] = i % 256;
for (auto j = 0; j < 4; ++j) {
data[i][j] = 1;
}
}
hbm_ram(indexes, data, out);
for (auto i = 0; i < 512; ++i) {
if (int(out[i]) != (i * 8)) {
printf("%d: %d \n", i, out[i]);
if (out[i] != 6) {
printf("%d: %lf \n", i, out[i]);
return -1;
}
}
Expand Down

0 comments on commit 943a69c

Please sign in to comment.