parent
307de722cb
commit
06faeee357
|
@ -12,12 +12,21 @@ class YosysError(Exception):
|
||||||
|
|
||||||
|
|
||||||
def convert(*args, **kwargs):
|
def convert(*args, **kwargs):
|
||||||
il_text = rtlil.convert(*args, **kwargs)
|
try:
|
||||||
popen = subprocess.Popen([os.getenv("YOSYS", "yosys"), "-q", "-"],
|
popen = subprocess.Popen([os.getenv("YOSYS", "yosys"), "-q", "-"],
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
encoding="utf-8")
|
encoding="utf-8")
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
if os.getenv("YOSYS"):
|
||||||
|
raise YosysError("Could not find Yosys in {} as specified via the YOSYS environment "
|
||||||
|
"variable".format(os.getenv("YOSYS"))) from e
|
||||||
|
else:
|
||||||
|
raise YosysError("Could not find Yosys in PATH. Place `yosys` in PATH or specify "
|
||||||
|
"path explicitly via the YOSYS environment variable") from e
|
||||||
|
|
||||||
|
il_text = rtlil.convert(*args, **kwargs)
|
||||||
verilog_text, error = popen.communicate("""
|
verilog_text, error = popen.communicate("""
|
||||||
# Convert nMigen's RTLIL to readable Verilog.
|
# Convert nMigen's RTLIL to readable Verilog.
|
||||||
read_ilang <<rtlil
|
read_ilang <<rtlil
|
||||||
|
|
Loading…
Reference in a new issue