Skip to content
Snippets Groups Projects
Commit d1af9c2e authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Last code formatting fixes

parent 7a72892d
Branches
No related tags found
1 merge request!362Last code formatting fixes
Pipeline #96816 passed
...@@ -24,7 +24,7 @@ def b_asic_preamble(f: TextIOWrapper): ...@@ -24,7 +24,7 @@ def b_asic_preamble(f: TextIOWrapper):
try: try:
process = Popen(['git', 'rev-parse', '--short', 'HEAD'], stdout=PIPE) process = Popen(['git', 'rev-parse', '--short', 'HEAD'], stdout=PIPE)
git_commit_id = process.communicate()[0].decode('utf-8').strip() git_commit_id = process.communicate()[0].decode('utf-8').strip()
except: except: # noqa: E722
pass pass
vhdl.write_lines( vhdl.write_lines(
f, f,
......
...@@ -11,7 +11,7 @@ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as Navigatio ...@@ -11,7 +11,7 @@ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as Navigatio
from matplotlib.figure import Figure from matplotlib.figure import Figure
from matplotlib.ticker import MaxNLocator from matplotlib.ticker import MaxNLocator
from qtpy.QtCore import Qt from qtpy.QtCore import Qt
from qtpy.QtWidgets import ( # QFrame,; QScrollArea,; QLineEdit,; QSizePolicy,; QLabel,; QFileDialog,; QShortcut, from qtpy.QtWidgets import (
QApplication, QApplication,
QCheckBox, QCheckBox,
QHBoxLayout, QHBoxLayout,
...@@ -35,7 +35,8 @@ class PlotWindow(QWidget): ...@@ -35,7 +35,8 @@ class PlotWindow(QWidget):
Parameters Parameters
---------- ----------
sim_result : dict sim_result : dict
Simulation results of the form obtained from :attr:`~b_asic.simulation.Simulation.results`. Simulation results of the form obtained from
:attr:`~b_asic.simulation.Simulation.results`.
sfg_name : str, optional sfg_name : str, optional
The name of the SFG. The name of the SFG.
parent : optional parent : optional
...@@ -161,9 +162,7 @@ class PlotWindow(QWidget): ...@@ -161,9 +162,7 @@ class PlotWindow(QWidget):
list_item = QListWidgetItem(key) list_item = QListWidgetItem(key)
listitems[key] = list_item listitems[key] = list_item
self._checklist.addItem(list_item) self._checklist.addItem(list_item)
list_item.setCheckState( list_item.setCheckState(Qt.CheckState.Unchecked)
Qt.CheckState.Unchecked # CheckState: Qt.CheckState.{Unchecked, PartiallyChecked, Checked}
)
for key in initially_checked: for key in initially_checked:
listitems[key].setCheckState(Qt.CheckState.Checked) listitems[key].setCheckState(Qt.CheckState.Checked)
# self._checklist.setFixedWidth(150) # self._checklist.setFixedWidth(150)
...@@ -202,13 +201,6 @@ class PlotWindow(QWidget): ...@@ -202,13 +201,6 @@ class PlotWindow(QWidget):
self._legend = self._plot_axes.legend() self._legend = self._plot_axes.legend()
self._plot_canvas.draw() self._plot_canvas.draw()
# def _ontop_checkbox_change(self, checkState):
# Bugg: It seems the window closes if you change the WindowStaysOnTopHint.
# (Nothing happens if "changing" from False to False or True to True)
# self.setWindowFlag(Qt.WindowStaysOnTopHint, on = (checkState == Qt.CheckState.Checked))
# self.setWindowFlag(Qt.WindowStaysOnTopHint, on = True)
# print("_ontop_checkbox_change")
def _button_all_click(self, event): def _button_all_click(self, event):
self._auto_redraw = False self._auto_redraw = False
for x in range(self._checklist.count()): for x in range(self._checklist.count()):
...@@ -253,7 +245,8 @@ def start_simulation_dialog( ...@@ -253,7 +245,8 @@ def start_simulation_dialog(
Parameters Parameters
---------- ----------
sim_results : dict sim_results : dict
Simulation results of the form obtained from :attr:`~b_asic.simulation.Simulation.results`. Simulation results of the form obtained from
:attr:`~b_asic.simulation.Simulation.results`.
sfg_name : str, optional sfg_name : str, optional
The name of the SFG. The name of the SFG.
""" """
......
...@@ -58,9 +58,10 @@ def _sanitize_port_option( ...@@ -58,9 +58,10 @@ def _sanitize_port_option(
Returns Returns
------- -------
Returns a triple int tuple (read_ports, write_ports, total_ports) equal to the input, or sanitized if one of the input equals None. Returns a triple int tuple (read_ports, write_ports, total_ports) equal to the
If total_ports is set to None at the input, it is set to read_ports+write_ports at the output. input, or sanitized if one of the input equals None. If total_ports is set to None
If read_ports or write_ports is set to None at the input, it is set to total_ports at the output. at the input, it is set to read_ports+write_ports at the output. If read_ports or
write_ports is set to None at the input, it is set to total_ports at the output.
""" """
if total_ports is None: if total_ports is None:
...@@ -1091,18 +1092,18 @@ class ProcessCollection: ...@@ -1091,18 +1092,18 @@ class ProcessCollection:
Word length of the memory variable objects. Word length of the memory variable objects.
assignment : set assignment : set
A possible cell assignment to use when generating the memory based storage. A possible cell assignment to use when generating the memory based storage.
The cell assignment is a dictionary int to ProcessCollection where the integer The cell assignment is a dictionary int to ProcessCollection where the
corresponds to the cell to assign all MemoryVariables in corresponding process integer corresponds to the cell to assign all MemoryVariables in
collection. corresponding process collection.
If unset, each MemoryVariable will be assigned to a unique single cell. If unset, each MemoryVariable will be assigned to a unique single cell.
read_ports : int, default: 1 read_ports : int, default: 1
The number of read ports used when splitting process collection based on The number of read ports used when splitting process collection based on
memory variable access. If total ports in unset, this parameter has to be set memory variable access. If total ports in unset, this parameter has to be
and total_ports is assumed to be read_ports + write_ports. set and total_ports is assumed to be read_ports + write_ports.
write_ports : int, default: 1 write_ports : int, default: 1
The number of write ports used when splitting process collection based on The number of write ports used when splitting process collection based on
memory variable access. If total ports is unset, this parameter has to be set memory variable access. If total ports is unset, this parameter has to be
and total_ports is assumed to be read_ports + write_ports. set and total_ports is assumed to be read_ports + write_ports.
total_ports : int, default: 2 total_ports : int, default: 2
The total number of ports used when splitting process collection based on The total number of ports used when splitting process collection based on
memory variable access. memory variable access.
...@@ -1219,9 +1220,11 @@ class ProcessCollection: ...@@ -1219,9 +1220,11 @@ class ProcessCollection:
total_ports: int = 2, total_ports: int = 2,
): ):
""" """
Generate VHDL code for register based storages of processes based on Forward-Backward Register Allocation [1]. Generate VHDL code for register based storages of processes based on
Forward-Backward Register Allocation [1].
[1]: K. Parhi: VLSI Digital Signal Processing Systems: Design and Implementation, Ch. 6.3.2 [1]: K. Parhi: VLSI Digital Signal Processing Systems: Design and
Implementation, Ch. 6.3.2
Parameters Parameters
---------- ----------
...@@ -1233,12 +1236,12 @@ class ProcessCollection: ...@@ -1233,12 +1236,12 @@ class ProcessCollection:
Name used for the VHDL entity. Name used for the VHDL entity.
read_ports : int, default: 1 read_ports : int, default: 1
The number of read ports used when splitting process collection based on The number of read ports used when splitting process collection based on
memory variable access. If total ports in unset, this parameter has to be set memory variable access. If total ports in unset, this parameter has to be
and total_ports is assumed to be read_ports + write_ports. set and total_ports is assumed to be read_ports + write_ports.
write_ports : int, default: 1 write_ports : int, default: 1
The number of write ports used when splitting process collection based on The number of write ports used when splitting process collection based on
memory variable access. If total ports is unset, this parameter has to be set memory variable access. If total ports is unset, this parameter has to be
and total_ports is assumed to be read_ports + write_ports. set and total_ports is assumed to be read_ports + write_ports.
total_ports : int, default: 2 total_ports : int, default: 2
The total number of ports used when splitting process collection based on The total number of ports used when splitting process collection based on
memory variable access. memory variable access.
......
...@@ -1620,8 +1620,9 @@ class SFG(AbstractOperation): ...@@ -1620,8 +1620,9 @@ class SFG(AbstractOperation):
delay = Delay(name=op.name) delay = Delay(name=op.name)
delay.graph_id = op.graph_id delay.graph_id = op.graph_id
# Since we're adding a new operation instead of bypassing as in the # Since we're adding a new operation instead of bypassing as in
# common case, we also need to hook up the inputs to the delay. # the common case, we also need to hook up the inputs to the
# delay.
delay.inputs[0].connect(source_op_output) delay.inputs[0].connect(source_op_output)
new_source_op = delay new_source_op = delay
...@@ -1633,7 +1634,8 @@ class SFG(AbstractOperation): ...@@ -1633,7 +1634,8 @@ class SFG(AbstractOperation):
for out_signal in op.outputs[0].signals: for out_signal in op.outputs[0].signals:
sink_port = out_signal.destination sink_port = out_signal.destination
if sink_port is None: if sink_port is None:
# It would be weird if we found a signal that wasn't connected anywhere # It would be weird if we found a signal that wasn't
# connected anywhere
raise ValueError("Dangling output port in sfg") raise ValueError("Dangling output port in sfg")
sink_op_idx = id_idx_map[sink_port.operation.graph_id] sink_op_idx = id_idx_map[sink_port.operation.graph_id]
...@@ -1673,15 +1675,15 @@ class SFG(AbstractOperation): ...@@ -1673,15 +1675,15 @@ class SFG(AbstractOperation):
all_ops = [op for op_list in new_ops for op in op_list] all_ops = [op for op_list in new_ops for op in op_list]
# To get the input order correct, we need to know the input order in the original # To get the input order correct, we need to know the input order in the
# sfg and which operations they correspond to # original sfg and which operations they correspond to
input_ids = [op.graph_id for op in self.input_operations] input_ids = [op.graph_id for op in self.input_operations]
output_ids = [op.graph_id for op in self.output_operations] output_ids = [op.graph_id for op in self.output_operations]
# Re-order the inputs to the correct order. Internal order of the inputs should # Re-order the inputs to the correct order. Internal order of the inputs should
# be preserved, i.e. for a graph with 2 inputs (in1, in2), in1 must occur before in2, # be preserved, i.e. for a graph with 2 inputs (in1, in2), in1 must occur before
# but the "time" order should be reversed. I.e. the input from layer `factor-1` is the # in2, but the "time" order should be reversed. I.e. the input from layer
# first input # `factor-1` is the first input
all_inputs = list( all_inputs = list(
itertools.chain.from_iterable( itertools.chain.from_iterable(
[ [
......
...@@ -76,3 +76,6 @@ ignore_missing_imports = true ...@@ -76,3 +76,6 @@ ignore_missing_imports = true
[tool.coverage.report] [tool.coverage.report]
precision = 2 precision = 2
[tool.ruff]
ignore = ["F403"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment