import sys import select import tty import termios import struct from xstools.xscomm import XsComm USB_ID = 0 # This is the USB index for the XuLA board connected to the host PC. comm = XsComm(xsusb_id=USB_ID, module_id=255) addr_tracker = 0xFFFFFFFF # Adapted from # http://stackoverflow.com/questions/24582491/python-non-blocking-non-messing-my-tty-key-press-detection class NonBlockingConsole(object): def __enter__(self): try: self.old_settings = termios.tcgetattr(sys.stdin) tty.setcbreak(sys.stdin.fileno()) finally: return self def __exit__(self, type, value, traceback): try: termios.tcsetattr(sys.stdin, termios.TCSADRAIN, self.old_settings) finally: pass def get_data(self): if select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], []): return sys.stdin.read(1) return False
from xstools.xscomm import XsComm # logging.root.setLevel(logging.DEBUG) print '\n', '=' * 70, "\nThe FPGA should be freshly loaded before running this test script!\n", '=' * 70, '\n' USB_ID = 0 # This is the USB index for the XuLA board connected to the host PC. comm = XsComm(xsusb_id=USB_ID, module_id=255) print comm._memio._get_mem_widths() comm.get_levels() recv = comm.receive(14) print "Receive = ", [d.unsigned for d in recv] comm.get_levels() recv = comm.receive(drain=True) print "Receive = ", [d.unsigned for d in recv] comm.get_levels() comm.send([15, 16, 17, 18, 19, 20, 21, 22, 23, 24]) comm.send([15, 16, 17, 18, 19, 20, 21, 22, 23, 24]) comm.get_levels() recv = comm.receive(10) print "Receive = ", [d.unsigned for d in recv] comm.get_levels() recv = comm.receive(10) print "Receive = ", [d.unsigned for d in recv] comm.get_levels() print "\n\nRESET\n\n" comm.reset() comm.get_levels()
from xstools.xscomm import XsComm # logging.root.setLevel(logging.DEBUG) print '\n', '='*70, "\nThe FPGA should be freshly loaded before running this test script!\n", '='*70, '\n' USB_ID = 0 # This is the USB index for the XuLA board connected to the host PC. comm = XsComm(xsusb_id=USB_ID, module_id=255) print comm._memio._get_mem_widths() comm.get_levels() recv = comm.receive(14) print "Receive = ", [d.unsigned for d in recv] comm.get_levels() recv = comm.receive(drain=True) print "Receive = ", [d.unsigned for d in recv] comm.get_levels() comm.send([15, 16, 17, 18, 19, 20, 21, 22, 23, 24]) comm.send([15, 16, 17, 18, 19, 20, 21, 22, 23, 24]) comm.get_levels() recv = comm.receive(10) print "Receive = ", [d.unsigned for d in recv] comm.get_levels() recv = comm.receive(10) print "Receive = ", [d.unsigned for d in recv] comm.get_levels() print "\n\nRESET\n\n" comm.reset() comm.get_levels()
from xstools.xscomm import XsComm # logging.root.setLevel(logging.DEBUG) USB_ID = 0 # This is the USB index for the XuLA board connected to the host PC. comm = XsComm(xsusb_id=USB_ID, module_id=255) print comm._memio._get_mem_widths() for c in range(0x41, 0x5b): comm.send(c) echo_c = comm.receive().unsigned print chr(echo_c), print import sys
from xstools.xscomm import XsComm # logging.root.setLevel(logging.DEBUG) USB_ID = 0 # This is the USB index for the XuLA board connected to the host PC. comm = XsComm(xsusb_id=USB_ID, module_id=255) print comm._memio._get_mem_widths() for c in range(0x41,0x5b): comm.send(c) echo_c = comm.receive().unsigned print chr(echo_c), print import sys