test: add make.py to replace static config.py file

This commit is contained in:
Florent Kermarrec 2015-02-23 18:55:19 +01:00
parent 71f3a5bf13
commit ac5b7c073a
5 changed files with 72 additions and 50 deletions

View file

@ -1,9 +0,0 @@
from litescope.host.driver.uart import LiteScopeUARTDriver
csr_csv_file = "./csr.csv"
busword = 32
debug_wb = False
com = 3
baud = 115200
wb = LiteScopeUARTDriver(com, baud, csr_csv_file, busword, debug_wb)

33
test/make.py Normal file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env python3
import argparse, importlib
def _get_args():
parser = argparse.ArgumentParser()
parser.add_argument("-b", "--bridge", default="uart", help="Bridge to use")
parser.add_argument("--port", default=3, help="UART port")
parser.add_argument("--baudrate", default=115200, help="UART baudrate")
parser.add_argument("--ip_address", default="192.168.1.40", help="Etherbone IP address")
parser.add_argument("--udp_port", default=20000, help="Etherbone UDP port")
parser.add_argument("--busword", default=32, help="CSR busword")
parser.add_argument("test", nargs="+", help="specify a test")
return parser.parse_args()
if __name__ == "__main__":
args = _get_args()
if args.bridge == "uart":
from litescope.host.driver.uart import LiteScopeUARTDriver
wb = LiteScopeUARTDriver(args.port, args.baudrate, "./csr.csv", int(args.busword), debug=False)
elif args.bridge == "etherbone":
from litescope.host.driver.etherbone import LiteScopeEtherboneDriver
wb = LiteScopeEtherboneDriver(args.ip_address, int(args.udp_port), "./csr.csv", int(args.busword), debug=False)
else:
ValueError("Invalid bridge {}".format(args.bridge))
def _import(name):
return importlib.import_module(name)
for test in args.test:
t = _import("test_"+test)
t.main(wb)

View file

@ -1,6 +1,4 @@
import time
from config import *
from litescope.host.driver.io import LiteScopeIODriver
def led_anim0(io):
@ -25,6 +23,7 @@ def led_anim1(io):
time.sleep(i*i*0.0020)
led_data = (led_data>>1)
def main(wb):
io = LiteScopeIODriver(wb.regs, "io")
wb.open()
###

View file

@ -1,6 +1,6 @@
from config import *
from litescope.host.driver.la import LiteScopeLADriver
def main(wb):
wb.open()
###
la = LiteScopeLADriver(wb.regs, "la", debug=True)

View file

@ -1,5 +1,4 @@
from config import *
def main(wb):
wb.open()
regs = wb.regs
###