b_asic.schedule¶
B-ASIC Schedule Module.
Contains the schedule class for scheduling operations in an SFG.
- class b_asic.schedule.Schedule(sfg: SFG, scheduler: Scheduler | None = None, schedule_time: int | None = None, cyclic: bool = False, start_times: dict[GraphID, int] | None = None, laps: dict[GraphID, int] | None = None)¶
Bases:
objectSchedule of an SFG with scheduled Operations.
- Parameters:
- sfg
SFG The signal flow graph to schedule.
- scheduler
Scheduler, optional The automatic scheduler to be used.
- schedule_timeint, optional
The schedule time. If not provided, it will be determined by the scheduling algorithm.
- cyclicbool, default: False
If the schedule is cyclic.
- start_timesdict, optional
Dictionary with GraphIDs as keys and start times as values. Used when algorithm is ‘provided’.
- lapsdict, optional
Dictionary with GraphIDs as keys and laps as values. Used when algorithm is ‘provided’.
- sfg
- backward_slack(graph_id: GraphID) int¶
Return how much an operation can be moved backward in time.
- Parameters:
- graph_idGraphID
The graph id of the operation.
- Returns:
- int
The number of time steps the operation with graph_id can be moved backward in time.
Note
The backward slack is positive, but a call to
move_operation()should be negative to move the operation backward.
See also
forward_slackslacks
- decrease_time_resolution(factor: int) Schedule¶
Decrease time resolution for a schedule.
- Parameters:
- factorint
The time resolution decrement.
- edit(inplace=False) Schedule¶
Edit schedule in GUI and return new schedule.
- Parameters:
- inplacebool, default: False
If True, replace the current schedule.
- forward_slack(graph_id: GraphID) int¶
Return how much an operation can be moved forward in time.
- Parameters:
- graph_idGraphID
The graph id of the operation.
- Returns:
- int
The number of time steps the operation with graph_id can be moved forward in time.
See also
backward_slackslacks
- get_io_latency() dict[GraphID, dict[GraphID, int]]¶
Return the latency between each Input/Output pair.
The latency is the minimum number of
Delayelements on any path from aInputto aOutput, multiplied by the schedule time, plus the difference in their start times within the schedule.
- get_memory_variables() ProcessCollection¶
Return a ProcessCollection containing all memory variables.
- Returns:
- get_operations() ProcessCollection¶
Return a ProcessCollection containing all operations.
- Returns:
- get_possible_time_resolution_decrements() list[int]¶
Return a list with possible factors to reduce time resolution.
- get_y_location(graph_id: GraphID) int¶
Get the y-location of the Operation with GraphID graph_id.
- Parameters:
- graph_idGraphID
The GraphID of the operation.
- Returns:
- int
The y-location of the operation.
- increase_time_resolution(factor: int) Schedule¶
Increase time resolution for a schedule.
- Parameters:
- factorint
The time resolution increment.
- property laps: dict[GraphID, int]¶
The number of laps for the start times of the operations in the schedule.
- move_operation(graph_id: GraphID, time: int) Schedule¶
Move an operation in the schedule.
- Parameters:
- graph_idGraphID
The graph id of the operation to move.
- timeint
The time to move. If positive move forward, if negative move backward.
- move_operation_alap(graph_id: GraphID) Schedule¶
Move an operation as late as possible in the schedule.
This is basically the same as:
schedule.move_operation(graph_id, schedule.forward_slack(graph_id))
but operations with no succeeding operation (Outputs) will only move to the end of the schedule.
- Parameters:
- graph_idGraphID
The graph id of the operation to move.
- move_operation_asap(graph_id: GraphID) Schedule¶
Move an operation as soon as possible in the schedule.
This is basically the same as:
schedule.move_operation(graph_id, -schedule.backward_slack(graph_id))
but operations that do not have a preceding operation (Inputs and Constants) will only move to the start of the schedule.
- Parameters:
- graph_idGraphID
The graph id of the operation to move.
- move_y_location(graph_id: GraphID, new_y: int, insert: bool = False) None¶
Move operation in y-direction and remove any empty rows.
- Parameters:
- graph_idGraphID
The GraphID of the operation to move.
- new_yint
The new y-location of the operation.
- insertbool, optional
If True, all operations on that y-location will be moved one position. The default is False.
- plot(ax: Axes, operation_gap: float = 0.5) None¶
Plot the schedule in a
matplotlib.axes.Axesor subclass.- Parameters:
- ax
Axes The
matplotlib.axes.Axesto plot in.- operation_gapfloat, optional
The vertical distance between operations in the schedule. The height of the operation is always 1.
- ax
- print_slacks(order: int = 0, type_name: TypeName | None = None) None¶
Print the slack times for all operations in the schedule.
- Parameters:
- orderint, default: 0
Sorting order.
0: alphabetical on Graph ID
1: backward slack
2: forward slack
- type_nameTypeName, optional
If given, only the slack times for operations of this type will be printed.
- set_execution_time_of_type(operation_type: type[Operation], execution_time: int) None¶
Set the execution time of all operations of the given type.
- Parameters:
- operation_typetype of Operation
The operation type. For example,
Addition.- execution_timeint
The execution time of the operation.
- set_execution_time_of_type_name(type_name: TypeName, execution_time: int) None¶
Set the execution time of all operations with the given type name.
- Parameters:
- type_nameTypeName
The type name of the operation. For example, obtained as
Addition.type_name().- execution_timeint
The execution time of the operation.
- set_latency_of_type(operation_type: type[Operation], latency: int) None¶
Set the latency of all operations of the given type.
- Parameters:
- operation_typetype of Operation
The operation type. For example,
Addition.- latencyint
The latency of the operation.
- set_latency_of_type_name(type_name: TypeName | GraphID, latency: int) None¶
Set the latency of all operations with the given type name.
- Parameters:
- type_nameTypeName or GraphID
The type name of the operation, e.g., obtained as
Addition.type_name()or a specific GraphID of an operation.- latencyint
The latency of the operation.
- set_schedule_time(time: int) Schedule¶
Set a new schedule time.
- Parameters:
- timeint
The new schedule time. If it is too short, a ValueError will be raised.
See also
get_max_time
- set_y_location(graph_id: GraphID, y_location: int) None¶
Set the y-location of the Operation with GraphID graph_id to y_location.
- Parameters:
- graph_idGraphID
The GraphID of the operation to move.
- y_locationint
The new y-location of the operation.
- show(fmt: str = 'pdf', operation_gap: float = 0.5, title: str | None = None, fontname: str | None = 'Times New Roman', fontsize: int | None = None, figsize: tuple[float, float] | None = None) None¶
Show the schedule in the default system viewer.
- Parameters:
- fmtstr, default: “pdf”
File format to render (e.g.
"pdf","png","svg").- operation_gapfloat, optional
The vertical distance between operations in the schedule. The height of the operation is always 1.
- titlestr, optional
Figure title.
- fontnamestr, default: “Times New Roman”
Font to use for all text in the figure.
- fontsizeint, optional
Base font size for all text in the figure.
- figsize(float, float), optional
Figure size in inches as
(width, height). Overrides the automatically computed height.
- slacks(graph_id: GraphID) tuple[int, int]¶
Return the backward and forward slacks of operation graph_id.
That is, how much the operation can be moved backward and forward in time.
- Parameters:
- graph_idGraphID
The graph id of the operation.
- Returns:
- tuple(int, int)
The backward and forward slacks, respectively.
Note
The backward slack is positive, but a call to
move_operation()should be negative to move the operation backward.
See also
- sort_y_locations_on_start_times() None¶
Sort the y-locations of the schedule based on start times of the operations.
Inputs, outputs, dontcares, and sinks are located adjacent to the operations that they are connected to.
See also