From cb916ead39f598c619e9218b9ec4d23edda38f1a Mon Sep 17 00:00:00 2001 From: Hansung Kim Date: Sat, 9 Nov 2024 20:59:58 -0800 Subject: [PATCH] Fix potential bitwidth bug in compute API --- kernel/include/gemmini_mmio.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/include/gemmini_mmio.h b/kernel/include/gemmini_mmio.h index f1ca0e77..45030b94 100644 --- a/kernel/include/gemmini_mmio.h +++ b/kernel/include/gemmini_mmio.h @@ -114,8 +114,9 @@ inline void gemmini_tile_compute(const uint32_t a_hexadecile, const uint32_t d_hexadecile, const bool accumulate) { if constexpr (!store_to_spad) { - GEMMINI_CISC_CMD_R((accumulate << 24) | (b_hexadecile << 16) | - (a_hexadecile << 8) | GEMMINI_CISC_COMPUTE_HEXADECILES); + GEMMINI_CISC_CMD_R((static_cast(accumulate) << 24) | + (b_hexadecile << 16) | (a_hexadecile << 8) | + GEMMINI_CISC_COMPUTE_HEXADECILES); } else { GEMMINI_CISC_CMD_R((d_hexadecile << 24) | (b_hexadecile << 16) | (a_hexadecile << 8) | GEMMINI_CISC_COMPUTE_AND_STORE_TO_SPAD);