b_asic.resource_assigner

B-ASIC Resource Assigner Module.

Contains functions for joint resource assignment of processing elements and memories.

b_asic.resource_assigner.assign_processing_elements_and_memories(operations: ProcessCollection, memory_variables: ProcessCollection, strategy: Literal['ilp_graph_color', 'ilp_min_total_mux'] = 'ilp_graph_color', resources: dict[TypeName, int] | None = None, max_memories: int | None = None, memory_read_ports: int | None = None, memory_write_ports: int | None = None, memory_total_ports: int | None = None, solver: LpSolver | None = None) tuple[list[ProcessingElement], list[Memory], ProcessCollection]

Assign PEs and memories jointly using ILP.

Parameters:
operationsProcessCollection

All operations from a schedule.

memory_variablesProcessCollection

All memory variables from a schedule.

strategystr, default: “left_edge”

The strategy used when assigning resources. Valid options are:

  • “ilp_graph_color” - ILP-based optimal resource assignment.

  • “ilp_min_total_mux” - ILP-based optimal resource assignment with multiplexer minimization.

resourcesdict[TypeName, int], optional

The maximum amount of resources to assign to, used to limit the solution space for performance gains.

max_memoriesint, optional

The maximum amount of memories to assign to, used to limit the solution space for performance gains.

memory_read_portsint, optional

The number of read ports used when splitting process collection based on memory variable access.

memory_write_portsint, optional

The number of write ports used when splitting process collection based on memory variable access.

memory_total_portsint, optional

The total number of ports used when splitting process collection based on memory variable access.

solverLpSolver, optional

Solver to use. To see which solvers are available:

import pulp

print(pulp.listSolvers(onlyAvailable=True))
Returns:
A tuple containing one list of assigned PEs and one list of assigned memories.