Source code for pacman.operations.router_compressors.ordered_covering_router_compressor.ordered_covering_compressor

# Copyright (c) 2017-2019 The University of Manchester
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <>.

import logging
from spinn_utilities.log import FormatAdapter
from pacman.operations.router_compressors import (AbstractCompressor, Entry)
from .ordered_covering import minimise

logger = FormatAdapter(logging.getLogger(__name__))

[docs]class OrderedCoveringCompressor(AbstractCompressor): """ Compressor from rig that has been tied into the main tool chain stack. """ __slots__ = [] def __init__(self): super().__init__(True)
[docs] def compress_table(self, router_table): """ :param UnCompressedMulticastRoutingTable router_table: :rtype: list(Entry) """ # convert to rig inspired format entries = list() # handle entries for router_entry in router_table.multicast_routing_entries: # Add the new entry entries.append(Entry.from_MulticastRoutingEntry(router_entry)) # compress the router entries compressed_router_table_entries = minimise(entries) return compressed_router_table_entries
class MundyRouterCompressor(OrderedCoveringCompressor): """ DEPRECATED use OrderedCoveringCompressor """ def __new__(cls, *args, **kwargs): logger.warning( "MundyRouterCompressor algorithm name is deprecated. " "Please use OrderedCoveringCompressor instead. " "Remove algorithms from your cfg to use defaults") return super().__new__(cls, *args, **kwargs)