nmigen-learning/fpga/__init__.py

35 lines
1.2 KiB
Python
Raw Normal View History

2020-08-06 20:52:49 +02:00
2020-08-06 20:53:02 +02:00
__version__ = '0.1.0'
2020-08-06 20:52:49 +02:00
2020-08-06 20:53:02 +02:00
# YOWASP:
2020-08-06 20:52:49 +02:00
2020-08-20 16:18:29 +02:00
def populate_environ_with_yowasp():
2020-08-06 20:53:02 +02:00
import os, shutil
2020-08-06 20:52:49 +02:00
2020-08-08 01:48:05 +02:00
for nmigen_envvar, expected_path, alternative_path in [
2020-08-20 16:18:29 +02:00
("SBY", "sby", "yowasp-sby"),
("YOSYS", "yosys", "yowasp-yosys"), # nmigen-yosys is handled by nmigen
("NEXTPNR_ECP5", "nextpnr-ecp5", "yowasp-nextpnr-ecp5"),
("NEXTPNR_ICE40", "nextpnr-ice40", "yowasp-nextpnr-ice40"),
("NEXTPNR_ICE40", "nextpnr-ice40", "yowasp-nextpnr-ice40"),
("ICEBRAM", "icebram", "yowasp-icebram"),
("ICEMULTI", "icemulti", "yowasp-icemulti"),
("ICEPACK", "icepack", "yowasp-icepack"),
("ICEPLL", "icepll", "yowasp-icepll"),
("ICEUNPACK", "iceunpack", "yowasp-iceunpack"),
]:
2020-08-08 01:48:05 +02:00
if nmigen_envvar in os.environ: continue
if shutil.which(expected_path): continue
if not shutil.which(alternative_path): continue
2020-08-20 16:18:29 +02:00
2020-08-08 01:48:05 +02:00
os.environ[nmigen_envvar] = alternative_path
2020-08-06 20:52:49 +02:00
2020-08-20 16:18:29 +02:00
populate_environ_with_yowasp()
del populate_environ_with_yowasp
2020-08-06 20:52:49 +02:00
2020-08-06 20:53:02 +02:00
# dogelang: Slow. Stupid. Absolutely adorable.
2020-08-20 16:18:29 +02:00
2020-08-08 01:48:05 +02:00
import dg # setup the dg import hook
2020-08-20 16:18:29 +02:00
del dg