3 from pyosys
import libyosys
as ys
5 import matplotlib
.pyplot
as plt
8 class CellStatsPass(ys
.Pass
):
11 super().__init
__("cell_stats", "Shows cell stats as plot")
14 ys
.log("This pass uses the matplotlib library to display cell stats\n")
16 def py_execute(self
, args
, design
):
17 ys
.log_header(design
, "Plotting cell stats\n")
19 for module
in design
.selected_whole_modules_warn():
20 for cell
in module
.selected_cells():
21 if cell
.type.str() in cell_stats
:
22 cell_stats
[cell
.type.str()] += 1
24 cell_stats
[cell
.type.str()] = 1
25 plt
.bar(range(len(cell_stats
)), height
= list(cell_stats
.values()),align
='center')
26 plt
.xticks(range(len(cell_stats
)), list(cell_stats
.keys()))
29 def py_clear_flags(self
):
30 ys
.log("Clear Flags - CellStatsPass\n")