Exemple #1
0
    def test_write_subregion_to_file(self, n_dims, in_slice, out_slice,
                                     machine_timestep, vector_address):
        # Create the region
        sr = SystemRegion(n_dims=n_dims, machine_timestep=machine_timestep)

        # Store the address of the shared vector in SDRAM
        sr.shared_vector_address = vector_address

        # Write the region to file, assert the values are sane
        fp = tempfile.TemporaryFile()
        sr.write_subregion_to_file(fp, in_slice=in_slice, out_slice=out_slice)

        fp.seek(0)
        assert struct.unpack("<6I", fp.read()) == (
            machine_timestep,
            n_dims,
            in_slice.start,
            in_slice.stop - in_slice.start,
            out_slice.stop - out_slice.start,
            vector_address,
        )
Exemple #2
0
    def test_write_subregion_to_file(self, size_in, size_out, machine_timestep, transmission_delay, interpacket_pause):
        # Create the region
        sr = SystemRegion(
            size_in=size_in,
            size_out=size_out,
            machine_timestep=machine_timestep,
            transmission_delay=transmission_delay,
            interpacket_pause=interpacket_pause,
        )

        # Write the region to file, assert the values are sane
        fp = tempfile.TemporaryFile()
        sr.write_subregion_to_file(fp, slice(None))

        fp.seek(0)
        assert struct.unpack("<5I", fp.read()) == (
            size_in,
            size_out,
            machine_timestep,
            transmission_delay,
            interpacket_pause,
        )