2015-02-22 17:39:51 -05:00
|
|
|
#!/usr/bin/env python3
|
2015-04-13 04:45:09 -04:00
|
|
|
import argparse
|
|
|
|
import importlib
|
2015-02-22 17:39:51 -05:00
|
|
|
|
2015-04-13 04:20:02 -04:00
|
|
|
|
2015-02-22 17:39:51 -05:00
|
|
|
def _get_args():
|
2015-04-13 03:53:43 -04:00
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("-b", "--bridge", default="uart", help="Bridge to use")
|
|
|
|
parser.add_argument("--port", default="2", help="UART port")
|
|
|
|
parser.add_argument("--baudrate", default=115200, help="UART baudrate")
|
2015-04-13 07:02:04 -04:00
|
|
|
parser.add_argument("--ip_address", default="192.168.0.42", help="Etherbone IP address")
|
2015-04-13 03:53:43 -04:00
|
|
|
parser.add_argument("--udp_port", default=20000, help="Etherbone UDP port")
|
|
|
|
parser.add_argument("--busword", default=32, help="CSR busword")
|
2015-02-22 17:39:51 -05:00
|
|
|
|
2015-04-13 03:53:43 -04:00
|
|
|
parser.add_argument("test", nargs="+", help="specify a test")
|
2015-02-22 17:39:51 -05:00
|
|
|
|
2015-04-13 03:53:43 -04:00
|
|
|
return parser.parse_args()
|
2015-02-22 17:39:51 -05:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2015-04-13 03:53:43 -04:00
|
|
|
args = _get_args()
|
|
|
|
if args.bridge == "uart":
|
2015-05-02 04:24:56 -04:00
|
|
|
from misoclib.com.uart.software.wishbone import UARTWishboneBridgeDriver
|
2015-04-13 03:53:43 -04:00
|
|
|
port = args.port if not args.port.isdigit() else int(args.port)
|
2015-05-02 04:24:56 -04:00
|
|
|
wb = UARTWishboneBridgeDriver(port, args.baudrate, "./csr.csv", int(args.busword), debug=False)
|
2015-04-13 03:53:43 -04:00
|
|
|
elif args.bridge == "etherbone":
|
2015-05-02 04:24:56 -04:00
|
|
|
from misoclib.com.liteeth.software.wishbone import LiteETHWishboneBridgeDriver
|
|
|
|
wb = LiteETHWishboneBridgeDriver(args.ip_address, int(args.udp_port), "./csr.csv", int(args.busword), debug=False)
|
2015-04-13 03:53:43 -04:00
|
|
|
else:
|
|
|
|
ValueError("Invalid bridge {}".format(args.bridge))
|
2015-02-22 17:39:51 -05:00
|
|
|
|
2015-04-13 03:53:43 -04:00
|
|
|
def _import(name):
|
|
|
|
return importlib.import_module(name)
|
2015-02-22 17:39:51 -05:00
|
|
|
|
2015-04-13 03:53:43 -04:00
|
|
|
for test in args.test:
|
|
|
|
t = _import(test)
|
|
|
|
t.main(wb)
|