def __init__(self, nearest_neighbour_id, block_no, base_address, data,
                 offset=0, length=None):
        """

        :param nearest_neighbour_id: The id of the packet, between 0 and 127
        :type nearest_neighbour_id: int
        :param block_no: Which block this block is, between 0 and 255
        :type block_no: int
        :param base_address: The base address where the data is to be loaded
        :type base_address: int
        :param data: The data to load, between 4 and 256 bytes and the size\
                    must be divisible by 4
        :type data: bytearray
        """
        self._size = length
        self._offset = offset
        self._data_to_write = data
        if length is None:
            self._size = len(data)

        argument_1 = _NNP_FORWARD_RETRY | nearest_neighbour_id
        argument_2 = (block_no << 16) | (((self._size / 4) - 1) << 8)

        super(SCPFloodFillDataRequest, self).__init__(
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
                      destination_cpu=0, destination_chip_x=0,
                      destination_chip_y=0),
            SCPRequestHeader(command=SCPCommand.CMD_FFD),
            argument_1=argument_1, argument_2=argument_2,
            argument_3=base_address, data=None)
예제 #2
0
    def __init__(self, nearest_neighbour_id, n_blocks, x=None, y=None):
        """

        :param nearest_neighbour_id: The id of the packet, between 0 and 127
        :type nearest_neighbour_id: int
        :param n_blocks: The number of blocks of data that will be sent,\
                    between 0 and 255
        :type n_blocks: int
        :param x: The x-coordindate of the chip to load the data on to.  If\
                    not specified, the data will be loaded on to all chips
        :type x: int
        :param y: The y-coordinate of the chip to load the data on to.  If\
                    not specified, the data will be loaded on to all chips
        :type y: int
        """
        key = ((_NNP_FLOOD_FILL_START << 24) | (nearest_neighbour_id << 16) |
               (n_blocks << 8))
        data = 0xFFFF
        if x is not None and y is not None:
            m = ((y & 3) * 4) + (x & 3)
            data = (((x & 0xfc) << 24) + ((y & 0xfc) << 16) +
                    (3 << 16) + (1 << m))

        super(SCPFloodFillStartRequest, self).__init__(
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
                      destination_cpu=0, destination_chip_x=0,
                      destination_chip_y=0),
            SCPRequestHeader(command=SCPCommand.CMD_NNP),
            argument_1=key, argument_2=data, argument_3=_NNP_FORWARD_RETRY)
예제 #3
0
    def __init__(self, x, y, cpu, led_states):
        """

        :param x: The x-coordinate of the chip, between 0 and 255
        :type x: int
        :param y: The y-coordinate of the chip, between 0 and 255
        :type y: int
        :param cpu: The CPU-number to use to set the LED.
        :type cpu: int
        :param led_states: A dictionary mapping LED index to state with 0 being
                           off, 1 on and 2 inverted.
        :type led_states: dict
        """
        encoded_led_states = 0
        for led, state in led_states.items():
            encoded_led_states |= {0: 2, 1: 3, 2: 1}[state] << (2 * led)

        super(SCPLEDRequest,
              self).__init__(SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                                       destination_port=0,
                                       destination_cpu=cpu,
                                       destination_chip_x=x,
                                       destination_chip_y=y),
                             SCPRequestHeader(command=SCPCommand.CMD_LED),
                             argument_1=encoded_led_states)
    def __init__(self, x, y, host, port, tag, strip):
        """
        :param x: The x-coordinate of a chip, between 0 and 255
        :type x: int
        :param y: The y-coordinate of a chip, between 0 and 255
        :type y: int
        :param host: The host address, as an array of 4 bytes
        :type host: bytearray
        :param port: The port, between 0 and 65535
        :type port: int
        :param tag: The tag, between 0 and 7
        :type tag: int
        :param strip: if the SDP header should be striped from the packet.
        :type strip: bool
        """
        strip_value = 0
        if strip:
            strip_value = 1

        super(SCPIPTagSetRequest, self).__init__(
            SDPHeader(
                flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
                destination_cpu=0, destination_chip_x=x,
                destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_IPTAG),
            argument_1=(strip_value << 28) | (_IPTAG_SET << 16) | tag,
            argument_2=port,
            argument_3=((host[3] << 24) | (host[2] << 16) |
                        (host[1] << 8) | host[0]))
예제 #5
0
    def __init__(self, nearest_neighbour_id, app_id=0, processors=None):
        """

        :param nearest_neighbour_id: The id of the packet, between 0 and 127
        :type nearest_neighbour_id: int
        :param app_id: The application id to start using the data, between 16\
                    and 255.  If not specified, no application is started
        :type app_id: int
        :param processors: A list of processors on which to start the\
                    application, each between 1 and 17.  If not specified,\
                    no application is started.
        :type processors: iterable of int
        """
        processor_mask = 0
        if processors is not None:
            for processor in processors:
                processor_mask |= (1 << processor)

        key = (_NNP_FLOOD_FILL_END << 24) | nearest_neighbour_id
        data = (app_id << 24) | processor_mask

        super(SCPFloodFillEndRequest,
              self).__init__(SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                                       destination_port=0,
                                       destination_cpu=0,
                                       destination_chip_x=0,
                                       destination_chip_y=0),
                             SCPRequestHeader(command=SCPCommand.CMD_NNP),
                             argument_1=key,
                             argument_2=data,
                             argument_3=_NNP_FORWARD_RETRY)
예제 #6
0
    def __init__(self, x, y, base_address, data, cpu=0):
        """

        :param x: The x-coordinate of the chip, between 0 and 255\
        this is not checked due to speed restrictions
        :type x: int
        :param y: The y-coordinate of the chip, between 0 and 255\
        this is not checked due to speed restrictions
        :type y: int
        :param base_address: The base_address to start writing to \
        the base address is not checked to see if its not valid
        :type base_address: int
        :param data: between 1 and 256 bytes of data to write\
        this is not checked due to speed restrictions
        :type data: bytearray or string
        """
        size = len(data)
        super(SCPWriteMemoryRequest, self).__init__(
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                      destination_port=0,
                      destination_cpu=cpu,
                      destination_chip_x=x,
                      destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_WRITE),
            argument_1=base_address,
            argument_2=size,
            argument_3=constants.address_length_dtype[(base_address % 4),
                                                      (size % 4)].value,
            data=None)
        self._data_to_write = data
    def __init__(self,
                 x,
                 y,
                 p,
                 run_time,
                 infinite_run,
                 destination_port,
                 expect_response=True):
        sdp_flags = SDPFlag.REPLY_NOT_EXPECTED
        arg3 = 0
        if expect_response:
            sdp_flags = SDPFlag.REPLY_EXPECTED
            arg3 = 1

        AbstractSCPRequest.__init__(
            self,
            SDPHeader(flags=sdp_flags,
                      destination_port=destination_port,
                      destination_cpu=p,
                      destination_chip_x=x,
                      destination_chip_y=y),
            SCPRequestHeader(command=(
                constants.SDP_RUNNING_MESSAGE_CODES.SDP_NEW_RUNTIME_ID_CODE)),
            argument_1=run_time,
            argument_2=infinite_run,
            argument_3=arg3)
    def __init__(self, x, y, base_address, size, cpu=0):
        """

        :param x: The x-coordinate of the chip to read from, between 0 and 255
        :type x: int
        :param y: The y-coordinate of the chip to read from, between 0 and 255
        :type y: int
        :param base_address: The positive base address to start the read from
        :type base_address: int
        :param size: The number of bytes to read, between 1 and 256
        :type size: int
        :raise spinnman.exceptions.SpinnmanInvalidParameterException:
                    * If the chip coordinates are out of range
                    * If the base address is not a positive number
                    * If the size is out of range
        """
        super(SCPReadMemoryRequest, self).__init__(
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                      destination_port=0,
                      destination_cpu=cpu,
                      destination_chip_x=x,
                      destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_READ),
            argument_1=base_address,
            argument_2=size,
            argument_3=constants.address_length_dtype[(base_address % 4,
                                                       size % 4)].value)
    def __init__(self, x, y, app_id, n_entries):
        """

        :param x: The x-coordinate of the chip to allocate on, between 0 and\
                    255
        :type x: int
        :param y: The y-coordinate of the chip to allocate on, between 0 and\
                    255
        :type y: int
        :param app_id: The id of the application, between 0 and 255
        :type app_id: int
        :param n_entries: The number of entries to allocate
        :type n_entries: int
        """
        super(SCPRouterAllocRequest, self).__init__(
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                      destination_port=0,
                      destination_cpu=0,
                      destination_chip_x=x,
                      destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_ALLOC),
            argument_1=(
                (app_id << 8)
                | SCPAllocFreeType.ALLOC_ROUTING.value),  # @UndefinedVariable
            argument_2=n_entries)
    def __init__(self, led, action, boards):
        """

        :param led: Number of the LED or an iterable of LEDs to set the\
                state of (0-7)
        :type led: int or iterable of int
        :param action: State to set the LED to, either on, off or toggle
        :type action:\
                :py:class:`spinnman.messages.scp.scp_led_action.SCPLEDAction`
        :param boards: Specifies the board to control the LEDs of. This may\
                also be an iterable of multiple boards (in the same frame).
        :type board: int or iterable of int
        :return: None
        """

        # set up the led entry for arg1
        if isinstance(led, int):
            leds = [led]
        else:
            leds = led

        # LED setting actions
        arg1 = sum(action.value << (led * 2) for led in leds)

        # Bitmask of boards to control
        arg2 = self.get_board_mask(boards)

        # initilise the request now
        AbstractSCPBMPRequest.__init__(
            self,
            boards,
            SCPRequestHeader(command=SCPCommand.CMD_LED),
            argument_1=arg1,
            argument_2=arg2)
예제 #11
0
    def __init__(self, fpga_num, addr, value, board):
        """ Write the value of an FPGA (SPI) register.

        See the SpI/O project's spinnaker_fpga design's `README`_ for a listing
        of FPGA registers. The SpI/O project can be found on GitHub at:
        https://github.com/SpiNNakerManchester/spio/

        .. _README: https://github.com/SpiNNakerManchester/spio/\
                    blob/master/designs/spinnaker_fpgas/README.md#spi-interface

        :param fpga_num: FPGA number (0, 1 or 2) to communicate with.
        :type fpga_num: int
        :param addr: Register address to read or write to (will be rounded
                    down to the nearest 32-bit word boundary).
        :type addr: int
        :param value: A 32-bit int value to write to the register
        :type value: int
        :return:
        """

        AbstractSCPBMPRequest.__init__(
            self,
            board,
            SCPRequestHeader(command=SCPCommand.CMD_LINK_WRITE),
            argument_1=addr & (~0x3),
            argument_2=4,
            argument_3=fpga_num,
            data=struct.pack("<I", value))
예제 #12
0
 def __init__(self, x, y, p, timeout_mantissa, timeout_exponent):
     """
     :param x: The x-coordinate of a chip, between 0 and 255
     :type x: int
     :param y: The y-coordinate of a chip, between 0 and 255
     :type y: int
     :param p: The processor running the dropped packet reinjector, between\
             0 and 17
     :type p: int
     :param timeout_mantissa: The mantissa of the timeout value, \
             between 0 and 15
     :type timeout_mantissa: int
     :param timeout_exponent: The exponent of the timeout value, \
             between 0 and 15
     """
     AbstractSCPRequest.__init__(
         self,
         SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                   destination_port=0,
                   destination_cpu=p,
                   destination_chip_x=x,
                   destination_chip_y=y),
         SCPRequestHeader(command=SCPCommand.CMD_DPRI),
         argument_1=SCPDPRICommand.SET_ROUTER_TIMEOUT.value,
         argument_2=(timeout_mantissa & 0xF) |
         ((timeout_exponent & 0xF) << 4))
예제 #13
0
    def __init__(self, app_id, signal):
        """

        :param app_id: The id of the application, between 0 and 255
        :type app_id: int
        :param signal: The signal to send
        :type signal: :py:class:`spinnman.messages.scp.scp_signal.SCPSignal`
        :raise spinnman.exceptions.SpinnmanInvalidParameterException: If\
            app_id is out of range
        """

        if app_id < 0 or app_id > 255:
            raise SpinnmanInvalidParameterException(
                "app_id", str(app_id), "Must be between 0 and 255")

        super(SCPSendSignalRequest,
              self).__init__(SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                                       destination_port=0,
                                       destination_cpu=0,
                                       destination_chip_x=0,
                                       destination_chip_y=0),
                             SCPRequestHeader(command=SCPCommand.CMD_SIG),
                             argument_1=signal.signal_type.value,
                             argument_2=_get_data(app_id, signal),
                             argument_3=_ALL_CORE_MASK)
    def __init__(self, x, y, link, base_address, data, cpu=0):
        """

        :param x: The x-coordinate of the chip whose neighbour will be written\
                    to, between 0 and 255
        :type x: int
        :param y: The y-coordinate of the chip whose neighbour will be written\
                    to, between 0 and 255
        :type y: int
        :param cpu: The CPU core to use, normally 0 (or if a BMP, the board \
                      slot number)
        :type cpu: int
        :param link: The link number to write to between 0 and 5 (or if a BMP,\
                       the FPGA between 0 and 2)
        :type link: int
        :param base_address: The base_address to start writing to
        :type base_address: int
        :param data: Up to 256 bytes of data to write
        :type data: bytearray
        """
        super(SCPWriteLinkRequest, self).__init__(
            SDPHeader(
                flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
                destination_cpu=cpu, destination_chip_x=x,
                destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_LINK_WRITE),
            argument_1=base_address, argument_2=len(data), argument_3=link,
            data=None)
        self._data_to_write = data
    def __init__(self, app_id, x, y, processors):
        """

        :param app_id: The id of the application to run, between 16 and 255
        :type app_id: int
        :param x: The x-coordinate of the chip to run on, between 0 and 255
        :type x: int
        :param y: The y-coordinate of the chip to run on, between 0 and 255
        :type y: int
        :param processors: The processors on the chip where the executable\
                    should be started, between 1 and 17
        """
        processor_mask = 0
        if processors is not None:
            for processor in processors:
                processor_mask |= (1 << processor)

        processor_mask |= (app_id << 24)

        super(SCPApplicationRunRequest,
              self).__init__(SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                                       destination_port=0,
                                       destination_cpu=0,
                                       destination_chip_x=x,
                                       destination_chip_y=y),
                             SCPRequestHeader(command=SCPCommand.CMD_AR),
                             argument_1=processor_mask)
    def __init__(self, x, y, p, packet_types):
        """
        :param x: The x-coordinate of a chip, between 0 and 255
        :type x: int
        :param y: The y-coordinate of a chip, between 0 and 255
        :type y: int
        :param p: The processor running the dropped packet reinjector, between\
                0 and 17
        :type p: int
        :param packet_types: The types of packet to reinject - if empty or\
                None reinjection is disabled
        :type packet_types: None or list of \
                `py:class:spinnman.messages.scp.scp_dpri_packet_type_flags.SCPDPRIPacketTypeFlags`
        """
        flags = 0
        if packet_types is not None:
            for packet_type in packet_types:
                flags |= packet_type.value

        AbstractSCPRequest.__init__(
            self,
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                      destination_port=0,
                      destination_cpu=p,
                      destination_chip_x=x,
                      destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_DPRI),
            argument_1=SCPDPRICommand.SET_PACKET_TYPES.value,
            argument_2=flags)
 def __init__(self, board):
     """
     :param board: The board to get the version from
     :type board: int
     :raise spinnman.exceptions.SpinnmanInvalidParameterException:
                 * If the chip coordinates are out of range
                 * If the processor is out of range
     """
     AbstractSCPBMPRequest.__init__(
         self, board, SCPRequestHeader(command=SCPCommand.CMD_VER))
    def __init__(self, board):
        """

        :param board: which board to request the adc register from
        :return:
        """
        AbstractSCPBMPRequest.__init__(
            self,
            board,
            SCPRequestHeader(command=SCPCommand.CMD_BMP_INFO),
            argument_1=SCPBMPInfoType.ADC)
예제 #19
0
    def __init__(self, x, y, app_id, base_address=None):
        """

        :param x: The x-coordinate of the chip to allocate on, between 0 and\
                    255
        :type x: int
        :param y: The y-coordinate of the chip to allocate on, between 0 and\
                    255
        :type y: int
        :param app_id: The id of the application, between 0 and 255
        :type app_id: int
        :param base_address: The start address in SDRAM to which the block\
                needs to be deallocated, or none if deallocating via app_id
        :type base_address: int or None
        """

        if base_address is not None:
            AbstractSCPRequest.__init__(
                self,
                SDPHeader(flags=SDPFlag.REPLY_NOT_EXPECTED,
                          destination_port=0,
                          destination_cpu=0,
                          destination_chip_x=x,
                          destination_chip_y=y),
                SCPRequestHeader(command=SCPCommand.CMD_ALLOC),
                argument_1=(app_id << 8
                            | SCPAllocFreeType.FREE_SDRAM_BY_POINTER.value
                            ),  # @UndefinedVariable
                argument_2=base_address)
        else:
            AbstractSCPRequest.__init__(
                self,
                SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                          destination_port=0,
                          destination_cpu=0,
                          destination_chip_x=x,
                          destination_chip_y=y),
                SCPRequestHeader(command=SCPCommand.CMD_ALLOC),
                argument_1=(app_id << 8
                            | SCPAllocFreeType.FREE_ROUTING_BY_APP_ID.value
                            ))  # @UndefinedVariable
 def __init__(self, x, y):
     """
     :param x: The x-coordinate of a chip, between 0 and 255
     :type x: int
     :param y: The y-coordinate of a chip, between 0 and 255
     :type y: int
     """
     super(SCPTagInfoRequest, self).__init__(
         SDPHeader(
             flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
             destination_cpu=0, destination_chip_x=x,
             destination_chip_y=y),
         SCPRequestHeader(command=SCPCommand.CMD_IPTAG),
         argument_1=(_IPTAG_INFO << 16),
         argument_2=_IPTAG_MAX)
예제 #21
0
    def __init__(self, x, y, n_entries, table_address, base_address, app_id):
        """

        :param x: The x-coordinate of the chip, between 0 and 255, \
        this is not checked due to speed restrictions
        :type x: int
        :param y: The y-coordinate of the chip, between 0 and 255\
        this is not checked due to speed restrictions
        :type y: int
        :param n_entries: The number of entries in the table, more than 0
        :type n_entries: int
        :param table_address: The allocated table address
        :type table_address: int
        :param base_address: The base_address containing the entries
        :type base_address: int
        :param app_id: The id of the application with which to associate the\
                    routes.  If not specified, defaults to 0.
        :type app_id: int
        :raise spinnman.exceptions.SpinnmanInvalidParameterException:\
                    * If x is out of range
                    * If y is out of range
                    * If n_entries is 0 or less
                    * If table_address is not positive
                    * If base_address is not positive
        """
        if n_entries < 1:
            raise SpinnmanInvalidParameterException("n_entries",
                                                    str(n_entries),
                                                    "Must be more than 0")
        if base_address < 0:
            raise SpinnmanInvalidParameterException(
                "base_address", str(base_address),
                "Must be a positive integer")
        if table_address < 0:
            raise SpinnmanInvalidParameterException(
                "table_address", str(table_address),
                "Must be a positive integer")

        super(SCPRouterInitRequest, self).__init__(
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                      destination_port=0,
                      destination_cpu=0,
                      destination_chip_x=x,
                      destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_RTR),
            argument_1=((n_entries << 16) | (app_id << 8) | 2),
            argument_2=table_address,
            argument_3=base_address)
예제 #22
0
 def __init__(self, x, y, tag):
     """
     :param x: The x-coordinate of a chip, between 0 and 255
     :type x: int
     :param y: The y-coordinate of a chip, between 0 and 255
     :type y: int
     :param tag: The tag, between 0 and 7
     :type tag: int
     """
     super(SCPIPTagClearRequest, self).__init__(
         SDPHeader(
             flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
             destination_cpu=0, destination_chip_x=x,
             destination_chip_y=y),
         SCPRequestHeader(command=SCPCommand.CMD_IPTAG),
         argument_1=(_IPTAG_CLEAR << 16) | tag)
    def __init__(self, app_id):
        """

        :param app_id: The id of the application, between 0 and 255
        :type app_id: int
        :param signal: The signal to send
        :type signal: :py:class:`spinnman.messages.scp.scp_signal.SCPSignal`
        """
        super(SCPAppStopRequest, self).__init__(
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                      destination_port=0,
                      destination_cpu=0,
                      destination_chip_x=0,
                      destination_chip_y=0),
            SCPRequestHeader(command=SCPCommand.CMD_NNP),
            argument_1=(0x3f << 16),
            argument_2=(5 << 28) | _get_data(app_id, SCPSignal.STOP),
            argument_3=(1 << 31) + (0x3f << 8))
    def __init__(self, app_id, state):
        """

        :param app_id: The id of the application, between 0 and 255
        :type app_id: int
        :param state: The state to count
        :type state: :py:class:`spinnman.model.cpu_state.CPUState`
        """
        super(SCPCountStateRequest,
              self).__init__(SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                                       destination_port=0,
                                       destination_cpu=0,
                                       destination_chip_x=0,
                                       destination_chip_y=0),
                             SCPRequestHeader(command=SCPCommand.CMD_SIG),
                             argument_1=_COUNT_SIGNAL_TYPE,
                             argument_2=_get_data(app_id, state),
                             argument_3=_ALL_CORE_MASK)
 def __init__(self, x, y, p):
     """
     :param x: The x-coordinate of a chip, between 0 and 255
     :type x: int
     :param y: The y-coordinate of a chip, between 0 and 255
     :type y: int
     :param p: The processor running the dropped packet reinjector, between\
             0 and 17
     :type p: int
     """
     AbstractSCPRequest.__init__(
         self,
         SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                   destination_port=0,
                   destination_cpu=p,
                   destination_chip_x=x,
                   destination_chip_y=y),
         SCPRequestHeader(command=SCPCommand.CMD_DPRI),
         argument_1=SCPDPRICommand.RESET_COUNTERS.value)
예제 #26
0
    def __init__(self, fpga_num, register, board):
        """
        sets up a read fpga register request
        :param fpga_num: FPGA number (0, 1 or 2) to communicate with.
        :param register: Register address to read to (will be rounded down to
                the nearest 32-bit word boundary).
        :param board: which board to request the fpga register from
        :return: None
        """

        # check to stop people asking for none word aligned memory addresses
        # inverses all bits of a value, so is basically a inverse mask for the
        # value entered.
        arg1 = register & (~0x3)
        AbstractSCPBMPRequest.__init__(
            self, board,
            SCPRequestHeader(
                command=SCPCommand.CMD_LINK_READ),
            argument_1=arg1, argument_2=4, argument_3=fpga_num)
    def __init__(self, x, y, tag_timeout):
        """

        :param x: The x-coordinate of the chip to run on, between 0 and 255
        :type x: int
        :param y: The y-coordinate of the chip to run on, between 0 and 255
        :type y: int
        :param tag_timeout: The timeout value, via the IPTAG_TIME_OUT_WAIT_TIMES\
            enum located in spinnman.constants
        """

        super(SCPIPTagTTORequest,
              self).__init__(SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                                       destination_port=0,
                                       destination_cpu=0,
                                       destination_chip_x=x,
                                       destination_chip_y=y),
                             SCPRequestHeader(command=SCPCommand.CMD_IPTAG),
                             argument_1=_IPTAG_TTO,
                             argument_2=tag_timeout)
예제 #28
0
    def __init__(self, x, y, p):
        """

        :param x: The x-coordinate of the chip to read from, between 0 and 255
        :type x: int
        :param y: The y-coordinate of the chip to read from, between 0 and 255
        :type y: int
        :param p: The id of the processor to read the version from,\
                    between 0 and 31
        :type p: int
        :raise spinnman.exceptions.SpinnmanInvalidParameterException:
                    * If the chip coordinates are out of range
                    * If the processor is out of range
        """
        super(SCPVersionRequest, self).__init__(
            SDPHeader(
                flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
                destination_cpu=p, destination_chip_x=x,
                destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_VER))
예제 #29
0
    def __init__(self, x, y):
        """

        :param x: The x-coordinate of the chip, between 0 and 255 \
        this is not checked due to speed restrictions
        :type x: int
        :param y: The y-coordinate of the chip, between 0 and 255 \
        this is not checked due to speed restrictions
        :type y: int
        :raise spinnman.exceptions.SpinnmanInvalidParameterException:\
                    * If x is out of range
                    * If y is out of range
        """
        super(SCPRouterClearRequest, self).__init__(
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                      destination_port=0,
                      destination_cpu=0,
                      destination_chip_x=x,
                      destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_RTR))
    def __init__(self, x, y, app_id, size, tag=None):
        """

        :param x: The x-coordinate of the chip to allocate on, between 0 and\
                    255
        :type x: int
        :param y: The y-coordinate of the chip to allocate on, between 0 and\
                    255
        :type y: int
        :param app_id: The id of the application, between 0 and 255
        :type app_id: int
        :param size: The size in bytes of memory to be allocated
        :type size: int
        :param tag: the tag for the SDRAM, a 8-bit (chip-wide) tag that can be\
                looked up by a SpiNNaker application to discover the address\
                of the allocated block. If `0` then no tag is applied.
        :type tag: int
        """

        if tag is None:
            tag = 0
        elif not (0 <= tag < 256):
            raise exceptions.SpinnmanInvalidParameterException(
                "The tag param needs to be between 0 and 255, or None (in "
                "which case 0 will be used by default)")

        AbstractSCPRequest.__init__(
            self,
            SDPHeader(flags=SDPFlag.REPLY_EXPECTED,
                      destination_port=0,
                      destination_cpu=0,
                      destination_chip_x=x,
                      destination_chip_y=y),
            SCPRequestHeader(command=SCPCommand.CMD_ALLOC),
            argument_1=(
                (app_id << 8)
                | SCPAllocFreeType.ALLOC_SDRAM.value),  # @UndefinedVariable
            argument_2=size,
            argument_3=tag)
        self._size = size