summaryrefslogtreecommitdiff
path: root/BS
diff options
context:
space:
mode:
authorYun-Ze Li <p76091292@gs.ncku.edu.tw>2021-12-23 07:50:01 +0100
committerYun-Ze Li <p76091292@gs.ncku.edu.tw>2021-12-23 07:50:01 +0100
commit196683d2ec21da97764a17b5683539588715d1de (patch)
tree886d7d603a7a9bd6b883ff136daf3f14933d97d0 /BS
parent0b22a7ec4885131a313e076675603f51c425aebc (diff)
bs_bug_fix: Make MRAM reads 8-byte aligned
Current implementation does not guarantee that `current_mram_block_addr_A` is 8-byte aligned before using it as the start address of `mram_read`s. This commit makes `current_mram_block_addr_A` 8-byte aligned whenever we try to use it for a MRAM read by `current_mram_block_addr_A &= WORD_MASK`, which will clear the unaligned bytes. Signed-off-by: Yun-Ze Li <p76091292@gs.ncku.edu.tw>
Diffstat (limited to 'BS')
-rw-r--r--BS/dpu/task.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/BS/dpu/task.c b/BS/dpu/task.c
index 39a340d..45c48f5 100644
--- a/BS/dpu/task.c
+++ b/BS/dpu/task.c
@@ -12,6 +12,7 @@
#include <perfcounter.h>
#include "common.h"
+#define WORD_MASK 0xfffffff8
__host dpu_arguments_t DPU_INPUT_ARGUMENTS;
__host dpu_results_t DPU_RESULTS[NR_TASKLETS];
@@ -92,6 +93,7 @@ int main_kernel1() {
mram_read((__mram_ptr void const *) (end_mram_block_addr_A - BLOCK_SIZE * sizeof(DTYPE)), cache_aux_B, BLOCK_SIZE);
current_mram_block_addr_A = (start_mram_block_addr_A + end_mram_block_addr_A) / 2;
+ current_mram_block_addr_A &= WORD_MASK;
while(!end)
{
// Load cache with current MRAM block
@@ -104,6 +106,7 @@ int main_kernel1() {
if(found > -1)
{
result->found = found + (current_mram_block_addr_A - start_mram_block_addr_aux) / sizeof(DTYPE);
+ printf("Tasklet %d has found %lld\n", me(), result->found + 1);
break;
}
@@ -112,6 +115,7 @@ int main_kernel1() {
{
end_mram_block_addr_A = current_mram_block_addr_A;
current_mram_block_addr_A = (current_mram_block_addr_A + start_mram_block_addr_A) / 2;
+ current_mram_block_addr_A &= WORD_MASK;
}
// If found == -1, we need to discard left part of the input vector
@@ -119,6 +123,7 @@ int main_kernel1() {
{
start_mram_block_addr_A = current_mram_block_addr_A;
current_mram_block_addr_A = (current_mram_block_addr_A + end_mram_block_addr_A) / 2;
+ current_mram_block_addr_A &= WORD_MASK;
}
// Start boundary check
@@ -132,7 +137,12 @@ int main_kernel1() {
{
end = true;
result->found = found + (current_mram_block_addr_A - start_mram_block_addr_aux) / sizeof(DTYPE);
+ printf("Tasklet %d has found %lld\n", me(), result->found + 1);
}
+ else
+ {
+ printf("%lld NOT found\n", searching_for);
+ }
}
// End boundary check
@@ -145,7 +155,12 @@ int main_kernel1() {
if(found > -1)
{
result->found = found + (current_mram_block_addr_A - start_mram_block_addr_aux) / sizeof(DTYPE);
+ printf("Tasklet %d has found %lld\n", me(), result->found + 1);
}
+ else
+ {
+ printf("%lld NOT found\n", searching_for);
+ }
}
}
}