Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • da/B-ASIC
  • lukja239/B-ASIC
  • robal695/B-ASIC
3 results
Show changes
Commits on Source (4)
......@@ -526,6 +526,37 @@ class Schedule:
"""
self._sfg.set_execution_time_of_type(type_name, execution_time)
def set_latency_of_type(
self, type_name: TypeName, latency: int
) -> None:
"""
Set the latency of all operations with the given type name.
Parameters
----------
type_name : TypeName
The type name of the operation. For example, obtained as
``Addition.type_name()``.
latency : int
The latency of the operation.
"""
passed = True
for op in self._sfg.operations:
if type_name == op.type_name() or type_name == op.graph_id:
change_in_latency = latency - op.latency
if change_in_latency > (self.forward_slack(op.graph_id)):
passed = False
raise ValueError(
f"Error: Can't increase latency for all components. Try increassing forward slack time by rescheduling. "
f"Error in: {op.graph_id}"
)
break
if change_in_latency < 0 or passed:
for op in self._sfg.operations:
if type_name == op.type_name() or type_name == op.graph_id:
cast(Operation, op).set_latency(latency)
def move_y_location(
self, graph_id: GraphID, new_y: int, insert: bool = False
) -> None:
......@@ -1052,6 +1083,21 @@ class Schedule:
y = np.array(_y)
xy = np.stack((x + op_start_time, y + y_pos))
ax.add_patch(Polygon(xy.T, fc=_LATENCY_COLOR))
if 'in' in str(graph_id):
ax.annotate(
graph_id,
xy=(op_start_time - 0.48, y_pos + 0.7),
color="black",
size=10 - (0.05 * len(self._start_times)),
)
else:
ax.annotate(
graph_id,
xy=(op_start_time + 0.03, y_pos + 0.7),
color="black",
size=10 - (0.05 * len(self._start_times)),
)
if execution_time_coordinates:
_x, _y = zip(*execution_time_coordinates)
x = np.array(_x)
......@@ -1164,7 +1210,8 @@ class Schedule:
-------
The Matplotlib Figure.
"""
fig, ax = plt.subplots()
height = len(self._start_times) * 0.3 + 2
fig, ax = plt.subplots(figsize=(12, height))
self._plot_schedule(ax, operation_gap=operation_gap)
return fig
......@@ -1173,7 +1220,8 @@ class Schedule:
Generate an SVG of the schedule. This is automatically displayed in e.g.
Jupyter Qt console.
"""
fig, ax = plt.subplots()
height = len(self._start_times) * 0.3 + 2
fig, ax = plt.subplots(figsize=(12, height))
self._plot_schedule(ax)
buffer = io.StringIO()
fig.savefig(buffer, format="svg")
......
......@@ -90,6 +90,10 @@ class Impulse(SignalGenerator):
The delay before the signal goes to 1 for one sample.
"""
__slots__ = ("_delay",)
_delay: int
def __init__(self, delay: int = 0) -> None:
self._delay = delay
......@@ -110,6 +114,10 @@ class Step(SignalGenerator):
The delay before the signal goes to 1.
"""
__slots__ = ("_delay",)
_delay: int
def __init__(self, delay: int = 0) -> None:
self._delay = delay
......@@ -130,6 +138,10 @@ class Constant(SignalGenerator):
The constant.
"""
__slots__ = ("_constant",)
_constant: complex
def __init__(self, constant: complex = 1.0) -> None:
self._constant = constant
......@@ -150,6 +162,11 @@ class ZeroPad(SignalGenerator):
The data that should be padded.
"""
__slots__ = ("_data", "_len")
_data: Sequence[complex]
_len: int
def __init__(self, data: Sequence[complex]) -> None:
self._data = data
self._len = len(data)
......@@ -175,7 +192,13 @@ class FromFile(SignalGenerator):
Path to input file.
"""
def __init__(self, path) -> None:
__slots__ = ("_data", "_len", "_path")
_path: str
_data: List[Num]
_len: int
def __init__(self, path: str) -> None:
self._path = path
data: List[Num] = np.loadtxt(path, dtype=complex).tolist()
self._data = data
......@@ -203,6 +226,11 @@ class Sinusoid(SignalGenerator):
The normalized phase offset.
"""
__slots__ = ("_frequency", "_phase")
_frequency: float
_phase: float
def __init__(self, frequency: float, phase: float = 0.0) -> None:
self._frequency = frequency
self._phase = phase
......@@ -234,6 +262,12 @@ class Gaussian(SignalGenerator):
The standard deviation of the noise.
"""
__slots__ = ("_rng", "_seed", "_loc", "_scale")
_seed: Optional[int]
_loc: float
_scale: float
def __init__(
self, seed: Optional[int] = None, loc: float = 0.0, scale: float = 1.0
) -> None:
......@@ -273,6 +307,12 @@ class Uniform(SignalGenerator):
The upper value of the uniform range.
"""
__slots__ = ("_rng", "_seed", "_low", "_high")
_seed: Optional[int]
_low: float
_high: float
def __init__(
self, seed: Optional[int] = None, low: float = -1.0, high: float = 1.0
) -> None:
......@@ -313,6 +353,11 @@ class Delay(SignalGenerator):
The number of time units to delay the generated signal.
"""
__slots__ = ("_delay", "_generator")
_generator: SignalGenerator
_delay: int
def __init__(self, generator: SignalGenerator, delay: int = 1) -> None:
self._generator = generator
self._delay = delay
......@@ -329,6 +374,11 @@ class _AddGenerator(SignalGenerator):
Signal generator that adds two signals.
"""
__slots__ = ("_a", "_b")
_a: SignalGenerator
_b: SignalGenerator
def __init__(self, a: SignalGenerator, b: SignalGenerator) -> None:
self._a = a
self._b = b
......@@ -345,6 +395,11 @@ class _SubGenerator(SignalGenerator):
Signal generator that subtracts two signals.
"""
__slots__ = ("_a", "_b")
_a: SignalGenerator
_b: SignalGenerator
def __init__(self, a: SignalGenerator, b: SignalGenerator) -> None:
self._a = a
self._b = b
......@@ -361,6 +416,11 @@ class _MulGenerator(SignalGenerator):
Signal generator that multiplies two signals.
"""
__slots__ = ("_a", "_b")
_a: SignalGenerator
_b: SignalGenerator
def __init__(self, a: SignalGenerator, b: SignalGenerator) -> None:
self._a = a
self._b = b
......@@ -387,6 +447,11 @@ class _DivGenerator(SignalGenerator):
Signal generator that divides two signals.
"""
__slots__ = ("_a", "_b")
_a: SignalGenerator
_b: SignalGenerator
def __init__(self, a: SignalGenerator, b: SignalGenerator) -> None:
self._a = a
self._b = b
......@@ -428,6 +493,12 @@ class Upsample(SignalGenerator):
The phase of the upsampling.
"""
__slots__ = ("_generator", "_factor", "_phase")
_generator: Union[SignalGenerator, Sequence[complex]]
_factor: int
_phase: int
def __init__(
self,
data: Union[SignalGenerator, Sequence[complex]],
......@@ -467,6 +538,12 @@ class Downsample(SignalGenerator):
The phase of the downsampling.
"""
__slots__ = ("_generator", "_factor", "_phase")
_generator: Union[SignalGenerator, Sequence[complex]]
_factor: int
_phase: int
def __init__(
self,
data: Union[SignalGenerator, Sequence[complex]],
......
......@@ -9,9 +9,9 @@ dependencies = [
"numpy",
"qtpy",
"graphviz>=0.19",
"matplotlib",
"matplotlib>=3.7",
"setuptools_scm[toml]>=6.2",
"networkx",
"networkx>=3",
"qtawesome"
]
classifiers = [
......
test/baseline_images/test_schedule/test__get_figure_no_execution_times.png

36.6 KiB | W: 0px | H: 0px

test/baseline_images/test_schedule/test__get_figure_no_execution_times.png

49.4 KiB | W: 0px | H: 0px

test/baseline_images/test_schedule/test__get_figure_no_execution_times.png
test/baseline_images/test_schedule/test__get_figure_no_execution_times.png
test/baseline_images/test_schedule/test__get_figure_no_execution_times.png
test/baseline_images/test_schedule/test__get_figure_no_execution_times.png
  • 2-up
  • Swipe
  • Onion skin