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

Apply style fixes etc

parent 12d27738
Branches wdfadaptors
No related tags found
1 merge request!428Draft: Add more WDF adaptors
Pipeline #123854 passed
Showing
with 49 additions and 19 deletions
......@@ -2,6 +2,7 @@
Graphical user interface for B-ASIC.
"""
from b_asic.GUI.main_window import start_editor
__all__ = ['start_editor']
"""
B-ASIC port button module.
"""
from typing import TYPE_CHECKING
from qtpy.QtCore import QMimeData, Qt, Signal
......
"""
B-ASIC window to show precedence graph.
"""
from qtpy.QtCore import Qt, Signal
from qtpy.QtWidgets import (
QCheckBox,
......
......@@ -162,10 +162,12 @@ class PropertiesWindow(QDialog):
self.operation.operation.set_latency_offsets(
{
port: float(latency_edit.text().replace(",", "."))
if latency_edit.text()
and float(latency_edit.text().replace(",", ".")) > 0
else None
port: (
float(latency_edit.text().replace(",", "."))
if latency_edit.text()
and float(latency_edit.text().replace(",", ".")) > 0
else None
)
for port, latency_edit in self._latency_fields.items()
}
)
......
"""
B-ASIC select SFG window.
"""
from typing import TYPE_CHECKING
from qtpy.QtCore import Qt, Signal
......
"""
B-ASIC window to simulate an SFG.
"""
from typing import TYPE_CHECKING, Dict
from qtpy.QtCore import Qt, Signal
......
"""B-ASIC - Better ASIC Toolbox.
ASIC toolbox that simplifies circuit design and optimization.
"""
# Python modules.
from b_asic.core_operations import *
from b_asic.graph_component import *
......
"""
Module for code generation of VHDL entity declarations
"""
from typing import Set, TextIO
from b_asic.codegen.vhdl import VHDL_TAB, write_lines
......
......@@ -73,6 +73,7 @@ class Constant(AbstractOperation):
def __str__(self) -> str:
return f"{self.value}"
class Addition(AbstractOperation):
"""
Binary addition operation.
......@@ -240,6 +241,7 @@ class AddSub(AbstractOperation):
========
Addition, Subtraction
"""
is_linear = True
def __init__(
......@@ -317,6 +319,7 @@ class Multiplication(AbstractOperation):
========
ConstantMultiplication
"""
is_swappable = True
def __init__(
......@@ -450,6 +453,7 @@ class Min(AbstractOperation):
========
Max
"""
is_swappable = True
def __init__(
......@@ -515,6 +519,7 @@ class Max(AbstractOperation):
========
Min
"""
is_swappable = True
def __init__(
......@@ -729,6 +734,7 @@ class ConstantMultiplication(AbstractOperation):
--------
Multiplication
"""
is_linear = True
def __init__(
......@@ -802,6 +808,7 @@ class Butterfly(AbstractOperation):
execution_time : int, optional
Operation execution time (time units before operator can be reused).
"""
is_linear = True
def __init__(
......@@ -865,6 +872,7 @@ class MAD(AbstractOperation):
Multiplication
Addition
"""
is_swappable = True
def __init__(
......@@ -1196,6 +1204,7 @@ class Shift(AbstractOperation):
raise TypeError("value must be an int")
self.set_param("value", value)
class Sink(AbstractOperation):
r"""
Sink operation.
......
"""
Qt button for use in preference dialogs, selecting color.
"""
from qtpy.QtCore import Qt, Signal
from qtpy.QtGui import QColor
from qtpy.QtWidgets import QColorDialog, QPushButton
......
......@@ -347,6 +347,7 @@ class InputPort(AbstractPort):
Returns the input port of the first delay element in the chain.
"""
from b_asic.special_operations import Delay
if not isinstance(number, int) or number < 0:
raise TypeError("Number of delays must be a positive integer")
tmp_signal = None
......
......@@ -63,9 +63,11 @@ def sfg_to_python(
if attr != "latency" and hasattr(comp, attr)
}
params = {
attr: getattr(comp, attr)
if not isinstance(getattr(comp, attr), str)
else f'"{getattr(comp, attr)}"'
attr: (
getattr(comp, attr)
if not isinstance(getattr(comp, attr), str)
else f'"{getattr(comp, attr)}"'
)
for attr in params_filtered
}
params = {k: v for k, v in params.items() if v}
......@@ -153,9 +155,11 @@ def python_to_sfg(path: str) -> Tuple[SFG, Dict[str, Tuple[int, int]]]:
exec(code, globals(), locals())
return (
locals()["prop"]["name"]
if "prop" in locals()
else [v for k, v in locals().items() if isinstance(v, SFG)][0],
(
locals()["prop"]["name"]
if "prop" in locals()
else [v for k, v in locals().items() if isinstance(v, SFG)][0]
),
locals()["positions"] if "positions" in locals() else {},
)
......
......@@ -3,6 +3,7 @@ B-ASIC Scheduler-gui Module.
Graphical user interface for B-ASIC scheduler.
"""
from b_asic.scheduler_gui.main_window import start_scheduler
__all__ = ['start_scheduler']
......@@ -69,12 +69,10 @@ class SchedulerEvent: # PyQt5
# Filters #
###########
@overload
def installSceneEventFilters(self, filterItems: QGraphicsItem) -> None:
...
def installSceneEventFilters(self, filterItems: QGraphicsItem) -> None: ...
@overload
def installSceneEventFilters(self, filterItems: List[QGraphicsItem]) -> None:
...
def installSceneEventFilters(self, filterItems: List[QGraphicsItem]) -> None: ...
def installSceneEventFilters(self, filterItems) -> None:
"""
......@@ -88,12 +86,10 @@ class SchedulerEvent: # PyQt5
item.installSceneEventFilter(self)
@overload
def removeSceneEventFilters(self, filterItems: QGraphicsItem) -> None:
...
def removeSceneEventFilters(self, filterItems: QGraphicsItem) -> None: ...
@overload
def removeSceneEventFilters(self, filterItems: List[QGraphicsItem]) -> None:
...
def removeSceneEventFilters(self, filterItems: List[QGraphicsItem]) -> None: ...
def removeSceneEventFilters(self, filterItems) -> None:
"""
......
......@@ -5,7 +5,6 @@ Contains the scheduler_gui SignalItem class for drawing and maintaining a signal
in the schedule.
"""
from typing import TYPE_CHECKING, cast
from qtpy.QtCore import QPointF
......
......@@ -3,6 +3,7 @@ B-ASIC signal flow graph generators.
This module contains a number of functions generating SFGs for specific functions.
"""
from typing import Dict, Optional, Sequence, Union
import numpy as np
......
......@@ -3,6 +3,7 @@ B-ASIC Signal Module.
Contains the class for representing the connections between operations.
"""
from typing import TYPE_CHECKING, Iterable, Optional, Union
from b_asic.graph_component import AbstractGraphComponent, GraphComponent
......
......@@ -3,6 +3,7 @@ B-ASIC Core Operations Module.
Contains wave digital filter adaptors.
"""
from typing import Dict, Iterable, Optional, Tuple
from b_asic.graph_component import Name, TypeName
......@@ -21,6 +22,7 @@ class SymmetricTwoportAdaptor(AbstractOperation):
y_1 & = & x_0 + \text{value}\times\left(x_1 - x_0\right)
\end{eqnarray}
"""
is_linear = True
is_swappable = True
......@@ -91,6 +93,7 @@ class SeriesTwoportAdaptor(AbstractOperation):
Port 1 is the dependent port.
"""
is_linear = True
is_swappable = True
......@@ -166,6 +169,7 @@ class ParallelTwoportAdaptor(AbstractOperation):
Port 1 is the dependent port.
"""
is_linear = True
is_swappable = True
......@@ -242,6 +246,7 @@ class SeriesThreeportAdaptor(AbstractOperation):
Port 2 is the dependent port.
"""
is_linear = True
is_swappable = True
......@@ -312,6 +317,7 @@ class ReflectionFreeSeriesThreeportAdaptor(AbstractOperation):
Port 1 is the reflection-free port and port 2 is the dependent port.
"""
is_linear = True
is_swappable = True
......
......@@ -3,6 +3,7 @@
Introduction example for the TSTE87 course
==========================================
"""
from b_asic.core_operations import Addition, ConstantMultiplication
from b_asic.signal_flow_graph import SFG
from b_asic.special_operations import Delay, Input, Output
......
......@@ -14,6 +14,7 @@ Node numbering from the original SFG used with the Matlab toolbox::
sfg=addoperand(sfg,'delay',1,3,4);
sfg=addoperand(sfg,'out',1,7);
"""
from b_asic.signal_flow_graph import SFG
from b_asic.special_operations import Delay, Input, Output
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment