From 74dd907503643392914fe88b71782210c76c479b Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 23 Dec 2014 20:56:03 +0100 Subject: [PATCH] add test_bist_mila to show how to capture data --- targets/test.py | 2 -- test/test_bist.py | 77 ------------------------------------------ test/test_bist_mila.py | 42 +++++++++++++++++++++++ 3 files changed, 42 insertions(+), 79 deletions(-) delete mode 100644 test/test_bist.py create mode 100644 test/test_bist_mila.py diff --git a/targets/test.py b/targets/test.py index f16b3e5a..b50e19ba 100644 --- a/targets/test.py +++ b/targets/test.py @@ -189,8 +189,6 @@ class TestDesign(UART2WB, AutoCSR): debug = ( ctrl.ready, - ctrl.sink.data, - ctrl.sink.charisk, self.sata_phy.source.stb, self.sata_phy.source.data, diff --git a/test/test_bist.py b/test/test_bist.py deleted file mode 100644 index 00b38109..00000000 --- a/test/test_bist.py +++ /dev/null @@ -1,77 +0,0 @@ -import time -import argparse -from config import * - -sector_size = 512 - -class SATABISTDriver: - def __init__(self, regs): - self.regs = regs - self.last_sector = 0 - self.last_time = time.time() - self.last_errors = 0 - self.mode = "rw" - - def set_mode(self, mode): - self.mode = mode - self.regs.bist_write_only.write(0) - self.regs.bist_read_only.write(0) - if mode == "wr": - self.regs.bist_write_only.write(1) - if mode == "rd": - self.regs.bist_read_only.write(1) - - def start(self, sector, count, mode): - self.set_mode(mode) - self.regs.bist_start_sector.write(sector) - self.regs.bist_count.write(count) - self.regs.bist_stop.write(0) - self.regs.bist_start.write(1) - - def stop(self): - self.regs.bist_stop.write(1) - - def show_status(self): - errors = self.regs.bist_errors.read() - self.last_errors - self.last_errors += errors - - sector = self.regs.bist_sector.read() - n = sector - self.last_sector - self.last_sector = sector - - t = self.last_time - time.time() - self.last_time = time.time() - - if self.mode in ["wr", "rd"]: - speed_mult = 1 - else: - speed_mult = 2 - print("%4.2f MB/sec errors=%d sector=%d" %(n*sector_size*speed_mult/(1024*1024), errors, sector)) - - -def _get_args(): - parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, - description="""\ -SATA BIST utility. -""") - parser.add_argument("-s", "--sector", default=0, help="BIST start sector") - parser.add_argument("-c", "--count", default=4, help="BIST count (number of sectors per transaction)") - parser.add_argument("-m", "--mode", default="rw", help="BIST mode (rw, wr, rd") - - return parser.parse_args() - -if __name__ == "__main__": - args = _get_args() - wb.open() - ### - bist = SATABISTDriver(wb.regs) - try: - bist.start(int(args.sector), int(args.count), args.mode) - while True: - bist.show_status() - time.sleep(1) - except KeyboardInterrupt: - pass - bist.stop() - ### - wb.close() diff --git a/test/test_bist_mila.py b/test/test_bist_mila.py new file mode 100644 index 00000000..7e6c2767 --- /dev/null +++ b/test/test_bist_mila.py @@ -0,0 +1,42 @@ +import time +from config import * +from tools import * +from bist import * +from miscope.host.drivers import MiLaDriver + +mila = MiLaDriver(wb.regs, "mila") +bist = SATABISTDriver(wb.regs) +wb.open() +regs = wb.regs +### + +wr_cond = { + "sata_con_source_source_stb" : 1, + "sata_con_source_source_payload_write" : 1, +} + +rd_cond = { + "sata_con_source_source_stb" : 1, + "sata_con_source_source_payload_read" : 1, +} + + +mila.prog_term(port=0, cond=rd_cond) +mila.prog_sum("term") + +# Trigger / wait / receive +mila.trigger(offset=32, length=1024) + +bist.start(0, 4, "rw") +mila.wait_done() +bist.stop() + +mila.read() +mila.export("dump.vcd") +### +wb.close() + +print_link_trace(mila, + tx_data_name="sata_phy_sink_sink_payload_data", + rx_data_name="sata_phy_source_source_payload_data" +) -- 2.30.2