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,
        )
Exemple #3
0
    def test_sizeof(self):
        # Create a system region, assert that the size is reported correctly.
        sr = SystemRegion(size_in=5, size_out=10, machine_timestep=1000, transmission_delay=1, interpacket_pause=1)

        # Should always be 5 words
        assert sr.sizeof(slice(None)) == 20
Exemple #4
0
    def test_sizeof(self):
        # Create a system region
        sr = SystemRegion(n_dims=512, machine_timestep=1000)

        # Should always be 6 words
        assert sr.sizeof() == 6 * 4