diff --git a/b_asic/architecture.py b/b_asic/architecture.py index 4ea6d8730ab35d8b1944aac62989cba2a2d26086..6e10d0f660f7f24be9ef17528b10e514d78e3b84 100644 --- a/b_asic/architecture.py +++ b/b_asic/architecture.py @@ -399,8 +399,8 @@ class ProcessingElement(Resource): if not isinstance(process_collection, ProcessCollection): raise TypeError( - "Argument process_collection is of wrong type" - " when creating ProcessingElement" + "Argument process_collection must be ProcessCollection, " + f"not {type(process_collection)}" ) if not all( diff --git a/b_asic/scheduler.py b/b_asic/scheduler.py index cdcc6d8177b2e57fa01938e5e102810bff49cf8e..bf9a2474c9e72d1c0f57da0a33a98f9127a25dc5 100644 --- a/b_asic/scheduler.py +++ b/b_asic/scheduler.py @@ -69,15 +69,11 @@ class ListScheduler(Scheduler, ABC): else: self._max_resources = {} - self._max_concurrent_reads = ( - max_concurrent_reads if max_concurrent_reads else sys.maxsize - ) - self._max_concurrent_writes = ( - max_concurrent_writes if max_concurrent_writes else sys.maxsize - ) + self._max_concurrent_reads = max_concurrent_reads or sys.maxsize + self._max_concurrent_writes = max_concurrent_writes or sys.maxsize - self._input_times = input_times if input_times else {} - self._output_delta_times = output_delta_times if output_delta_times else {} + self._input_times = input_times or {} + self._output_delta_times = output_delta_times or {} def apply_scheduling(self, schedule: "Schedule") -> None: """Applies the scheduling algorithm on the given Schedule. @@ -92,9 +88,9 @@ class ListScheduler(Scheduler, ABC): used_resources_ready_times = {} remaining_resources = self._max_resources.copy() if Input.type_name() not in remaining_resources: - remaining_resources |= {Input.type_name(): 1} + remaining_resources[Input.type_name()] = 1 if Output.type_name() not in remaining_resources: - remaining_resources |= {Output.type_name(): 1} + remaining_resources[Output.type_name()] = 1 sorted_operations = self._get_sorted_operations(schedule) diff --git a/test/integration/test_sfg_to_architecture.py b/test/integration/test_sfg_to_architecture.py index 3f8c810ed3d3d16101cec986697a9c58733bd1fb..c07e9766d1a3e52e18f55afdfc4ba4f8f55e1e4e 100644 --- a/test/integration/test_sfg_to_architecture.py +++ b/test/integration/test_sfg_to_architecture.py @@ -48,7 +48,7 @@ def test_pe_constrained_schedule(): mads = mads.split_on_execution_time() with pytest.raises( TypeError, - match="Argument process_collection is of wrong type when creating ProcessingElement", + match="Argument process_collection must be ProcessCollection, not <class 'list'>", ): ProcessingElement(mads, entity_name="mad")