Exemplo n.º 1
0
def main():
    args, wb = connect("LiteX Etherbone Interactive Console")
    print_memmap(wb)
    print()

    analyzer_csv = '{}/analyzer.csv'.format(make_testdir(args))
    if os.path.exists(analyzer_csv):
        analyzer = LiteScopeAnalyzerDriver(wb.regs,
                                           "analyzer",
                                           config_csv=analyzer_csv,
                                           debug=True)
    else:
        print(
            "WARNING: No litescope csv found at {},\nAssuming litescope not included in design!"
            .format(analyzer_csv))

    try:
        embed()
    finally:
        wb.close()
Exemplo n.º 2
0
#!/usr/bin/env python3

from litex.soc.tools.remote import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient("192.168.1.50", 1234, debug=False)
wb.open()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
analyzer.configure_trigger(cond={})
analyzer.configure_subsampler(1)
analyzer.run(offset=16, length=1024)
while not analyzer.done():
    pass
analyzer.upload()
analyzer.save("dump.vcd")

# # #

wb.close()
Exemplo n.º 3
0
        wb_amc.regs.serwb_phy_control_scrambling_enable.write(0)
    else:
        print("Enabling scrambling")
        wb_rtm.regs.serwb_phy_control_scrambling_enable.write(1)
        wb_amc.regs.serwb_phy_control_scrambling_enable.write(1)

elif sys.argv[1] == "wishbone":
    write_pattern(128)
    errors = check_pattern(128, debug=True)
    print("errors: {:d}".format(errors))
elif sys.argv[1] == "dump":
    for i in range(32):
        print("{:08x}".format(wb_amc.read(wb_amc.mems.serwb.base + 4 * i)))
elif sys.argv[1] == "analyzer_rtm":
    analyzer = LiteScopeAnalyzerDriver(wb_rtm.regs,
                                       "analyzer",
                                       config_csv="../sayma_rtm/analyzer.csv",
                                       debug=True)
    analyzer.configure_trigger(cond={"soc_activity": 1})
    analyzer.run(offset=32, length=128)

    time.sleep(1)
    #wb_amc.regs.serwb_test_do_write.write(1)
    wb_amc.regs.serwb_test_do_read.write(1)

    analyzer.wait_done()
    analyzer.upload()
    analyzer.save("dump.vcd")
else:
    raise ValueError

# # #
Exemplo n.º 4
0
#!/usr/bin/env python3
import time
from litex.tools.litex_client import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient(debug=False)
wb.open()
regs = wb.regs

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=False)

# # #

dfii_control_sel = 0x01
dfii_control_cke = 0x02
dfii_control_odt = 0x04
dfii_control_reset_n = 0x08

dfii_command_cs = 0x01
dfii_command_we = 0x02
dfii_command_cas = 0x04
dfii_command_ras = 0x08
dfii_command_wrdata = 0x10
dfii_command_rddata = 0x20

regs.sdram_dfii_control.write(0)

# release reset
regs.sdram_dfii_pi0_address.write(0x0)
regs.sdram_dfii_pi0_baddress.write(0)
regs.sdram_dfii_control.write(dfii_control_odt | dfii_control_reset_n)
Exemplo n.º 5
0
#!/usr/bin/env python3
import time
import os
import sys

from litex.gen.fhdl.structure import *

from litex.soc.tools.remote import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
#analyzer.configure_trigger(cond={"charsync0_data": 0x354})
#analyzer.configure_trigger(cond={"hdmi_in0_frame_de" : 1})
#analyzer.configure_trigger(cond={})
t = getattr(analyzer, "frontend_trigger_value")
m = getattr(analyzer, "frontend_trigger_mask")
t.write(0x80000000000000000)
m.write(0x80000000000000000)

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

# # #
Exemplo n.º 6
0
#!/usr/bin/env python3

from litex.soc.tools.remote import RemoteClient

from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
analyzer.configure_trigger(cond={"pmoda_0": 0})
analyzer.configure_subsampler(64)
analyzer.run(offset=128, length=8192)
analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd")
analyzer.save("dump.sr")

# # #

wb.close()
Exemplo n.º 7
0
#!/usr/bin/env python3

from litex.soc.tools.remote import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient("192.168.1.50", 1234, csr_data_width=8)
wb.open()

# # #

logic_analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)

cond = {}
logic_analyzer.configure_trigger(cond=cond)
logic_analyzer.run(offset=256, length=2048)

while not logic_analyzer.done():
    pass
logic_analyzer.upload()

logic_analyzer.save("dump.vcd")

# # #

wb.close()
Exemplo n.º 8
0
#!/usr/bin/env python3
import time

from litex.soc.tools.remote import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

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

# # #

wb.close()
Exemplo n.º 9
0
#!/usr/bin/env python3

from litex import RemoteClient

from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

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

# # #

wb.close()
Exemplo n.º 10
0
#!/usr/bin/env python3

from litex.tools.litex_client import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)

analyzer.configure_subsampler(
    1)  ## increase this to "skip" cycles, e.g. subsample
analyzer.configure_group(0)

#analyzer.add_falling_edge_trigger("soc_videooverlaysoc_hdmi_in0_timing_payload_vsync")
#analyzer.add_rising_edge_trigger("soc_videooverlaysoc_hdmi_in0_timing_payload_de")
#analyzer.add_trigger(cond={"soc_videooverlaysoc_hdmi_in0_timing_payload_hsync" : 1})
#analyzer.add_rising_edge_trigger("descrambler0_source_ready")

# trigger conditions will depend upon each other in sequence
#analyzer.add_trigger(cond = {"gtp0_source_payload_data" : 0x1cbc,
#                             "gtp0_source_payload_ctrl" : 3})
#analyzer.add_trigger(cond = {"detectorderedsets1_source_payload_type" : 1})

#analyzer.add_falling_edge_trigger("trig")

analyzer.run(offset=128, length=1024)  ### CHANGE THIS TO MATCH DEPTH
analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd")
Exemplo n.º 11
0
#!/usr/bin/env python3
import time
from litex.soc.tools.remote import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient(debug=False)
wb.open()
regs = wb.regs

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=False)

# # #

dfii_control_sel     = 0x01
dfii_control_cke     = 0x02
dfii_control_odt     = 0x04
dfii_control_reset_n = 0x08

dfii_command_cs     = 0x01
dfii_command_we     = 0x02
dfii_command_cas    = 0x04
dfii_command_ras    = 0x08
dfii_command_wrdata = 0x10
dfii_command_rddata = 0x20

regs.sdram_dfii_control.write(0)

# release reset
regs.sdram_dfii_pi0_address.write(0x0)
regs.sdram_dfii_pi0_baddress.write(0)
regs.sdram_dfii_control.write(dfii_control_odt|dfii_control_reset_n)
Exemplo n.º 12
0
from litex.soc.tools.remote import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

dumps = {0: "dump.vcd", 1: "dump.sr"}

for group, filename in dumps.items():
    analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
    analyzer.configure_trigger()
    analyzer.configure_subsampler(1)
    analyzer.configure_group(group)
    analyzer.run(offset=128, length=512)
    analyzer.wait_done()
    analyzer.upload()
    analyzer.save(filename)

# # #

wb.close()
Exemplo n.º 13
0
from litex import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient(port=1234)
wb.open()

identifier = ""
for i in range(0, 32):
    identifier += "%c" %wb.read(wb.bases.identifier_mem + 4*i)
print("\nSoC identifier: " + identifier)
print()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
analyzer.configure_trigger(cond={
    # "soc_sender_source_source_valid": 1,
    # "soc_sender_source_source_ready": 1,
    # "soc_sender_source_source_payload_data": 0
    "soc_ulpi_core0_source_source_valid": 1,
    "soc_ulpi_core0_source_source_ready": 1,
})
# analyzer.configure_trigger()
analyzer.configure_subsampler(1)
analyzer.run(offset=1, length=1024)
analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd")

# # #
Exemplo n.º 14
0
#!/usr/bin/env python3

import time
import sys

from litex.soc.tools.remote import RemoteClient

from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient(debug=False)
wb.open()

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=False)

# # #

dfii_control_sel = 0x01
dfii_control_cke = 0x02
dfii_control_odt = 0x04
dfii_control_reset_n = 0x08

dfii_command_cs = 0x01
dfii_command_we = 0x02
dfii_command_cas = 0x04
dfii_command_ras = 0x08
dfii_command_wrdata = 0x10
dfii_command_rddata = 0x20

wb.regs.sdram_dfii_control.write(0)

# release reset
Exemplo n.º 15
0
def main():
    args, wb = connect("LiteX Etherbone Memtest BIST", target='memtest')
    print_memmap(wb)
    print()

    main_ram = wb.mems.main_ram
    print("DDR at 0x{:x} -- {} Megabytes".format(
        main_ram.base, int(main_ram.size / (1024 * 1024))))
    print()
    # init
    print("Reset")
    wb.regs.generator_reset.write(1)
    wb.regs.checker_reset.write(1)

    wb.regs.generator_reset.write(0)
    wb.regs.checker_reset.write(0)

    assert not wb.regs.checker_scope_error.read()
    print()

    analyzer = LiteScopeAnalyzerDriver(wb.regs,
                                       "analyzer",
                                       config_csv='{}/analyzer.csv'.format(
                                           make_testdir(args)),
                                       debug=True)
    print("Init analyzer")
    #analyzer.configure_trigger(cond={'checker_core_data_error': 1})
    analyzer.configure_trigger(cond={'data_error': 1})
    analyzer.configure_trigger(cond={})
    analyzer.configure_subsampler(1)
    analyzer.run(offset=16, length=1024)
    assert not analyzer.done()
    print()

    base = int(512e3)
    #length = int((main_ram.size-base)*8/16) # 64e6 == 64 megabytes
    #length = int(2e6)
    length = int(1)

    # write
    print("Write")
    write_and_check(wb.regs.generator_base, base)
    write_and_check(wb.regs.generator_length, length)

    assert not wb.regs.generator_done.read()
    wb.regs.generator_start.write(1)
    print("Waiting", end=' ')
    while wb.regs.generator_done.read() == 0:
        print(".", end='', flush=True)
        time.sleep(0.1)
    assert wb.regs.generator_done.read() == 1
    print()

    # read
    assert wb.regs.checker_err_count.read() == 0

    print("Read")
    write_and_check(wb.regs.checker_base, base)
    write_and_check(wb.regs.checker_length, length)

    assert not wb.regs.checker_done.read()
    assert not analyzer.done()
    wb.regs.checker_start.write(1)
    print("Waiting")
    while wb.regs.checker_done.read() == 0:
        print("  Errors:", wb.regs.checker_err_count.read())
        time.sleep(0.1)
    assert wb.regs.checker_done.read() == 1
    print("Final errors:", wb.regs.checker_err_count.read())

    errors = wb.regs.checker_err_count.read()

    if errors != 0:
        # Check litescope
        assert analyzer.done()
        analyzer.upload()
        analyzer.save('sim.vcd')

        data = {v.name: v for v in analyzer.dump().variables}

        okay = set()
        errors = {}
        for i in range(0, len(data['clk'].values)):
            address = hex(data['data_address'].values[i])

            if data['data_error'].values[i] != 1:
                okay.add(address)
                continue

            expected = data['data_expected'].values[i]
            actual = data['data_actual'].values[i]

            r = MemError(address, hex(expected), hex(actual))
            if address in errors:
                assert errors[address] == r
            else:
                errors[address] = r

        import pprint
        print(len(errors))
        pprint.pprint(errors)

        from IPython import embed
        embed()
        #print("Error @ {} - {:x} != {:x}".format(addr, expect, actual))

    print("Done!")

    wb.close()
Exemplo n.º 16
0
def analyzer():
    analyzer = LiteScopeAnalyzerDriver(wb_amc.regs, "analyzer", config_csv="../sayma_amc/analyzer.csv", debug=True)
    analyzer.configure_group(groups["wishbone"])
    analyzer.configure_trigger(cond={"wishbone_access" : 1})
    analyzer.run(offset=32, length=128)

    write_pattern(32)
    errors = check_pattern(32, debug=True)
    print("errors: {:d}".format(errors))

    analyzer.wait_done()
    analyzer.upload()
    analyzer.save("dump.vcd")
Exemplo n.º 17
0
def analyzer():
    groups = {
        "dfi_phase0": 0,
        "dfi_phase1": 1,
        "dfi_phase2": 2,
        "dfi_phase3": 3
    }

    analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
    analyzer.configure_group(groups["dfi_phase0"])
    analyzer.configure_trigger(cond={})

    write_test(0x00000000, 1024*MB, False)
    read_test(0x00000000, 1024*MB, False)

    analyzer.run(offset=32, length=64)

    analyzer.wait_done()
    analyzer.upload()
    analyzer.save("dump.vcd")
Exemplo n.º 18
0
from litex.tools.litex_client import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)

analyzer.configure_subsampler(
    1)  ## increase this to "skip" cycles, e.g. subsample
analyzer.configure_group(0)

# trigger conditions will depend upon each other in sequence
#analyzer.add_rising_edge_trigger("adc_i_fclk1")

analyzer.add_rising_edge_trigger("adc_i_we0")

analyzer.run(offset=16, length=512)  ### CHANGE THIS TO MATCH DEPTH
analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd")

wb.close()
Exemplo n.º 19
0
#!/usr/bin/env python3

from litex import RemoteClient

from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

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

# # #

wb.close()
Exemplo n.º 20
0
#!/usr/bin/env python3

#
# This file is part of LiteEth.
#
# Copyright (c) 2015-2018 Florent Kermarrec <*****@*****.**>
# SPDX-License-Identifier: BSD-2-Clause

from litex import RemoteClient

wb = RemoteClient()
wb.open()

# # #

from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver
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()
Exemplo n.º 21
0
from litex.soc.tools.remote import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
analyzer.configure_trigger(cond={"s7pciephy_sink_valid": 1})
#analyzer.configure_trigger(cond={})
analyzer.configure_subsampler(1)
analyzer.run(offset=16, length=64)
analyzer.wait_done()
analyzer.upload()
analyzer.save("dump.vcd")

# # #

wb.close()
Exemplo n.º 22
0
from litex.soc.tools.remote import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver

wb = RemoteClient()
wb.open()

# # #

analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
analyzer.configure_trigger(cond={"counter1": 0})
analyzer.configure_subsampler(1)
analyzer.run(offset=128, length=512)
while not analyzer.done():
    pass
analyzer.upload()
analyzer.save("dump.vcd")

# # #

wb.close()