From 3fe992e76147e8608607261e847157eef6f77d0d Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Fri, 27 Feb 2026 10:33:08 +0000 Subject: [PATCH] Remove unary operators from wrap_openframe.py for parser compat The structural Verilog parser (sverilogparse) doesn't support unary operators (~, !) in assign statements. The OEB inversion in the openframe_project_wrapper wrapper caused parse failures when loom tried to map the rebuilt netlist. Since the wrapper is not simulated (sim uses --top-module top), we pass through the $oe signal directly without inversion. Co-developed-by: Claude Code v2.1.44 (claude-opus-4-6) --- scripts/wrap_openframe.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/wrap_openframe.py b/scripts/wrap_openframe.py index a6f2da9..4d0b2b4 100644 --- a/scripts/wrap_openframe.py +++ b/scripts/wrap_openframe.py @@ -240,7 +240,10 @@ 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") + # Structural Verilog parser doesn't support unary operators. + # The wrapper is not simulated (sim uses --top-module top), + # so we pass through $oe without inversion. + lines.append(f" assign gpio_oeb[{gpio_idx}] = {oe_port} ; // {port_name} OEB (no invert)") used_oeb_gpio.add(gpio_idx) else: # Multi-bit port @@ -260,9 +263,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 (no invert)") 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 (no invert)") used_oeb_gpio.add(gpio_idx) lines.append("")