antonblanchard / vlsiffra

Create fast and efficient standard cell based adders, multipliers and multiply-adders.
Apache License 2.0
107 stars 9 forks source link

TypeError: expected string or bytes-like object, got 'NoneType' #26

Closed mithro closed 1 year ago

mithro commented 1 year ago

Currently running make pythontests on my machine fails with the following output;

Running 5 test suites (10 total tests) across 5 processes
EEEEEEEEEE
======================================================================
test_random (tests.test_adder.TestCaseBrentKungRandom.test_random)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/tests/test_adder.py", line 47, in test_random
    with sim.write_vcd("adder_random.vcd"):
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 329, in write_vcd
    vcd_writer = _VCDWriter(self._fragment,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 94, in __init__
    if re.search(r"[ \t\r\n]", var_name):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

======================================================================
test_random (tests.test_adder.TestCaseHanCarlsonRandom.test_random)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/tests/test_adder.py", line 99, in test_random
    with sim.write_vcd("adder_random.vcd"):
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 329, in write_vcd
    vcd_writer = _VCDWriter(self._fragment,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 94, in __init__
    if re.search(r"[ \t\r\n]", var_name):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

======================================================================
test_random (tests.test_adder.TestCaseKoggeStoneRandom.test_random)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/tests/test_adder.py", line 73, in test_random
    with sim.write_vcd("adder_random.vcd"):
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 329, in write_vcd
    vcd_writer = _VCDWriter(self._fragment,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 94, in __init__
    if re.search(r"[ \t\r\n]", var_name):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

======================================================================
test_random (tests.test_adder.TestCaseRippleRandom.test_random)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/tests/test_adder.py", line 125, in test_random
    with sim.write_vcd("adder_random.vcd"):
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 329, in write_vcd
    vcd_writer = _VCDWriter(self._fragment,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 94, in __init__
    if re.search(r"[ \t\r\n]", var_name):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

======================================================================
test_random (tests.test_multiplier.TestCaseRandom23.test_random)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/tests/test_multiplier.py", line 64, in test_random
    with sim.write_vcd("multiplier_random23.vcd"):
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 329, in write_vcd
    vcd_writer = _VCDWriter(self._fragment,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 94, in __init__
    if re.search(r"[ \t\r\n]", var_name):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

======================================================================
test_random (tests.test_multiplier.TestCaseRandom32.test_random)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/tests/test_multiplier.py", line 39, in test_random
    with sim.write_vcd("multiplier_random32.vcd"):
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 329, in write_vcd
    vcd_writer = _VCDWriter(self._fragment,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 94, in __init__
    if re.search(r"[ \t\r\n]", var_name):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

======================================================================
test_exhaustive (tests.test_multiplier_exhaustive.TestCaseExhaustive7.test_exhaustive)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/tests/test_multiplier_exhaustive.py", line 62, in test_exhaustive
    with sim.write_vcd("multiplier_exhaustive7.vcd"):
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 329, in write_vcd
    vcd_writer = _VCDWriter(self._fragment,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 94, in __init__
    if re.search(r"[ \t\r\n]", var_name):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

======================================================================
test_exhaustive (tests.test_multiplier_exhaustive.TestCaseExhaustive8.test_exhaustive)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/tests/test_multiplier_exhaustive.py", line 38, in test_exhaustive
    with sim.write_vcd("multiplier_exhaustive8.vcd"):
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 329, in write_vcd
    vcd_writer = _VCDWriter(self._fragment,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 94, in __init__
    if re.search(r"[ \t\r\n]", var_name):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

======================================================================
test_cases (tests.test_multiplier_specific.TestCaseSpecific.test_cases)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/tests/test_multiplier_specific.py", line 59, in test_cases
    with sim.write_vcd("multiplier_specific.vcd"):
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 329, in write_vcd
    vcd_writer = _VCDWriter(self._fragment,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 94, in __init__
    if re.search(r"[ \t\r\n]", var_name):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

======================================================================
test (tests.test_multiply_adder_pipelined.TestCasePipelined.test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/tests/test_multiply_adder_pipelined.py", line 51, in test
    with sim.write_vcd("multiply_adder_pipelined.vcd"):
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 329, in write_vcd
    vcd_writer = _VCDWriter(self._fragment,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tansell/github/antonblanchard/vlsiffra-clean/venv/lib/python3.11/site-packages/amaranth/sim/pysim.py", line 94, in __init__
    if re.search(r"[ \t\r\n]", var_name):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 176, in search
    return _compile(pattern, flags).search(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

----------------------------------------------------------------------
Ran 10 tests in 3.668s

FAILED (errors=10)
make: *** [Makefile:9: pythontests] Error 10

Library versions being installed;

ci/create_venv.sh
Processing /home/tansell/github/antonblanchard/vlsiffra-clean
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting amaranth (from vlsiffra==1.0.0)
  Using cached amaranth-0.3-py3-none-any.whl (167 kB)
Collecting Jinja2~=2.11 (from amaranth->vlsiffra==1.0.0)
  Using cached Jinja2-2.11.3-py2.py3-none-any.whl (125 kB)
Collecting pyvcd~=0.2.2 (from amaranth->vlsiffra==1.0.0)
  Using cached pyvcd-0.2.4-py2.py3-none-any.whl (17 kB)
Collecting MarkupSafe>=0.23 (from Jinja2~=2.11->amaranth->vlsiffra==1.0.0)
  Using cached MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28 kB)
Building wheels for collected packages: vlsiffra
  Building wheel for vlsiffra (pyproject.toml) ... done
  Created wheel for vlsiffra: filename=vlsiffra-1.0.0-py3-none-any.whl size=22726 sha256=6d3d565e2c9a197d4ab97bf8d4d8ee415ba48be0854c37e6f018b30efeeec3f1
  Stored in directory: /home/tansell/.cache/pip/wheels/4e/fa/93/529e7c46f161ea33ecf9add054830566976516d735d1434da5
Successfully built vlsiffra
Installing collected packages: pyvcd, MarkupSafe, Jinja2, amaranth, vlsiffra
Successfully installed Jinja2-2.11.3 MarkupSafe-2.1.3 amaranth-0.3 pyvcd-0.2.4 vlsiffra-1.0.0
Collecting unittest-parallel
  Using cached unittest_parallel-1.6.1-py3-none-any.whl (8.0 kB)
Collecting coverage>=5.1 (from unittest-parallel)
  Using cached coverage-7.3.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (232 kB)
Installing collected packages: coverage, unittest-parallel
Successfully installed coverage-7.3.0 unittest-parallel-1.6.1
Collecting flake8
  Using cached flake8-6.1.0-py2.py3-none-any.whl (58 kB)
Collecting mccabe<0.8.0,>=0.7.0 (from flake8)
  Using cached mccabe-0.7.0-py2.py3-none-any.whl (7.3 kB)
Collecting pycodestyle<2.12.0,>=2.11.0 (from flake8)
  Using cached pycodestyle-2.11.0-py2.py3-none-any.whl (31 kB)
Collecting pyflakes<3.2.0,>=3.1.0 (from flake8)
  Using cached pyflakes-3.1.0-py2.py3-none-any.whl (62 kB)
Installing collected packages: pyflakes, pycodestyle, mccabe, flake8
Successfully installed flake8-6.1.0 mccabe-0.7.0 pycodestyle-2.11.0 pyflakes-3.1.0
Collecting amaranth-yosys
  Using cached amaranth_yosys-0.25.0.0.post75-py3-none-any.whl (740 kB)
Collecting wasmtime<13,>=1 (from amaranth-yosys)
  Using cached wasmtime-12.0.0-py3-none-manylinux1_x86_64.whl (7.0 MB)
Installing collected packages: wasmtime, amaranth-yosys
Successfully installed amaranth-yosys-0.25.0.0.post75 wasmtime-12.0.0
mithro commented 1 year ago

The tests seem to work fine on CI @ https://github.com/mithro/vlsiffra/actions/runs/6018041663/job/16325519351

mithro commented 1 year ago

My guess is going to be an issue with python versions, trying to verify now.

mithro commented 1 year ago

@whitequark confirmed that this is a Python version / amaranth compatibility issue. Until the release of version 0.4, python version below 3.10 has to be used.