コード例 #1
0
ファイル: host_data_read.py プロジェクト: Scaatis/SpiNNMan
 def __init__(self, region_id, sequence_no, space_read):
     EIEIOCommandMessage.__init__(
         self, EIEIOCommandHeader(
             constants.EIEIO_COMMAND_IDS.NEW_BUFFERS.value))
     self._region_id = region_id
     self._sequence_no = sequence_no
     self._space_read = space_read
コード例 #2
0
    def __init__(
            self, n_requests, sequence_no, channel, region_id, space_read):
        if not isinstance(channel, list):
            channel = [channel]

        if not isinstance(region_id, list):
            region_id = [region_id]

        if not isinstance(space_read, list):
            space_read = [space_read]

        if len(channel) != n_requests or \
                len(region_id) != n_requests or \
                len(space_read) != n_requests:
            raise SpinnmanInvalidPacketException(
                "SpinnakerRequestReadData",
                "The format for a SpinnakerRequestReadData packet is "
                "invalid: {0:d} request(s), {1:d} space(s) read "
                "defined, {2:d} region(s) defined, {3:d} channel(s) "
                "defined".format(
                    n_requests, len(space_read), len(region_id), len(channel)))
        cmd_header = EIEIOCommandHeader(
            constants.EIEIO_COMMAND_IDS.HOST_DATA_READ.value)
        EIEIOCommandMessage.__init__(self, cmd_header)
        self._header = _HostDataReadHeader(n_requests, sequence_no)
        self._acks = _HostDataReadAck(channel, region_id, space_read)
コード例 #3
0
    def __init__(self, x, y, p, region_id, sequence_no, n_requests,
                 channel, start_address, space_to_be_read):
        if not isinstance(channel, list):
            channel = [channel]

        if not isinstance(region_id, list):
            region_id = [region_id]

        if not isinstance(start_address, list):
            start_address = [start_address]

        if not isinstance(space_to_be_read, list):
            space_to_be_read = [space_to_be_read]

        if len(start_address) != n_requests or \
                len(space_to_be_read) != n_requests or \
                len(channel) != n_requests or \
                len(region_id) != n_requests:
            raise SpinnmanInvalidPacketException(
                "SpinnakerRequestReadData",
                "The format for a SpinnakerRequestReadData packet is "
                "invalid: {0:d} request(s), {1:d} start address(es) "
                "defined, {2:d} space(s) to be read defined, {3:d} region(s) "
                "defined, {4:d} channel(s) defined".format(
                    n_requests, len(start_address), len(space_to_be_read),
                    len(region_id), len(channel)))
        EIEIOCommandMessage.__init__(
            self, EIEIOCommandHeader(
                constants.EIEIO_COMMAND_IDS.SPINNAKER_REQUEST_READ_DATA.value))
        self._header = _SpinnakerRequestReadDataHeader(
            x, y, p, n_requests, sequence_no)
        self._requests = _SpinnakerRequestReadDataRequest(
            channel, region_id, start_address, space_to_be_read)
コード例 #4
0
 def __init__(self, region_id, sequence_no, eieio_data_message):
     EIEIOCommandMessage.__init__(
         self, EIEIOCommandHeader(
             constants.EIEIO_COMMAND_IDS.HOST_SEND_SEQUENCED_DATA.value))
     self._region_id = region_id
     self._sequence_no = sequence_no
     self._eieio_data_message = eieio_data_message
コード例 #5
0
 def __init__(self, region_id, sequence_no, eieio_data_message):
     EIEIOCommandMessage.__init__(
         self,
         EIEIOCommandHeader(
             constants.EIEIO_COMMAND_IDS.HOST_SEND_SEQUENCED_DATA.value))
     self._region_id = region_id
     self._sequence_no = sequence_no
     self._eieio_data_message = eieio_data_message
コード例 #6
0
 def __init__(self, x, y, p, region_id, sequence_no, space_available):
     EIEIOCommandMessage.__init__(
         self, EIEIOCommandHeader(
             constants.EIEIO_COMMAND_IDS.SPINNAKER_REQUEST_BUFFERS.value))
     self._x = x
     self._y = y
     self._p = p
     self._region_id = region_id
     self._sequence_no = sequence_no
     self._space_available = space_available
コード例 #7
0
 def __init__(self, x, y, p, region_id, sequence_no, space_available):
     EIEIOCommandMessage.__init__(
         self,
         EIEIOCommandHeader(
             constants.EIEIO_COMMAND_IDS.SPINNAKER_REQUEST_BUFFERS.value))
     self._x = x
     self._y = y
     self._p = p
     self._region_id = region_id
     self._sequence_no = sequence_no
     self._space_available = space_available
コード例 #8
0
ファイル: stop_requests.py プロジェクト: Scaatis/SpiNNMan
 def __init__(self):
     EIEIOCommandMessage.__init__(
         self, EIEIOCommandHeader(
             constants.EIEIO_COMMAND_IDS.STOP_SENDING_REQUESTS.value))
コード例 #9
0
 def __init__(self, database_path=None):
     EIEIOCommandMessage.__init__(
         self, EIEIOCommandHeader(
             constants.EIEIO_COMMAND_IDS.DATABASE_CONFIRMATION.value))
     self._database_path = database_path
コード例 #10
0
 def __init__(self):
     EIEIOCommandMessage.__init__(
         self, EIEIOCommandHeader(
             constants.EIEIO_COMMAND_IDS.EVENT_STOP.value))
コード例 #11
0
 def __init__(self):
     EIEIOCommandMessage.__init__(
         self,
         EIEIOCommandHeader(
             constants.EIEIO_COMMAND_IDS.STOP_SENDING_REQUESTS.value))
コード例 #12
0
 def __init__(self):
     EIEIOCommandMessage.__init__(
         self, EIEIOCommandHeader(
             constants.EIEIO_COMMAND_IDS.EVENT_STOP.value))
コード例 #13
0
def read_eieio_command_message(data, offset):
    """ Reads the content of an EIEIO command message and returns an object\
        identifying the command which was contained in the packet, including\
        any parameter, if required by the command

    :param data: data received from the network
    :type data: bytestring
    :param offset: offset at which the parsing operation should start
    :type offset: int
    :return: an object which inherits from EIEIOCommandMessage which contains\
            parsed data received from the network
    :rtype: \
            :py:class:`spinnman.messages.eieio.command_messages.eieio_command_message.EIEIOCommandMessage`
    """
    command_header = EIEIOCommandHeader.from_bytestring(data, offset)
    command_number = command_header.command

    if (command_number ==
            constants.EIEIO_COMMAND_IDS.DATABASE_CONFIRMATION.value):
        return DatabaseConfirmation.from_bytestring(command_header, data,
                                                    offset + 2)

    # Fill in buffer area with padding
    elif (command_number == constants.EIEIO_COMMAND_IDS.EVENT_PADDING.value):
        return PaddingRequest()

    # End of all buffers, stop execution
    elif (command_number == constants.EIEIO_COMMAND_IDS.EVENT_STOP.value):
        return EventStopRequest()

    # Stop complaining that there is sdram free space for buffers
    elif (command_number ==
          constants.EIEIO_COMMAND_IDS.STOP_SENDING_REQUESTS.value):
        return StopRequests()

    # Start complaining that there is sdram free space for buffers
    elif (command_number ==
          constants.EIEIO_COMMAND_IDS.START_SENDING_REQUESTS.value):
        return StartRequests()

    # Spinnaker requesting new buffers for spike source population
    elif (command_number ==
          constants.EIEIO_COMMAND_IDS.SPINNAKER_REQUEST_BUFFERS.value):
        return SpinnakerRequestBuffers.from_bytestring(command_header, data,
                                                       offset + 2)

    # Buffers being sent from host to SpiNNaker
    elif (command_number ==
          constants.EIEIO_COMMAND_IDS.HOST_SEND_SEQUENCED_DATA.value):
        return HostSendSequencedData.from_bytestring(command_header, data,
                                                     offset + 2)

    # Buffers available to be read from a buffered out vertex
    elif (command_number ==
          constants.EIEIO_COMMAND_IDS.SPINNAKER_REQUEST_READ_DATA.value):
        return SpinnakerRequestReadData.from_bytestring(
            command_header, data, offset + 2)

    # Host confirming data being read form SpiNNaker memory
    elif (command_number == constants.EIEIO_COMMAND_IDS.HOST_DATA_READ.value):
        return HostDataRead.from_bytestring(command_header, data, offset + 2)
    return EIEIOCommandMessage(command_header, data, offset + 2)
コード例 #14
0
 def __init__(self, database_path=None):
     EIEIOCommandMessage.__init__(
         self, EIEIOCommandHeader(
             constants.EIEIO_COMMAND_IDS.DATABASE_CONFIRMATION.value))
     self._database_path = database_path