Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synthesis for applets fails with YoWASP with: ERROR: Assert `ofs.is_open()' failed in ../yosys-src/passes/techmap/abc9_ops.cc:950. #304

Closed
VioletEternity opened this issue Feb 16, 2023 · 5 comments
Labels
software Component: software upstream Meta: something we can't change ourselves

Comments

@VioletEternity
Copy link
Contributor

VioletEternity commented Feb 16, 2023

I've installed Glasgow and YoWASP in a new virtual environment:

Shell transcript
C:\Users\Maya\Desktop\glasgow>python -m venv venv

C:\Users\Maya\Desktop\glasgow>venv\Scripts\activate

(venv) C:\Users\Maya\Desktop\glasgow>pip install ./software[toolchain]
Processing c:\users\maya\desktop\glasgow\software
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting amaranth@ git+https://github.com/amaranth-lang/amaranth.git
  Cloning https://github.com/amaranth-lang/amaranth.git to c:\users\maya\appdata\local\temp\pip-install-v05ktafr\amaranth_9c9a5d56b90b46b1af4f715b17b29de6
  Running command git clone --filter=blob:none --quiet https://github.com/amaranth-lang/amaranth.git 'C:\Users\Maya\AppData\Local\Temp\pip-install-v05ktafr\amaranth_9c9a5d56b90b46b1af4f715b17b29de6'
  Resolved https://github.com/amaranth-lang/amaranth.git to commit 7e3e10e7333630999c5b51440f0e5f0daef0358c
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting crcmod
  Using cached crcmod-1.7.tar.gz (89 kB)
  Preparing metadata (setup.py) ... done
Collecting libusb1>=1.8.1
  Using cached libusb1-3.0.0-py3-none-win_amd64.whl (140 kB)
Collecting pyvcd
  Using cached pyvcd-0.3.0-py2.py3-none-any.whl (23 kB)
Collecting bitarray
  Downloading bitarray-2.7.2-cp310-cp310-win_amd64.whl (116 kB)
     ---------------------------------------- 116.2/116.2 kB 3.3 MB/s eta 0:00:00
Collecting fx2>=0.11
  Using cached fx2-0.11-py3-none-any.whl (17 kB)
Collecting aiohttp~=3.8
  Downloading aiohttp-3.8.4-cp310-cp310-win_amd64.whl (319 kB)
     ---------------------------------------- 319.8/319.8 kB 4.9 MB/s eta 0:00:00
Collecting yowasp-nextpnr-ice40>=0.1
  Using cached yowasp_nextpnr_ice40-0.5.0.0.post399-py3-none-any.whl (71.9 MB)
Collecting amaranth-yosys
  Using cached amaranth_yosys-0.25.0.0.post67-py3-none-any.whl (740 kB)
Collecting yowasp-yosys>=0.11
  Using cached yowasp_yosys-0.26.0.0.post489-py3-none-any.whl (7.0 MB)
Collecting charset-normalizer<4.0,>=2.0
  Downloading charset_normalizer-3.0.1-cp310-cp310-win_amd64.whl (96 kB)
     ---------------------------------------- 96.5/96.5 kB ? eta 0:00:00
Collecting yarl<2.0,>=1.0
  Using cached yarl-1.8.2-cp310-cp310-win_amd64.whl (56 kB)
Collecting aiosignal>=1.1.2
  Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting attrs>=17.3.0
  Downloading attrs-22.2.0-py3-none-any.whl (60 kB)
     ---------------------------------------- 60.0/60.0 kB 3.1 MB/s eta 0:00:00
Collecting multidict<7.0,>=4.5
  Downloading multidict-6.0.4-cp310-cp310-win_amd64.whl (28 kB)
Collecting async-timeout<5.0,>=4.0.0a3
  Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting frozenlist>=1.1.1
  Using cached frozenlist-1.3.3-cp310-cp310-win_amd64.whl (33 kB)
Collecting yowasp-runtime~=1.1
  Using cached yowasp_runtime-1.7-py3-none-any.whl (3.8 kB)
Collecting Jinja2~=3.0
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting wasmtime<6,>=1
  Downloading wasmtime-5.0.0-py3-none-win_amd64.whl (4.5 MB)
     ---------------------------------------- 4.5/4.5 MB 1.4 MB/s eta 0:00:00
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.2-cp310-cp310-win_amd64.whl (16 kB)
Collecting idna>=2.0
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting appdirs~=1.4
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Building wheels for collected packages: amaranth, glasgow
  Building wheel for amaranth (pyproject.toml) ... done
  Created wheel for amaranth: filename=amaranth-0.4.dev62+g7e3e10e-py3-none-any.whl size=153725 sha256=9781330247253579566930000c7cf3f5edb2bfc851ed882b7668aab92df6492d
  Stored in directory: C:\Users\Maya\AppData\Local\Temp\pip-ephem-wheel-cache-27jb0c1r\wheels\83\05\9a\59c513197e8c3427a5077986524b0058a75e7ae4f4ddd544f4
  Building wheel for glasgow (pyproject.toml) ... done
  Created wheel for glasgow: filename=glasgow-0.1.dev1698+g074db5d-py3-none-any.whl size=386634 sha256=bdedf7a9937296bba531301e7b6cc609d3981fbf1410e7533ed0767d0db5a81e
  Stored in directory: C:\Users\Maya\AppData\Local\Temp\pip-ephem-wheel-cache-27jb0c1r\wheels\66\dd\b5\62e39ea54c42fd95ac1d0534b9688190b78b2c8e9c041faf75
Successfully built amaranth glasgow
Installing collected packages: libusb1, crcmod, charset-normalizer, bitarray, appdirs, wasmtime, pyvcd, multidict, MarkupSafe, idna, fx2, frozenlist, attrs, async-timeout, yowasp-runtime, yarl, Jinja2, amaranth-yosys, aiosignal, yowasp-yosys, yowasp-nextpnr-ice40, amaranth, aiohttp, glasgow
  DEPRECATION: crcmod is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for crcmod ... done
Successfully installed Jinja2-3.1.2 MarkupSafe-2.1.2 aiohttp-3.8.4 aiosignal-1.3.1 amaranth-0.4.dev62+g7e3e10e amaranth-yosys-0.25.0.0.post67 appdirs-1.4.4 async-timeout-4.0.2 attrs-22.2.0 bitarray-2.7.2 charset-normalizer-3.0.1 crcmod-1.7 frozenlist-1.3.3 fx2-0.11 glasgow-0.1.dev1698+g074db5d idna-3.4 libusb1-3.0.0 multidict-6.0.4 pyvcd-0.3.0 wasmtime-5.0.0 yarl-1.8.2 yowasp-nextpnr-ice40-0.5.0.0.post399 yowasp-runtime-1.7 yowasp-yosys-0.26.0.0.post489

[notice] A new release of pip available: 22.3.1 -> 23.0
[notice] To update, run: python.exe -m pip install --upgrade pip

(venv) C:\Users\Maya\Desktop\glasgow>pip list
Package              Version
-------------------- --------------------
aiohttp              3.8.4
aiosignal            1.3.1
amaranth             0.4.dev62+g7e3e10e
amaranth-yosys       0.25.0.0.post67
appdirs              1.4.4
async-timeout        4.0.2
attrs                22.2.0
bitarray             2.7.2
charset-normalizer   3.0.1
crcmod               1.7
frozenlist           1.3.3
fx2                  0.11
glasgow              0.1.dev1698+g074db5d
idna                 3.4
Jinja2               3.1.2
libusb1              3.0.0
MarkupSafe           2.1.2
multidict            6.0.4
pip                  22.3.1
pyvcd                0.3.0
setuptools           65.5.0
wasmtime             5.0.0
yarl                 1.8.2
yowasp-nextpnr-ice40 0.5.0.0.post399
yowasp-runtime       1.7
yowasp-yosys         0.26.0.0.post489

[notice] A new release of pip available: 22.3.1 -> 23.0
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\Users\Maya\Desktop\glasgow>pip freeze
aiohttp==3.8.3
aiosignal==1.3.1
amaranth @ git+https://github.com/amaranth-lang/amaranth.git@7e3e10e7333630999c5b51440f0e5f0daef0358c
amaranth-boards @ git+https://github.com/amaranth-lang/amaranth-boards@609a65c163c1374fb5f9c528253c36caa8edd56f
amaranth-yosys==0.25.0.0.post67
appdirs==1.4.4
async-timeout==4.0.2
attrs==22.1.0
autobahn==22.12.1
Automat==22.10.0
bitarray==2.6.0
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.3
colorama==0.4.6
constantly==15.1.0
contourpy==1.0.6
crcmod==1.7
cryptography==38.0.4
cycler==0.11.0
fonttools==4.38.0
frozenlist==1.3.3
fx2==0.11
-e git+https://github.com/GlasgowEmbedded/glasgow@074db5dceaa4a028b3b00c56663dfdad82e23d8a#egg=glasgow&subdirectory=software
hkdf==0.0.3
humanize==4.4.0
hyperlink==21.0.0
idna==3.4
incremental==22.10.0
Jinja2==3.1.2
kaitaistruct==0.10
kiwisolver==1.4.4
libusb1==3.0.0
magic-wormhole==0.12.0
MarkupSafe==2.1.1
matplotlib==3.6.2
multidict==6.0.3
numpy==1.24.1
packaging==22.0
Pillow==9.3.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
PyNaCl==1.5.0
pyOpenSSL==22.1.0
pyparsing==3.0.9
python-dateutil==2.8.2
pyvcd==0.2.4
pywin32==305
requests==2.28.1
RigolWFM==0.9.6
service-identity==21.1.0
six==1.16.0
spake2==0.8
tqdm==4.64.1
Twisted==22.10.0
twisted-iocpsupport==1.0.2
txaio==22.2.1
txtorcon==22.0.0
typing_extensions==4.4.0
urllib3==1.26.13
wasmtime==1.0.1
yarl==1.8.2
yowasp-nextpnr-ice40==0.5.0.0.post399
yowasp-runtime==1.7
yowasp-yosys==0.26.0.0.post489
zope.interface==5.5.2

(venv) C:\Users\Maya\Desktop\glasgow>..\..\yowasp-env.cmd

(venv) C:\Users\Maya\Desktop\glasgow>set YOSYS=yowasp-yosys

(venv) C:\Users\Maya\Desktop\glasgow>set NEXTPNR_ICE40=yowasp-nextpnr-ice40

(venv) C:\Users\Maya\Desktop\glasgow>set ICEPACK=yowasp-icepack

(venv) C:\Users\Maya\Desktop\glasgow>

When I attempt to build a bitstream for an applet (I've tried uart and jtag-probe), I get the following error:

(venv) C:\Users\Maya\Desktop\glasgow>glasgow build --rev C1 uart
I: glasgow.cli: building bitstream for applet 'uart'
Preparing to run yowasp-yosys. This might take a while...
ERROR: Assert `ofs.is_open()' failed in ../yosys-src/passes/techmap/abc9_ops.cc:950.
Traceback (most recent call last):
  File "C:\Users\Maya\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Maya\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Maya\Desktop\glasgow\venv\Scripts\glasgow.exe\__main__.py", line 7, in <module>
  File "C:\Users\Maya\Desktop\glasgow\venv\lib\site-packages\glasgow\cli.py", line 857, in main
    exit(loop.run_until_complete(_main()))
  File "C:\Users\Maya\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Users\Maya\Desktop\glasgow\venv\lib\site-packages\glasgow\cli.py", line 773, in _main
    f.write(plan.execute())
  File "C:\Users\Maya\Desktop\glasgow\venv\lib\site-packages\glasgow\target\hardware.py", line 118, in execute
    products  = self.lower.execute_local(build_dir)
  File "C:\Users\Maya\Desktop\glasgow\venv\lib\site-packages\amaranth\build\run.py", line 97, in execute_local
    subprocess.check_call(["cmd", "/c", "call {}.bat".format(self.script)])
  File "C:\Users\Maya\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmd', '/c', 'call build_top.bat']' returned non-zero exit status 1.

In issue #298, where a similar problem was reported, I've mentioned that the issue was fixed with yowasp-yosys==0.23.dev444. If I downgrade YoWASP Yosys to that version, synthesis succeeds. However, it fails with yowasp-yosys==0.23.0.0.post486 or yowasp-yosys==0.25.0.102.post487.dev0.

Running glasgow build --rev C1 -t zip uart produces this archive: uart.zip

@whitequark whitequark added the software Component: software label Feb 16, 2023
@whitequark
Copy link
Member

This is a YoWASP issue. YoWASP no longer mounts /tmp itself, and Yosys abc integration uses that to pass intermediate data around.

@whitequark
Copy link
Member

YoWASP/runtime-py#1

@whitequark whitequark added the upstream Meta: something we can't change ourselves label Feb 16, 2023
@whitequark
Copy link
Member

Could you recheck using the following yowasp-runtime wheel, please?
wheel.zip

@VioletEternity
Copy link
Contributor Author

I can build a bitstream with this wheel.

@whitequark
Copy link
Member

I've released yowasp-runtime with this patch. Everything should work after pip install -U yowasp-runtime (or just reinstall the venv).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
software Component: software upstream Meta: something we can't change ourselves
Projects
None yet
Development

No branches or pull requests

2 participants