Skip to content

Commit

Permalink
Make it possible to use locally installed yosys
Browse files Browse the repository at this point in the history
 * Also bugfix test of module_with_error.v
  • Loading branch information
freand76 committed Dec 17, 2023
1 parent 8d895d2 commit d46391a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CHANGELOG

## vx.x.x
- Make it possible to use locally installed yosys

## v0.3.1
- Fix path in examples to work with github action
Expand Down
11 changes: 9 additions & 2 deletions src/digsim/synth/_synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@ def _pexpect_wait_for_prompt(cls, pexp):
errorline = line
break
raise SynthesisException(errorline)
return before_lines

# Remove escape sequence in output
out_lines = []
for line in before_lines:
if line.startswith("\x1b"):
continue
out_lines.append(line)
return out_lines

@classmethod
def _pexpect_spawn_yosys(cls):
yosys_exe = shutil.which("yowasp-yosys")
yosys_exe = shutil.which("yosys") or shutil.which("yowasp-yosys")

if yosys_exe is None:
raise SynthesisException("Yosys executable not found")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_yosys_synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_yosys_list_module_with_error(verilog_path):
"""test list modules in single file (with multiple modules)"""

with pytest.raises(SynthesisException):
Synthesis.list_modules([str(verilog_path / "moule_with_error.v")])
Synthesis.list_modules([str(verilog_path / "module_with_error.v")])


def test_yosys_synth_single_file_single_module(verilog_path):
Expand All @@ -79,7 +79,7 @@ def test_yosys_synth_single_file_multi_modules(verilog_path):
def test_yosys_synth_module_with_error(verilog_path):
"""test list modules in single file (with multiple modules)"""

synthesis = Synthesis(str(verilog_path / "moule_with_error.v"), "error_module")
synthesis = Synthesis(str(verilog_path / "module_with_error.v"), "error_module")

with pytest.raises(SynthesisException):
synthesis.synth_to_dict()

0 comments on commit d46391a

Please sign in to comment.