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

Fix move process

parent a811046e
No related branches found
No related tags found
1 merge request!387Fix move process
Pipeline #97443 passed
...@@ -277,6 +277,7 @@ class Resource(HardwareBlock): ...@@ -277,6 +277,7 @@ class Resource(HardwareBlock):
if not isinstance(proc, self.operation_type): if not isinstance(proc, self.operation_type):
raise KeyError(f"{proc} not of type {self.operation_type}") raise KeyError(f"{proc} not of type {self.operation_type}")
self.collection.add_process(proc) self.collection.add_process(proc)
self._assignment = None
def remove_process(self, proc): def remove_process(self, proc):
self.collection.remove_process(proc) self.collection.remove_process(proc)
...@@ -512,6 +513,10 @@ of :class:`~b_asic.architecture.ProcessingElement` ...@@ -512,6 +513,10 @@ of :class:`~b_asic.architecture.ProcessingElement`
return schedule_times.pop() return schedule_times.pop()
def _build_dicts(self) -> None: def _build_dicts(self) -> None:
self._variable_inport_to_resource: Dict[InputPort, Tuple[Resource, int]] = {}
self._variable_outport_to_resource: Dict[OutputPort, Tuple[Resource, int]] = {}
self._operation_inport_to_resource: Dict[InputPort, Resource] = {}
self._operation_outport_to_resource: Dict[OutputPort, Resource] = {}
for pe in self.processing_elements: for pe in self.processing_elements:
for operator in pe.processes: for operator in pe.processes:
for input_port in operator.operation.inputs: for input_port in operator.operation.inputs:
...@@ -676,11 +681,12 @@ of :class:`~b_asic.architecture.ProcessingElement` ...@@ -676,11 +681,12 @@ of :class:`~b_asic.architecture.ProcessingElement`
proc = re_from.collection.from_name(proc) proc = re_from.collection.from_name(proc)
# Move the process. # Move the process.
if proc not in re_from.collection: if proc in re_from:
raise KeyError(f"{proc} not in {re_from}")
else:
re_to.add_process(proc) re_to.add_process(proc)
re_from.remove_process(proc) re_from.remove_process(proc)
else:
raise KeyError(f"{proc} not in {re_from.entity_name}")
self._build_dicts()
def _digraph(self) -> Digraph: def _digraph(self) -> Digraph:
edges: Set[Tuple[str, str, str]] = set() edges: Set[Tuple[str, str, str]] = set()
......
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