summaryrefslogtreecommitdiff
path: root/test/debug.h
diff options
context:
space:
mode:
authorGaetan Leplus <gaetan.leplus@airbus.com>2019-07-05 16:16:19 +0200
committerGaetan Leplus <gaetan.leplus@airbus.com>2019-07-05 16:16:19 +0200
commita432c19745907a96303b3a25111e0fd622202e0c (patch)
tree3ac352a3598fa444d45695dbb2b4cee63698ac57 /test/debug.h
parent92893d79b36c9fb5a90644b82d16d9fa2563feb1 (diff)
parent4f58d99e11e1c412a600f39f32a8d181765f0246 (diff)
downloadlilliput-ae-implem-a432c19745907a96303b3a25111e0fd622202e0c.tar.xz
Merge remote-tracking branch 'origin/master' into fix-vhdltbc
Diffstat (limited to 'test/debug.h')
-rw-r--r--test/debug.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/test/debug.h b/test/debug.h
index 24b7787..56cd123 100644
--- a/test/debug.h
+++ b/test/debug.h
@@ -17,9 +17,7 @@ static inline void debug_dump_lanes(const char *header, size_t len, const uint8_
fprintf(DUMP, "%*s", indent, "");
for (size_t b=0; b<8; b++)
{
- /* start with MSB */
- size_t byte_index = len-(1+line*8+b);
- fprintf(DUMP, "%*s%02x", 5, "", buf[byte_index]);
+ fprintf(DUMP, "%*s%02x", 5, "", buf[line*8+b]);
}
fprintf(DUMP, "\n");
}
@@ -30,26 +28,24 @@ static inline void debug_dump_buffer(const char *header, size_t len, const uint8
{
fprintf(DUMP, "%*s%s\n", indent, "", header);
- if (len%8 != 0)
+ for (size_t line=0; line<len/8; line++)
{
- fprintf(DUMP, "%*s", (int)(3*(8-len%8))+indent, "");
- for (size_t b=0; b<len%8; b++)
+ fprintf(DUMP, "%*s[0x%02zx] ", indent, "", line*8);
+ for (size_t b=0; b<8; b++)
{
- size_t byte_index = len-1-b;
- fprintf(DUMP, "%02x ", buf[byte_index]);
+ /* fprintf(DUMP, "[%zu / %zu => %zu]", line, b, line*8+b); */
+ fprintf(DUMP, "%02x ", buf[line*8+b]);
}
fprintf(DUMP, "\n");
}
- for (size_t line=0; line<len/8; line++)
+ size_t rest = len%8;
+ if (rest != 0)
{
- fprintf(DUMP, "%*s", indent, "");
- for (size_t b=0; b<8; b++)
+ fprintf(DUMP, "%*s[0x%02zx] ", indent, "", len-rest);
+ for (size_t b=0; b<rest; b++)
{
- /* start with MSB */
- size_t byte_index = 8*(len/8 - 1 - line) + 7-b;
- /* fprintf(DUMP, "[%zu / %zu => %zu]", line, b, byte_index); */
- fprintf(DUMP, "%02x ", buf[byte_index]);
+ fprintf(DUMP, "%02x ", buf[len-rest+b]);
}
fprintf(DUMP, "\n");
}