From 71e1c7c60f035515a7d84a3e8f0297fbf6a7bd19 Mon Sep 17 00:00:00 2001 From: tzuohann <418dreamworks@gmail.com> Date: Mon, 26 Oct 2026 11:00:24 -0400 Subject: [PATCH] halcompile: man page array ranges end at size-1 (#4714) A pin or param declared [32:personality] runs 00..personality-1, but the man page printed MM=00..personality. Print the bound as (size)-1, with the size in parentheses so expressions such as personality & 0xff (logic) read correctly. One-liner from BsAtHome in #4714, applied to pins and params. --- src/hal/utils/halcompile.g | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hal/utils/halcompile.g b/src/hal/utils/halcompile.g index a610bba8079..785b48cacaf 100644 --- a/src/hal/utils/halcompile.g +++ b/src/hal/utils/halcompile.g @@ -1195,7 +1195,7 @@ def document(filename, outfilebase): if array: sz = name.count("#") if isinstance(array, tuple): - print(" (%s=%0*d..%s)" % ("M" * sz, sz, 0, array[1]), end=' ', file=f) + print(" (%s=%0*d..(%s)-1)" % ("M" * sz, sz, 0, array[1]), end=' ', file=f) else: print(" (%s=%0*d..%0*d)" % ("M" * sz, sz, 0, sz, array-1), end=' ', file=f) if personality: @@ -1218,7 +1218,7 @@ def document(filename, outfilebase): if array: sz = name.count("#") if isinstance(array, tuple): - print(" (%s=%0*d..%s)" % ("M" * sz, sz, 0, array[1]), end=' ', file=f) + print(" (%s=%0*d..(%s)-1)" % ("M" * sz, sz, 0, array[1]), end=' ', file=f) else: print(" (%s=%0*d..%0*d)" % ("M" * sz, sz, 0, sz, array-1), end=' ', file=f) if personality: