diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-04-22 14:47:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-22 14:47:52 +0200 |
commit | 99d5435650c38fb96dc364c0fd4ac6250a4871ea (patch) | |
tree | cc638feaa89ef0be5acbc0f157dfc6764812fc11 /examples/python-api/script.py | |
parent | 0e7901e45cc54a9bf76a86dd58092f310f72c90a (diff) | |
parent | e19981ab6111765baa5b2ab7a16c92278130fd8b (diff) | |
download | yosys-99d5435650c38fb96dc364c0fd4ac6250a4871ea.tar.gz yosys-99d5435650c38fb96dc364c0fd4ac6250a4871ea.tar.bz2 yosys-99d5435650c38fb96dc364c0fd4ac6250a4871ea.zip |
Merge pull request #905 from christian-krieg/feature/python_bindings
Feature/python bindings
Diffstat (limited to 'examples/python-api/script.py')
-rwxr-xr-x | examples/python-api/script.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/python-api/script.py b/examples/python-api/script.py new file mode 100755 index 000000000..f0fa5a0b8 --- /dev/null +++ b/examples/python-api/script.py @@ -0,0 +1,22 @@ +#!/usr/bin/python3 + +from pyosys import libyosys as ys + +import matplotlib.pyplot as plt +import numpy as np + +design = ys.Design() +ys.run_pass("read_verilog ../../tests/simple/fiedler-cooley.v", design); +ys.run_pass("prep", design) +ys.run_pass("opt -full", design) + +cell_stats = {} +for module in design.selected_whole_modules_warn(): + for cell in module.selected_cells(): + if cell.type.str() in cell_stats: + cell_stats[cell.type.str()] += 1 + else: + cell_stats[cell.type.str()] = 1 +plt.bar(range(len(cell_stats)), height = list(cell_stats.values()),align='center') +plt.xticks(range(len(cell_stats)), list(cell_stats.keys())) +plt.show() |