Exemplo n.º 1
0
print("Bandwidth test!!")
bwpoints = 2**21
bwstarttime = time.time()
client.mem_read_block(starting_address, bwpoints, dummy)
bwtesttime = time.time() - bwstarttime
print("Read out %d points in %d seconds\n" % (bwpoints, bwtesttime))

print 'Reading out block of %d values from memory location 0x%X... ' % (
    num_mem_writes, starting_address)
print 'Values read out:'
print values[:min(num_mem_writes, 32)]
print '** Tested mem_read_block. **\n'

# Testing mem_read_to_file
print 'Reading block of memory and writing into file...'
client.mem_read_to_file(starting_address, num_mem_writes, 'hello.txt', dummy)
print '** Tested mem_read_to_file. **\n'

# Testing mem_write_from_file
print 'Reading a file and writing into memory...'
client.mem_write_from_file(starting_address + 100, num_mem_writes, 'hello.txt',
                           dummy)
values = client.mem_read_block(starting_address + 100, num_mem_writes, dummy)

print 'Values read out:'
print values[:min(num_mem_writes, 32)]
print '** Tested mem_write_from_file**\n'

# Testing file transfer
file_to_read = "../../../common/ltc25xx_filters/ssinc_4.txt"  # Grab a handy file that
file_write_path = "/home/sockit/ssinc_4.txt"  # we know exists, send to sockit's home dir.
    print 'ERROR in Mem Write Block. Returned wrong last location'
    error = error + 1
print '** Tested mem_write_block. **\n'

# Testing mem_read_block
values = client.mem_read_block(starting_address, number_of_reads, dummy)
if (verbose):
    print 'Reading out block of %d values from memory location 0x%X... ' % (
        number_of_reads, starting_address)
    print 'Values read out:'
    print values
print '** Tested mem_read_block. **\n'

# Testing mem_read_to_file
if (verbose): print 'Reading block of memory and writing into file...'
client.mem_read_to_file(starting_address, number_of_reads, 'hello.txt', dummy)
print '** Tested mem_read_to_file. **\n'

# Testing mem_write_from_file
if (verbose): print 'Reading a file and writing into memory...'
client.mem_write_from_file(starting_address + 100, number_of_reads,
                           'hello.txt', dummy)
values = client.mem_read_block(starting_address + 100, number_of_reads, dummy)
if (verbose):
    print 'Values read out:'
    print values
print '** Tested mem_write_from_file**\n'

# Testing file transfer
file_to_read = "test_file.txt"
file_write_path = "/home/sockit/fpga_bitfiles/test_file.txt"