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(schedule: Schedule, *, strategy: Literal['ilp_graph_color', 'ilp_min_mux', 'greedy_graph_color', 'left_edge'] = 'ilp_graph_color', max_mux_size: int | None = None, resources: dict[TypeName, int] | None = None, max_mems: int | None = None, memory_read_ports: int | None = None, memory_write_ports: int | None = None, memory_total_ports: int | None = None, memory_type: Literal['RAM', 'register'] = 'RAM', solver: LpSolver | None = None) tuple[list[ProcessingElement], list[Memory], ProcessCollection]

Assign PEs and memories jointly using ILP.

Parameters:
scheduleSchedule

The schedule containing the operations and memory variables to assign resources to.

strategystr, default: “ilp_graph_color”

The strategy used when assigning resources. Valid options are:

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

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

  • “greedy_graph_color” - Greedy graph coloring-based resource assignment.

  • “left_edge” - Left-edge coloring-based resource assignment.

max_mux_sizeint, optional

The maximum fan-in size for any enabled multiplexer target in strategy=’ilp_min_mux’. Must be greater than or equal to 1. Only valid with ‘ilp_min_mux’ strategy.

resourcesdict[TypeName, int], optional

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

max_memsint, 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.

memory_type{‘RAM’, ‘register’}, default: ‘RAM’

The type of memory to assign to.

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.