-
Notifications
You must be signed in to change notification settings - Fork 893
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wheels: fix missing yosys-abc/share directory
* `misc/__init__.py`: * checks if there's a `yosys-abc` in the same directory - if yes, sets the variable `sys._pyosys_abc` * checks if there's a `share` in the same directory - if yes, sets the variable `sys._pyosys_share_dirname` * `yosys.cc::init_share_dirname`: check for `sys._pyosys_share_dirname`, use it at the highest priority if Python is enabled * `yosys.cc::init_abc_executable_name`: check for `sys._pyosys_abc`, use it at at the highest priority if Python is enabled * `Makefile`: add new target, `share`, to only create the extra targets * `setup.py`: compile libyosys.so, yosys-abc and share, and copy them all as part of the pyosys build * `test/arch/ecp5/add_sub.py`: ported `add_sub.ys` to Python to act as a test for the share directory and abc with Python wheels, used in CI
- Loading branch information
Showing
6 changed files
with
105 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,19 @@ | ||
import os | ||
import sys | ||
|
||
sys.setdlopenflags(os.RTLD_NOW | os.RTLD_GLOBAL) | ||
|
||
__dir__ = os.path.abspath(os.path.dirname(__file__)) | ||
sys._pyosys_dir = os.path.abspath(__dir__) | ||
|
||
bin_ext = ".exe" if os.name == "nt" else "" | ||
|
||
_share_candidate = os.path.join(__dir__, "share") | ||
if os.path.isdir(_share_candidate): | ||
sys._pyosys_share_dirname = _share_candidate + os.path.sep | ||
|
||
_abc_candidate = os.path.join(__dir__, f"yosys-abc{bin_ext}") | ||
if os.path.isfile(_abc_candidate): | ||
sys._pyosys_abc = _abc_candidate | ||
|
||
__all__ = ["libyosys"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
from pyosys import libyosys as ys | ||
|
||
__dir__ = os.path.dirname(os.path.abspath(__file__)) | ||
add_sub = os.path.join(__dir__, "..", "common", "add_sub.v") | ||
|
||
base = ys.Design() | ||
ys.run_pass(f"read_verilog {add_sub}", base) | ||
ys.run_pass("hierarchy -top top", base) | ||
ys.run_pass("proc", base) | ||
ys.run_pass("equiv_opt -assert -map +/ecp5/cells_sim.v synth_ecp5", base) | ||
|
||
postopt = ys.Design() | ||
ys.run_pass("design -load postopt", postopt) | ||
ys.run_pass("cd top", postopt) | ||
ys.run_pass("select -assert-min 25 t:LUT4", postopt) | ||
ys.run_pass("select -assert-max 26 t:LUT4", postopt) | ||
ys.run_pass("select -assert-count 10 t:PFUMX", postopt) | ||
ys.run_pass("select -assert-count 6 t:L6MUX21", postopt) | ||
ys.run_pass("select -assert-none t:LUT4 t:PFUMX t:L6MUX21 %% t:* %D", postopt) |