diff --git a/spinnman/messages/scp/impl/fixed_route_read.py b/spinnman/messages/scp/impl/fixed_route_read.py index 8ddfa7a5c..5b31746c4 100644 --- a/spinnman/messages/scp/impl/fixed_route_read.py +++ b/spinnman/messages/scp/impl/fixed_route_read.py @@ -15,7 +15,7 @@ import struct from typing import List from spinn_utilities.overrides import overrides -from spinn_machine import FixedRouteEntry +from spinn_machine import RoutingEntry from spinnman.exceptions import SpinnmanUnexpectedResponseCodeException from spinnman.messages.scp import SCPRequestHeader from spinnman.messages.scp.abstract_messages import ( @@ -48,11 +48,11 @@ def read_data_bytestring(self, data: bytes, offset: int): self._route = _ONE_WORD.unpack_from(data, offset)[0] @property - def route(self) -> FixedRouteEntry: + def route(self) -> RoutingEntry: """ Converts this response into a Route - :rtype: FixedRouteEntry + :rtype: RoutingEntry """ processor_ids: List[int] = list() for processor_id in range(26): @@ -62,7 +62,7 @@ def route(self) -> FixedRouteEntry: for link_id in range(6): if self._route & (1 << link_id) != 0: link_ids.append(link_id) - return FixedRouteEntry(processor_ids, link_ids) + return RoutingEntry(processor_ids=processor_ids, link_ids=link_ids) class FixedRouteRead(AbstractSCPRequest[_FixedRouteResponse]): diff --git a/spinnman/processes/get_routes_process.py b/spinnman/processes/get_routes_process.py index ce30b8fde..971c41f91 100644 --- a/spinnman/processes/get_routes_process.py +++ b/spinnman/processes/get_routes_process.py @@ -16,7 +16,7 @@ from functools import partial from typing import List, Optional -from spinn_machine import MulticastRoutingEntry, Router +from spinn_machine import MulticastRoutingEntry, RoutingEntry from spinnman.messages.scp.impl.read_memory import ReadMemory, Response from spinnman.constants import UDP_MESSAGE_MAX_SIZE @@ -64,13 +64,8 @@ def _add_routing_entry( if self._app_id is not None and self._app_id != app_id: return - # Convert bit-set into list of (set) IDs - processor_ids, link_ids = \ - Router.convert_spinnaker_route_to_routing_ids(route) - self._entries[route_no + offset] = MulticastRoutingEntry( - key, mask, processor_ids=processor_ids, link_ids=link_ids, - defaultable=False) + key, mask, RoutingEntry(spinnaker_route=route)) def __handle_response(self, offset: int, response: Response): for route_no in range(_ENTRIES_PER_READ): diff --git a/spinnman/processes/load_fixed_route_routing_entry_process.py b/spinnman/processes/load_fixed_route_routing_entry_process.py index 42f7f2c15..b9c24fb12 100644 --- a/spinnman/processes/load_fixed_route_routing_entry_process.py +++ b/spinnman/processes/load_fixed_route_routing_entry_process.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from spinn_machine import FixedRouteEntry, Router +from spinn_machine import Router, RoutingEntry from spinnman.messages.scp.impl import FixedRouteInit from spinnman.processes import AbstractMultiConnectionProcess @@ -24,14 +24,14 @@ class LoadFixedRouteRoutingEntryProcess(AbstractMultiConnectionProcess): __slots__ = () def load_fixed_route( - self, x: int, y: int, fixed_route: FixedRouteEntry, + self, x: int, y: int, fixed_route: RoutingEntry, app_id: int = 0): """ :param int x: The x-coordinate of the chip, between 0 and 255; this is not checked due to speed restrictions. :param int y: The y-coordinate of the chip, between 0 and 255; this is not checked due to speed restrictions. - :param ~spinn_machine.FixedRouteEntry fixed_route: + :param ~spinn_machine.RoutingEntry fixed_route: the fixed route entry :param int app_id: The ID of the application with which to associate the routes. If not specified, defaults to 0. diff --git a/spinnman/processes/load_routes_process.py b/spinnman/processes/load_routes_process.py index 3985e6a46..50bacd523 100644 --- a/spinnman/processes/load_routes_process.py +++ b/spinnman/processes/load_routes_process.py @@ -67,7 +67,7 @@ def load_routes( _ROUTE_PATTERN.pack_into( routing_data, n_entries * 16, n_entries, - route_entry, route.routing_entry_key, route.mask) + route_entry, route.key, route.mask) n_entries += 1 # Add an entry to mark the end diff --git a/spinnman/processes/read_fixed_route_routing_entry_process.py b/spinnman/processes/read_fixed_route_routing_entry_process.py index 15e125c8b..9c9b8b9c8 100644 --- a/spinnman/processes/read_fixed_route_routing_entry_process.py +++ b/spinnman/processes/read_fixed_route_routing_entry_process.py @@ -14,7 +14,7 @@ from typing import Optional -from spinn_machine.fixed_route_entry import FixedRouteEntry +from spinn_machine import RoutingEntry from spinnman.messages.scp.impl.fixed_route_read import ( FixedRouteRead, _FixedRouteResponse) @@ -39,13 +39,13 @@ def __init__(self, connection_selector: ConnectionSelector): the SC&MP connection selector """ super().__init__(connection_selector) - self._route: Optional[FixedRouteEntry] = None + self._route: Optional[RoutingEntry] = None def __handle_read_response(self, response: _FixedRouteResponse): self._route = response.route def read_fixed_route( - self, x: int, y: int, app_id: int = 0) -> FixedRouteEntry: + self, x: int, y: int, app_id: int = 0) -> RoutingEntry: """ Read the fixed route entry installed on a particular chip's router. @@ -56,7 +56,7 @@ def read_fixed_route( :param int app_id: The ID of the application with which to associate the routes. If not specified, defaults to 0. - :rtype: ~spinn_machine.FixedRouteEntry + :rtype: ~spinn_machine.RoutingEntry """ with self._collect_responses(): self._send_request(FixedRouteRead(x, y, app_id), diff --git a/spinnman/transceiver/base_transceiver.py b/spinnman/transceiver/base_transceiver.py index fa0b83ad7..89c5bf8d6 100644 --- a/spinnman/transceiver/base_transceiver.py +++ b/spinnman/transceiver/base_transceiver.py @@ -34,7 +34,7 @@ from spinn_utilities.progress_bar import ProgressBar from spinn_utilities.typing.coords import XY from spinn_machine import ( - CoreSubsets, FixedRouteEntry, Machine, MulticastRoutingEntry) + CoreSubsets, Machine, MulticastRoutingEntry, RoutingEntry) from spinn_machine.tags import AbstractTag, IPTag, ReverseIPTag from spinnman.connections.abstract_classes import Connection from spinnman.connections.udp_packet_connections import SDPConnection @@ -1251,7 +1251,7 @@ def load_multicast_routes( @overrides(Transceiver.load_fixed_route) def load_fixed_route( - self, x: int, y: int, fixed_route: FixedRouteEntry, app_id: int): + self, x: int, y: int, fixed_route: RoutingEntry, app_id: int): try: process = LoadFixedRouteRoutingEntryProcess( self._scamp_connection_selector) @@ -1261,7 +1261,7 @@ def load_fixed_route( raise @overrides(Transceiver.read_fixed_route) - def read_fixed_route(self, x: int, y: int, app_id: int) -> FixedRouteEntry: + def read_fixed_route(self, x: int, y: int, app_id: int) -> RoutingEntry: try: process = ReadFixedRouteRoutingEntryProcess( self._scamp_connection_selector) diff --git a/spinnman/transceiver/mockable_transceiver.py b/spinnman/transceiver/mockable_transceiver.py index 126ee9732..496a3a23b 100644 --- a/spinnman/transceiver/mockable_transceiver.py +++ b/spinnman/transceiver/mockable_transceiver.py @@ -21,7 +21,7 @@ from spinn_utilities.progress_bar import ProgressBar from spinn_utilities.typing.coords import XY from spinn_machine import ( - CoreSubsets, FixedRouteEntry, Machine, MulticastRoutingEntry) + CoreSubsets, Machine, MulticastRoutingEntry, RoutingEntry) from spinn_machine.tags import AbstractTag, IPTag, ReverseIPTag from spinnman.data import SpiNNManDataView from spinnman.connections.abstract_classes import Connection @@ -208,11 +208,11 @@ def load_multicast_routes( @overrides(Transceiver.load_fixed_route) def load_fixed_route( - self, x: int, y: int, fixed_route: FixedRouteEntry, app_id: int): + self, x: int, y: int, fixed_route: RoutingEntry, app_id: int): pass @overrides(Transceiver.read_fixed_route) - def read_fixed_route(self, x: int, y: int, app_id: int) -> FixedRouteEntry: + def read_fixed_route(self, x: int, y: int, app_id: int) -> RoutingEntry: raise NotImplementedError("Needs to be mocked") @overrides(Transceiver.get_multicast_routes) diff --git a/spinnman/transceiver/transceiver.py b/spinnman/transceiver/transceiver.py index d33103274..b02c129a6 100644 --- a/spinnman/transceiver/transceiver.py +++ b/spinnman/transceiver/transceiver.py @@ -21,7 +21,7 @@ from spinn_utilities.progress_bar import ProgressBar from spinn_utilities.typing.coords import XY from spinn_machine import ( - CoreSubsets, FixedRouteEntry, Machine, MulticastRoutingEntry) + CoreSubsets, Machine, MulticastRoutingEntry, RoutingEntry) from spinn_machine.tags import AbstractTag, IPTag, ReverseIPTag from spinnman.connections.abstract_classes import Connection from spinnman.connections.udp_packet_connections import ( @@ -779,7 +779,7 @@ def load_multicast_routes( @abstractmethod def load_fixed_route( - self, x: int, y: int, fixed_route: FixedRouteEntry, app_id: int): + self, x: int, y: int, fixed_route: RoutingEntry, app_id: int): """ Loads a fixed route routing table entry onto a chip's router. @@ -787,7 +787,7 @@ def load_fixed_route( The x-coordinate of the chip onto which to load the routes :param int y: The y-coordinate of the chip onto which to load the routes - :param ~spinn_machine.FixedRouteEntry fixed_route: + :param ~spinn_machine.RoutingEntry fixed_route: the route for the fixed route entry on this chip :param int app_id: The ID of the application with which to associate the routes. If not specified, defaults to 0. @@ -804,7 +804,7 @@ def load_fixed_route( raise NotImplementedError("abstractmethod") @abstractmethod - def read_fixed_route(self, x: int, y: int, app_id: int) -> FixedRouteEntry: + def read_fixed_route(self, x: int, y: int, app_id: int) -> RoutingEntry: """ Reads a fixed route routing table entry from a chip's router.