From a9b6eab6c045bc3dddda869d10b695fc3e2bc000 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Thu, 10 Apr 2025 17:59:12 -0700 Subject: [PATCH 1/2] Change commit_log_print_value to iterate by bytes for array types --- riscv/execute.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/riscv/execute.cc b/riscv/execute.cc index 8b3a5c83..aed5013e 100644 --- a/riscv/execute.cc +++ b/riscv/execute.cc @@ -42,11 +42,11 @@ static void commit_log_print_value(FILE *log_file, int width, const void *data) default: // max lengh of vector if (((width - 1) & width) == 0) { - const uint64_t *arr = (const uint64_t *)data; + const uint8_t *arr = (const uint8_t *)data; fprintf(log_file, "0x"); - for (int idx = width / 64 - 1; idx >= 0; --idx) { - fprintf(log_file, "%016" PRIx64, arr[idx]); + for (int idx = width / 8 - 1; idx >= 0; --idx) { + fprintf(log_file, "%002" PRIx8, arr[idx]); } } else { abort(); From 4592a869a4b2108c4971b14265dd914ee42f17f8 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Thu, 10 Apr 2025 17:59:49 -0700 Subject: [PATCH 2/2] Allow commit_log_print_value to print any byte array --- riscv/execute.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/riscv/execute.cc b/riscv/execute.cc index aed5013e..9e00f262 100644 --- a/riscv/execute.cc +++ b/riscv/execute.cc @@ -40,8 +40,7 @@ static void commit_log_print_value(FILE *log_file, int width, const void *data) fprintf(log_file, "0x%016" PRIx64, *(const uint64_t *)data); break; default: - // max lengh of vector - if (((width - 1) & width) == 0) { + if (width % 8 == 0) { const uint8_t *arr = (const uint8_t *)data; fprintf(log_file, "0x");