test: add make.py to replace static config.py file
This commit is contained in:
parent
71f3a5bf13
commit
ac5b7c073a
|
@ -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)
|
|
@ -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)
|
|
@ -1,6 +1,4 @@
|
|||
import time
|
||||
|
||||
from config import *
|
||||
from litescope.host.driver.io import LiteScopeIODriver
|
||||
|
||||
def led_anim0(io):
|
||||
|
@ -25,11 +23,12 @@ def led_anim1(io):
|
|||
time.sleep(i*i*0.0020)
|
||||
led_data = (led_data>>1)
|
||||
|
||||
io = LiteScopeIODriver(wb.regs, "io")
|
||||
wb.open()
|
||||
###
|
||||
led_anim0(io)
|
||||
led_anim1(io)
|
||||
print("%02X" %io.read())
|
||||
###
|
||||
wb.close()
|
||||
def main(wb):
|
||||
io = LiteScopeIODriver(wb.regs, "io")
|
||||
wb.open()
|
||||
###
|
||||
led_anim0(io)
|
||||
led_anim1(io)
|
||||
print("%02X" %io.read())
|
||||
###
|
||||
wb.close()
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
from config import *
|
||||
from litescope.host.driver.la import LiteScopeLADriver
|
||||
|
||||
wb.open()
|
||||
###
|
||||
la = LiteScopeLADriver(wb.regs, "la", debug=True)
|
||||
def main(wb):
|
||||
wb.open()
|
||||
###
|
||||
la = LiteScopeLADriver(wb.regs, "la", debug=True)
|
||||
|
||||
#cond = {"cnt0" : 128} # trigger on cnt0 = 128
|
||||
cond = {} # trigger on cnt0 = 128
|
||||
la.configure_term(port=0, cond=cond)
|
||||
la.configure_sum("term")
|
||||
la.configure_subsampler(1)
|
||||
#la.configure_qualifier(1)
|
||||
la.configure_rle(1)
|
||||
la.run(offset=128, length=256)
|
||||
#cond = {"cnt0" : 128} # trigger on cnt0 = 128
|
||||
cond = {} # trigger on cnt0 = 128
|
||||
la.configure_term(port=0, cond=cond)
|
||||
la.configure_sum("term")
|
||||
la.configure_subsampler(1)
|
||||
#la.configure_qualifier(1)
|
||||
la.configure_rle(1)
|
||||
la.run(offset=128, length=256)
|
||||
|
||||
while not la.done():
|
||||
pass
|
||||
la.upload()
|
||||
while not la.done():
|
||||
pass
|
||||
la.upload()
|
||||
|
||||
la.save("dump.vcd")
|
||||
la.save("dump.csv")
|
||||
la.save("dump.py")
|
||||
la.save("dump.sr")
|
||||
###
|
||||
wb.close()
|
||||
la.save("dump.vcd")
|
||||
la.save("dump.csv")
|
||||
la.save("dump.py")
|
||||
la.save("dump.sr")
|
||||
###
|
||||
wb.close()
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
from config import *
|
||||
|
||||
wb.open()
|
||||
regs = wb.regs
|
||||
###
|
||||
print("sysid : 0x%04x" %regs.identifier_sysid.read())
|
||||
print("revision : 0x%04x" %regs.identifier_revision.read())
|
||||
print("frequency : %d MHz" %(regs.identifier_frequency.read()/1000000))
|
||||
###
|
||||
wb.close()
|
||||
def main(wb):
|
||||
wb.open()
|
||||
regs = wb.regs
|
||||
###
|
||||
print("sysid : 0x%04x" %regs.identifier_sysid.read())
|
||||
print("revision : 0x%04x" %regs.identifier_revision.read())
|
||||
print("frequency : %d MHz" %(regs.identifier_frequency.read()/1000000))
|
||||
###
|
||||
wb.close()
|
||||
|
|
Loading…
Reference in New Issue