From 25289a4b06374561752f590740a3e47ac4f628a5 Mon Sep 17 00:00:00 2001 From: Christopher Reinwardt Date: Mon, 20 Apr 2026 23:13:23 +0200 Subject: [PATCH 1/2] croc_vip: Ensure preloading supports byte granularity --- rtl/test/croc_vip.sv | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rtl/test/croc_vip.sv b/rtl/test/croc_vip.sv index fd9f8bf5..a4df569a 100644 --- a/rtl/test/croc_vip.sv +++ b/rtl/test/croc_vip.sv @@ -236,6 +236,14 @@ module croc_vip #( // remove the byte from the line (2 numbers + 1 space) line = line.substr(3, line.len()-1); + // Pad the word with 0s if the line ended between word boundaries + if (line.len() < 3) begin + for (int unsigned cb = byte_count; cb < 4; cb++) begin + data = {8'h00, data[31:8]}; + byte_count++; + end + end + // write a complete word via jtag if (byte_count == 4) begin jtag_write(dm::SBData0, data); From e9f8085f0653ec89cb7b0fffc2aec1fc29545c8a Mon Sep 17 00:00:00 2001 From: Christopher Reinwardt Date: Tue, 21 Apr 2026 13:37:06 +0200 Subject: [PATCH 2/2] croc_vip: Move word alignment out of main loop --- rtl/test/croc_vip.sv | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rtl/test/croc_vip.sv b/rtl/test/croc_vip.sv index a4df569a..608b0252 100644 --- a/rtl/test/croc_vip.sv +++ b/rtl/test/croc_vip.sv @@ -236,14 +236,6 @@ module croc_vip #( // remove the byte from the line (2 numbers + 1 space) line = line.substr(3, line.len()-1); - // Pad the word with 0s if the line ended between word boundaries - if (line.len() < 3) begin - for (int unsigned cb = byte_count; cb < 4; cb++) begin - data = {8'h00, data[31:8]}; - byte_count++; - end - end - // write a complete word via jtag if (byte_count == 4) begin jtag_write(dm::SBData0, data); @@ -252,6 +244,15 @@ module croc_vip #( byte_count = 0; end end + + // Flush any remaining bytes + if (byte_count != 0) begin + data >>= 8 * (4 - byte_count); // zero-pad remaining bytes + jtag_write(dm::SBData0, data); + addr += 4; + byte_count = 0; + data = 32'h0; + end end jtag_dbg.write_dmi(dm::SBCS, JtagInitSbcs); $fclose(file);