From 055de1f9fe77821245c54e80e6b88c3655a2774a Mon Sep 17 00:00:00 2001 From: htfab Date: Mon, 17 Feb 2025 07:47:04 +0100 Subject: [PATCH] fix(precheck): improve error messages for connectivity checks --- precheck/precheck.py | 8 ++++---- precheck/test_precheck.py | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/precheck/precheck.py b/precheck/precheck.py index f70b556..9c1dc81 100644 --- a/precheck/precheck.py +++ b/precheck/precheck.py @@ -228,19 +228,19 @@ def analog_pin_check( if connected and not expected_pc: raise PrecheckFailure( - f"Analog pin {pin} connected but `analog_pins` is {analog_pins}" + f"Analog pin `ua[{pin}]` is connected to some metal but `analog_pins` is set to {analog_pins} in `info.yaml`. Either increase `analog_pins` to at least {pin+1}, or remove any metal4 or via3 adjacent to `ua[{pin}]`." ) elif connected and not expected_pd: raise PrecheckFailure( - f"Analog pin {pin} connected but `pinout.ua[{pin}]` is falsy" + f"Analog pin `ua[{pin}]` is connected to some metal but the description of `ua[{pin}]` in the pinout section of `info.yaml` is empty. Either add a description or remove any metal4 or via3 adjacent to `ua[{pin}]`." ) elif not connected and expected_pc: raise PrecheckFailure( - f"Analog pin {pin} not connected but `analog_pins` is {analog_pins}" + f"Analog pin `ua[{pin}]` is not connected to any adjacent metal but `analog_pins` is set to {analog_pins} in `info.yaml`. Either wire up `ua[{pin}]` to your design using metal4 or via3, or decrease `analog_pins` to {pin}." ) elif not connected and expected_pd: raise PrecheckFailure( - f"Analog pin {pin} not connected but `pinout.ua[{pin}]` is truthy" + f"Analog pin `ua[{pin}]` is not connected to any adjacent metal but the description of `ua[{pin}]` in the pinout section of `info.yaml` is non-empty. Either wire up `ua[{pin}]` to your design using metal4 or via3, or remove the description for the disconnected pin." ) diff --git a/precheck/test_precheck.py b/precheck/test_precheck.py index dd8496d..2e5448b 100644 --- a/precheck/test_precheck.py +++ b/precheck/test_precheck.py @@ -664,7 +664,8 @@ def test_analog_exact_pins(gds_lef_analog_pin_example: tuple[str, str]): def test_analog_less_pins(gds_lef_analog_pin_example: tuple[str, str]): gds_file, lef_file = gds_lef_analog_pin_example with pytest.raises( - precheck.PrecheckFailure, match="Analog pin 1 connected but `analog_pins` is 1" + precheck.PrecheckFailure, + match="Analog pin `ua\\[1\\]` is connected to some metal but `analog_pins` is set to 1 .*", ): precheck.analog_pin_check( gds_file, "sky130", True, False, 1, {"ua[0]": "x", "ua[1]": "x"} @@ -675,7 +676,7 @@ def test_analog_more_pins(gds_lef_analog_pin_example: tuple[str, str]): gds_file, lef_file = gds_lef_analog_pin_example with pytest.raises( precheck.PrecheckFailure, - match="Analog pin 2 not connected but `analog_pins` is 3", + match="Analog pin `ua\\[2\\]` is not connected to any adjacent metal but `analog_pins` is set to 3 .*", ): precheck.analog_pin_check( gds_file, "sky130", True, False, 3, {"ua[0]": "x", "ua[1]": "x"} @@ -686,7 +687,7 @@ def test_analog_less_ua_entries(gds_lef_analog_pin_example: tuple[str, str]): gds_file, lef_file = gds_lef_analog_pin_example with pytest.raises( precheck.PrecheckFailure, - match="Analog pin 1 connected but `pinout\\.ua\\[1\\]` is falsy", + match="Analog pin `ua\\[1\\]` is connected to some metal but the description of `ua\\[1\\]` .*", ): precheck.analog_pin_check(gds_file, "sky130", True, False, 2, {"ua[0]": "x"}) @@ -695,7 +696,7 @@ def test_analog_more_ua_entries(gds_lef_analog_pin_example: tuple[str, str]): gds_file, lef_file = gds_lef_analog_pin_example with pytest.raises( precheck.PrecheckFailure, - match="Analog pin 2 not connected but `pinout\\.ua\\[2\\]` is truthy", + match="Analog pin `ua\\[2\\]` is not connected to any adjacent metal but the description of `ua\\[2\\]` .*", ): precheck.analog_pin_check( gds_file,