Skip to content

Commit

Permalink
Merge pull request #1376 from SpiNNakerManchester/transceiver_by_version
Browse files Browse the repository at this point in the history
Transceiver by version
  • Loading branch information
rowleya committed Oct 11, 2023
2 parents aec1fda + d5be08f commit 803382c
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions unittests/model_tests/neuron/test_synaptic_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from spinn_utilities.overrides import overrides
from spinn_utilities.config_holder import set_config
from spinnman.transceiver.mockable_transceiver import MockableTransceiver
from spinnman.transceiver import Transceiver
from pacman.model.placements import Placement
from pacman.operations.routing_info_allocator_algorithms import (
Expand Down Expand Up @@ -58,16 +59,14 @@
import pyNN.spiNNaker as p


class _MockTransceiverinOut(Transceiver):
def __init__(self):
pass
class _MockTransceiverinOut(MockableTransceiver):

@overrides(Transceiver.malloc_sdram)
@overrides(MockableTransceiver.malloc_sdram)
def malloc_sdram(self, x, y, size, app_id, tag=None):
self._data_to_read = bytearray(size)
return 0

@overrides(Transceiver.write_memory)
@overrides(MockableTransceiver.write_memory)
def write_memory(self, x, y, base_address, data, n_bytes=None, offset=0,
cpu=0, is_filename=False, get_sum=False):
if data is None:
Expand All @@ -80,19 +79,15 @@ def write_memory(self, x, y, base_address, data, n_bytes=None, offset=0,
def get_region_base_address(self, x, y, p):
return 0

@overrides(Transceiver.read_memory)
@overrides(MockableTransceiver.read_memory)
def read_memory(self, x, y, base_address, length, cpu=0):
return self._data_to_read[base_address:base_address + length]

@overrides(Transceiver.read_word)
@overrides(MockableTransceiver.read_word)
def read_word(self, x, y, base_address, cpu=0):
datum, = struct.unpack("<I", self.read_memory(x, y, base_address, 4))
return datum

@overrides(Transceiver.close)
def close(self):
pass


def say_false(self, weights, delays):
return False
Expand Down

0 comments on commit 803382c

Please sign in to comment.