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

Various cleanups, performance improvements, and new method

parent 669e44a3
No related tags found
1 merge request!495Various cleanups, performance improvements, and new method
Pipeline #158981 passed
...@@ -265,7 +265,7 @@ class Resource(HardwareBlock): ...@@ -265,7 +265,7 @@ class Resource(HardwareBlock):
self.plot_content(ax, **kwargs) self.plot_content(ax, **kwargs)
height = 0.4 height = 0.4
if title: if title:
height += 0.4 height = 0.8
fig.suptitle(title) fig.suptitle(title)
fig.set_figheight(math.floor(max(ax.get_ylim())) * 0.3 + height) fig.set_figheight(math.floor(max(ax.get_ylim())) * 0.3 + height)
fig.show() # type: ignore fig.show() # type: ignore
......
This diff is collapsed.
...@@ -7,7 +7,7 @@ Contains the signal flow graph operation. ...@@ -7,7 +7,7 @@ Contains the signal flow graph operation.
import itertools import itertools
import re import re
import warnings import warnings
from collections import defaultdict, deque from collections import Counter, defaultdict, deque
from collections.abc import Iterable, MutableSet, Sequence from collections.abc import Iterable, MutableSet, Sequence
from fractions import Fraction from fractions import Fraction
from io import StringIO from io import StringIO
...@@ -2066,6 +2066,10 @@ class SFG(AbstractOperation): ...@@ -2066,6 +2066,10 @@ class SFG(AbstractOperation):
paths.append(newpath) paths.append(newpath)
return paths return paths
def operation_counter(self) -> Counter:
"""Return a Counter with the number of instances for each type."""
return Counter(op.type_name() for op in self.operations)
def edit(self) -> dict[str, "SFG"]: def edit(self) -> dict[str, "SFG"]:
"""Edit SFG in GUI.""" """Edit SFG in GUI."""
from b_asic.GUI.main_window import start_editor from b_asic.GUI.main_window import start_editor
......
""" """
========================================= =========================================
Auto Scheduling With Custom IO times Automatic scheduling with custom IO times
========================================= =========================================
It is possible to specify the IO times and provide those to the scheduling.
""" """
from b_asic.core_operations import Butterfly, ConstantMultiplication from b_asic.core_operations import Butterfly, ConstantMultiplication
...@@ -31,7 +32,8 @@ schedule1 = Schedule(sfg, scheduler=ASAPScheduler()) ...@@ -31,7 +32,8 @@ schedule1 = Schedule(sfg, scheduler=ASAPScheduler())
schedule1.show() schedule1.show()
# %% # %%
# Generate a non-cyclic Schedule from HybridScheduler with custom IO times. # Generate a non-cyclic Schedule from HybridScheduler with custom IO times,
# one input and output per time unit
resources = {Butterfly.type_name(): 1, ConstantMultiplication.type_name(): 1} resources = {Butterfly.type_name(): 1, ConstantMultiplication.type_name(): 1}
input_times = {f"in{i}": i for i in range(points)} input_times = {f"in{i}": i for i in range(points)}
output_delta_times = {f"out{i}": i for i in range(points)} output_delta_times = {f"out{i}": i for i in range(points)}
......
""" """
================================ ==================================================
Automatic Scheduling for different latency-offsets. Automatic scheduling for different latency-offsets
================================ ==================================================
This example showcases how one can generate a schedule where the This example showcases how one can generate a schedule where the
operations have different latency offsets for the different inputs/outputs. operations have different latency offsets for the different inputs/outputs.
......
""" """
========================================= ===============================
LDLT Matrix Inversion Algorithm LDLT matrix inversion algorithm
========================================= ===============================
This provides some examples of the different list-based schedulers that are
available in B-ASIC.
""" """
from b_asic.architecture import Memory, ProcessingElement from b_asic.architecture import Memory, ProcessingElement
...@@ -44,26 +46,27 @@ print("Scheduling time:", schedule.schedule_time) ...@@ -44,26 +46,27 @@ print("Scheduling time:", schedule.schedule_time)
schedule.show() schedule.show()
# %% # %%
# Create an EarliestDeadline schedule that satisfies the resource constraints. # Create an earliest deadline schedule that uses one MADS and one Reciprocal PE.
resources = {MADS.type_name(): 1, Reciprocal.type_name(): 1} resources = {MADS.type_name(): 1, Reciprocal.type_name(): 1}
schedule = Schedule(sfg, scheduler=EarliestDeadlineScheduler(resources)) schedule = Schedule(sfg, scheduler=EarliestDeadlineScheduler(resources))
print("Scheduling time:", schedule.schedule_time) print("Scheduling time:", schedule.schedule_time)
schedule.show() schedule.show()
# %% # %%
# Create a LeastSlackTime schedule that satisfies the resource constraints. # Create a least slack-time schedule that uses one MADS and one Reciprocal PE.
schedule = Schedule(sfg, scheduler=LeastSlackTimeScheduler(resources)) schedule = Schedule(sfg, scheduler=LeastSlackTimeScheduler(resources))
print("Scheduling time:", schedule.schedule_time) print("Scheduling time:", schedule.schedule_time)
schedule.show() schedule.show()
# %% # %%
# Create a MaxFanOutScheduler schedule that satisfies the resource constraints. # Create a max fan-out schedule that uses one MADS and one Reciprocal PE.
schedule = Schedule(sfg, scheduler=MaxFanOutScheduler(resources)) schedule = Schedule(sfg, scheduler=MaxFanOutScheduler(resources))
print("Scheduling time:", schedule.schedule_time) print("Scheduling time:", schedule.schedule_time)
schedule.show() schedule.show()
# %% # %%
# Create a HybridScheduler schedule that satisfies the resource constraints with custom IO times. # Create a HybridScheduler schedule that one MADS and one Reciprocal PE with
# custom IO times.
# This is the schedule we will synthesize an architecture for. # This is the schedule we will synthesize an architecture for.
input_times = { input_times = {
"in0": 0, "in0": 0,
......
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