From a5f16f9ca247cd20b76d461a1639ce4c5b2352f6 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Fri, 27 Feb 2026 06:33:28 +0000 Subject: [PATCH] Fix wrap_openframe.py: wrap OEB inversion in parentheses Loom's sverilogparse cannot parse unary operators immediately before backslash-escaped identifiers (e.g. `~\io$name$oe`). Wrap the operand in parentheses: `~( \io$name$oe )` so the parser handles it correctly. Co-developed-by: Claude Code v2.1.44 (claude-opus-4-6) --- scripts/wrap_openframe.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/wrap_openframe.py b/scripts/wrap_openframe.py index fff13c6..f86939f 100644 --- a/scripts/wrap_openframe.py +++ b/scripts/wrap_openframe.py @@ -240,7 +240,7 @@ def generate_wrapper(mappings: dict, top_ports: list[dict]) -> str: lines.append(f" assign gpio_out[{gpio_idx}] = {io_port} ; // {port_name} output") used_out_gpio.add(gpio_idx) oe_port = f"\\io${port_name}$oe" - lines.append(f" assign gpio_oeb[{gpio_idx}] = !{oe_port} ; // {port_name} OEB") + lines.append(f" assign gpio_oeb[{gpio_idx}] = ~( {oe_port} ); // {port_name} OEB") used_oeb_gpio.add(gpio_idx) else: # Multi-bit port @@ -260,9 +260,9 @@ def generate_wrapper(mappings: dict, top_ports: list[dict]) -> str: used_out_gpio.add(gpio_idx) oe_port = f"\\io${port_name}$oe" if individual_oe: - lines.append(f" assign gpio_oeb[{gpio_idx}] = ~{oe_port} [{bit}]; // {port_name}[{bit}] OEB") + lines.append(f" assign gpio_oeb[{gpio_idx}] = ~( {oe_port} [{bit}] ); // {port_name}[{bit}] OEB") else: - lines.append(f" assign gpio_oeb[{gpio_idx}] = !{oe_port} ; // {port_name} OEB") + lines.append(f" assign gpio_oeb[{gpio_idx}] = ~( {oe_port} ); // {port_name} OEB") used_oeb_gpio.add(gpio_idx) lines.append("")