nmigen-learning/fpga/__init__.py

24 lines
729 B
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-06 20:53:02 +02:00
def populate_environ():
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 [
("YOSYS", "yosys", "yowasp-yosys"), # nmigen-yosys is handled by nmigen
("NEXTPNR_ICE40", "nextpnr-ice40", "yowasp-nextpnr-ice40"),
("NEXTPNR_ECP5", "nextpnr-ecp5", "yowasp-nextpnr-ecp5"),
2020-08-06 20:53:02 +02:00
]:
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
os.environ[nmigen_envvar] = alternative_path
2020-08-06 20:52:49 +02:00
2020-08-06 20:53:02 +02:00
populate_environ()
del populate_environ
2020-08-06 20:52:49 +02:00
2020-08-06 20:53:02 +02:00
# dogelang: Slow. Stupid. Absolutely adorable.
2020-08-08 01:48:05 +02:00
import dg # setup the dg import hook