print '** Tested Mem read and write. **\n' # Testing mem_write_block print 'Writing block of %d values to memory location 0x%X...' % ( num_mem_writes, starting_address) last_location = client.mem_write_block(starting_address, num_mem_writes, mem_values, dummy) print 'Last location written into: 0x%X' % last_location if (last_location != (starting_address + (num_mem_writes - 1) * 4)): print 'ERROR in Mem Write Block. Returned wrong last location' print '** Tested mem_write_block. **\n' # Testing mem_read_block values = client.mem_read_block(starting_address, num_mem_writes, dummy) # Testing mem_read_block as a bandwidth test 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'
print '** Tested reg_read_block. **\n' # Testing mem_write_block if (verbose == True): print 'Writing block of %d values to memory location 0x%X...' % ( number_of_writes, starting_address) last_location = client.mem_write_block(starting_address, number_of_writes, mem_values, dummy) if (verbose == True): print 'Last location written into: 0x%X' % last_location if (last_location != (starting_address + (number_of_writes - 1) * 4)): 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,