示例#1
0
def main():
    args = parse_args()

    basename = os.path.splitext(os.path.basename(args.csv))[0]

    # Check if analyzer file is present and exit if not.
    if not os.path.exists(args.csv):
        raise ValueError(
            "{} not found. This is necessary to load the wires which have been tapped to scope."
            "Try setting --csv to value of the csr_csv argument to LiteScopeAnalyzer in the SoC."
            .format(args.csv))
        sys.exit(1)

    # Get list of signals from analyzer configuratio file.
    signals = get_signals(args.csv, args.group)

    # If in list mode, list signals and exit.
    if args.list:
        for signal in signals:
            print(signal)
        sys.exit(0)

    # Create and open remote control.
    if not os.path.exists(args.csr_csv):
        raise ValueError(
            "{} not found. This is necessary to load the 'regs' of the remote. Try setting --csr-csv here to "
            "the path to the --csr-csv argument of the SoC build.".format(
                args.csr_csv))
    bus = RemoteClient(csr_csv=args.csr_csv)
    bus.open()

    # Configure and run LiteScope analyzer.
    try:
        analyzer = LiteScopeAnalyzerDriver(bus.regs, basename, debug=True)
        analyzer.configure_group(int(args.group, 0))
        analyzer.configure_subsampler(int(args.subsampling, 0))
        if not add_triggers(args, analyzer, signals):
            print("No trigger, immediate capture.")
        analyzer.run(
            offset=int(args.offset, 0),
            length=None if args.length is None else int(args.length, 0))
        analyzer.wait_done()
        analyzer.upload()
        analyzer.save(args.dump)

    # Close remove control.
    finally:
        bus.close()
示例#2
0
#!/usr/bin/env python3

# This file is Copyright (c) 2018 Florent Kermarrec <*****@*****.**>
# License: BSD

from litex import RemoteClient

from litescope import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
analyzer.configure_subsampler(1)
analyzer.configure_group(0)
analyzer.add_rising_edge_trigger("zero")
analyzer.run(offset=32, length=128)
analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd")

# # #

wb.close()
示例#3
0
#!/usr/bin/env python3

from litex import RemoteClient

from litescope import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
analyzer.configure_trigger(cond={})
analyzer.configure_subsampler(1)
analyzer.run(offset=128, length=256)
analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd")

# # #

wb.close()
示例#4
0
#!/usr/bin/env python3

from litex.soc.tools.remote import RemoteClient

from litescope import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
analyzer.configure_subsampler(1)
analyzer.configure_group(0)

#analyzer.add_trigger(cond={"soc_videooverlaysoc_videooverlaysoc_videooverlaysoc_interrupt": 0x8})
#analyzer.add_rising_edge_trigger("soc_videooverlaysoc_videooverlaysoc_videooverlaysoc_interrupt")
#analyzer.add_falling_edge_trigger("soc_videooverlaysoc_hdmi_in1_frame_de")
analyzer.add_falling_edge_trigger("soc_videooverlaysoc_hdmi_in1_frame_de")
#analyzer.add_trigger(cond={"soc_videooverlaysoc_hdcp_ctl_code" : 9})
#analyzer.add_trigger(cond={"soc_videooverlaysoc_analyzer_fsm2_state" : 0})

analyzer.run(offset=32, length=64)
analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd")

# # #

wb.close()
示例#5
0
if len(sys.argv) < 3:
    length = 4096
else:
    length = int(sys.argv[2])

# FPGA ID ------------------------------------------------------------------------------------------
fpga_id = ""
for i in range(256):
    c = chr(wb.read(wb.bases.identifier_mem + 4*i) & 0xff)
    fpga_id += c
    if c == "\0":
        break
print("FPGA: " + fpga_id)

# Analyzer dump ------------------------------------------------------------------------------------
analyzer  = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
usb3_name = "usb3"
for s in analyzer.layouts[0]:
    if "soc_usb3" in s[0]:
        usb3_name = "soc_usb3"
if sys.argv[1] == "rx_polling":
    analyzer.add_rising_edge_trigger(usb3_name + "_pipe_rx_polling")
elif sys.argv[1] == "tx_polling":
    analyzer.add_rising_edge_trigger(usb3_name + "_pipe_tx_polling")
elif sys.argv[1] == "rx_tseq_first_word":
    from usb3_pipe.common import TSEQ
    TSEQ_FIRST_WORD = int.from_bytes(TSEQ.to_bytes()[0:4], byteorder="little")
    analyzer.configure_trigger(cond={
        usb3_name + "_serdes_source_source_valid" :       1,
        usb3_name + "_serdes_source_source_payload_data": TSEQ_FIRST_WORD})
elif sys.argv[1] == "rx_tseq":
示例#6
0
from litex import RemoteClient
from litescope import LiteScopeAnalyzerDriver

parser = argparse.ArgumentParser()
#parser.add_argument("--ibus_stb",  action="store_true", help="Trigger on IBus Stb rising edge.")
#parser.add_argument("--ibus_adr",  default=0x00000000,  help="Trigger on IBus Adr value.")
parser.add_argument("--offset",    default=128,         help="Capture Offset.")
parser.add_argument("--length",    default=512,         help="Capture Length.")
args = parser.parse_args()

wb = RemoteClient()
wb.open()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
analyzer.configure_group(0)
#analyzer.add_rising_edge_trigger("simsoc_cpu_ibus_stb")
#analyzer.configure_trigger(cond={"simsoc_cpu_ibus_adr": int(args.ibus_adr, 0)})
#analyzer.configure_trigger(cond={})
analyzer.configure_trigger(cond={"basesoc_etherbone_liteethetherbonewishbonemaster_bus_adr":'0b10000000000'})
analyzer.run(offset=int(args.offset), length=int(args.length))

analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd")

# # #

wb.close()
示例#7
0
#!/usr/bin/env python3

from litex.soc.tools.remote import RemoteClient

from litescope import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
analyzer.configure_subsampler(1)
analyzer.configure_group(0)

#analyzer.add_trigger(cond={"soc_videooverlaysoc_videooverlaysoc_videooverlaysoc_interrupt": 0x8})
#analyzer.add_rising_edge_trigger("soc_videooverlaysoc_videooverlaysoc_videooverlaysoc_interrupt")
analyzer.add_rising_edge_trigger("soc_videooverlaysoc_hdmi_in1_dma_last_word")
#analyzer.add_trigger(cond={"soc_videooverlaysoc_hdcp_ctl_code" : 9})
#analyzer.add_trigger(cond={"soc_videooverlaysoc_analyzer_fsm2_state" : 0})

analyzer.run(offset=16, length=32)
analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd")

# # #

wb.close()
示例#8
0
parser = argparse.ArgumentParser()
parser.add_argument("--ibus_adr",
                    default=0x00000000,
                    help="Trigger on IBus Adr value.")
parser.add_argument("--offset", default=128, help="Capture Offset.")
parser.add_argument("--length", default=1024, help="Capture Length.")
args = parser.parse_args()

wb = RemoteClient(csr_csv="build/arty/csr.csv")
wb.open()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs,
                                   "analyzer",
                                   debug=True,
                                   config_csv="build/arty/analyzer.csv")
#analyzer.configure_subsampler(10)
analyzer.configure_group(0)
#analyzer.add_rising_edge_trigger("basesoc_spimaster_status_status")

#analyzer.add_rising_edge_trigger("dw1000_spi_clk")
analyzer.add_falling_edge_trigger("dw1000_spi_cs_n")
#analyzer.add_rising_edge_trigger("main_basesoc_spimaster_cs_storage")
#analyzer.add_falling_edge_trigger("spi_miso")

#analyzer.configure_trigger(cond={"main_basesoc_cpu_ibus_ibus_adr": hex(args.ibus_adr)})
#analyzer.configure_trigger(cond={"main_basesoc_ibus_ibus_adr": bin(0xea0)})
#analyzer.configure_trigger(cond={"spi_mosi": bin(ord("h"))})
analyzer.run(offset=int(args.offset), length=int(args.length))
示例#9
0
#!/usr/bin/env python3
from litex import RemoteClient
from litescope import LiteScopeAnalyzerDriver
import sys
sys.path.append("..")
from common import *

r = conLitexServer()

# # #

analyzer = LiteScopeAnalyzerDriver(r.regs,
                                   "analyzer",
                                   config_csv="build/analyzer.csv",
                                   debug=True)
analyzer.configure_subsampler(1)
analyzer.configure_group(0)
try:
    trig = sys.argv[1]
except Exception:
    trig = "user_btn_u"
print("Trigger:", trig)
analyzer.add_rising_edge_trigger(trig)
analyzer.run(offset=32, length=64)
analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd")

# # #

r.close()
示例#10
0
#!/usr/bin/env python3
from litex import RemoteClient
from litescope import LiteScopeAnalyzerDriver
import sys
sys.path.append('../..')
from common import *

r = conLitexServer('../build/csr.csv')

# # #

analyzer = LiteScopeAnalyzerDriver(r.regs,
                                   "analyzer",
                                   config_csv="../build/analyzer.csv",
                                   debug=True)
analyzer.configure_subsampler(1)
analyzer.configure_group(0)
trig = sys.argv[1]
if trig != 'snapshot':
    if trig[0] == '~':
        analyzer.add_falling_edge_trigger(trig[1:])
    else:
        analyzer.add_rising_edge_trigger(trig)
print("Trigger:", trig)
analyzer.run(offset=32)
analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd", samplerate=160e6)

# # #
示例#11
0
        analyzer.add_trigger(cond=cond)
        added = True
    return added


if __name__ == "__main__":
    args = parse_args()

    signals = get_signals("analyzer.csv")
    if args.list:
        for signal in signals:
            print(signal)
        sys.exit(0)

    wb = RemoteClient()
    wb.open()

    try:
        analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
        analyzer.configure_group(0)
        if not add_triggers(args, analyzer, signals):
            print("WARNING: no trigger added!")

        analyzer.run(offset=int(args.offset, 0), length=int(args.length, 0))

        analyzer.wait_done()
        analyzer.upload()
        analyzer.save("dump.vcd")
    finally:
        wb.close()