mirror of
https://github.com/YosysHQ/yosys
synced 2025-10-08 17:01:57 +00:00
- Rewrite all Python features to use the pybind11 library instead of boost::python. Unlike boost::python, pybind11 is a header-only library that is just included by Pyosys code, saving a lot of compile time on wheels. - Factor out as much "translation" code from the generator into proper C++ files - Fix running the embedded interpreter not supporting "from pyosys import libyosys as ys" like wheels - Move Python-related elements to `pyosys` directory at the root of the repo - Slight shift in bridging semantics: - Containers are declared as "opaque types" and are passed by reference to Python - many methods have been implemented to make them feel right at home without the overhead/ambiguity of copying to Python and then copying back after mutation - Monitor/Pass use "trampoline" pattern to support virual methods overridable in Python: virtual methods no longer require `py_` prefix - Create really short test set for pyosys that just exercises basic functionality
21 lines
775 B
Python
21 lines
775 B
Python
from pathlib import Path
|
|
from pyosys import libyosys as ys
|
|
|
|
|
|
__file_dir__ = Path(__file__).absolute().parent
|
|
add_sub = __file_dir__.parent / "arch" / "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)
|