From: Tobias Platen Date: Sat, 20 Feb 2021 10:37:20 +0000 (+0100) Subject: add rom debugger X-Git-Tag: convert-csv-opcode-to-binary~211 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9b5fa4b55c0bcea55b86c0a23a21afdf782b22d0;p=soc.git add rom debugger --- diff --git a/src/soc/fu/mmu/test/test_issuer_mmu_rom.py b/src/soc/fu/mmu/test/test_issuer_mmu_rom.py index f89288c0..5e787269 100644 --- a/src/soc/fu/mmu/test/test_issuer_mmu_rom.py +++ b/src/soc/fu/mmu/test/test_issuer_mmu_rom.py @@ -6,7 +6,7 @@ import unittest from soc.fu.test.common import ( TestAccumulatorBase, skip_case, TestCase, ALUHelpers) - + def b(x): return int.from_bytes(x.to_bytes(8, byteorder='little'), byteorder='big', signed=False) @@ -20,13 +20,13 @@ default_mem = { 0x10000: # PARTITION_TABLE_2 0x40000: # RADIX_SECOND_LEVEL # V = 1 L = 1 SW = 0 RPN = 0 - # R = 1 C = 1 ATT = 0 EAA 0x7 + # R = 1 C = 1 ATT = 0 EAA 0x7 b(0xc000000000000187), 0x1000000: # PROCESS_TABLE_3 # RTS1 = 0x2 RPDB = 0x300 RTS2 = 0x5 RPDS = 13 b(0x40000000000300ad), - } + } class MMUTestCase(TestAccumulatorBase): @@ -44,12 +44,16 @@ class MMUTestCase(TestAccumulatorBase): initial_sprs = {} self.add_case(Program(lst, bigendian), initial_regs, initial_sprs) +class RomDBG(): + def __init__(self): + self.rom = default_mem + self.debug = open("/tmp/rom.log","w") -rom = None +rom_dbg = RomDBG() if __name__ == "__main__": unittest.main(exit=False) suite = unittest.TestSuite() - suite.addTest(TestRunner(MMUTestCase().test_data,default_mem)) + suite.addTest(TestRunner(MMUTestCase().test_data,rom_dbg)) runner = unittest.TextTestRunner() runner.run(suite) diff --git a/src/soc/simple/test/test_runner_mmu_rom.py b/src/soc/simple/test/test_runner_mmu_rom.py index 8e9d9a44..fe055ef9 100644 --- a/src/soc/simple/test/test_runner_mmu_rom.py +++ b/src/soc/simple/test/test_runner_mmu_rom.py @@ -31,7 +31,37 @@ from soc.fu.compunits.test.test_compunit import (setup_test_memory, check_sim_memory) from soc.debug.dmi import DBGCore, DBGCtrl, DBGStat from nmutil.util import wrap -from soc.experiment.test.test_mmu_dcache import wb_get + +stop = False + +def wb_get(c, mem, name): + """simulator process for getting memory load requests + """ + global stop + # mem = mem + + while not stop: + while True: # wait for dc_valid + if stop: + return + cyc = yield (c.wb_out.cyc) + stb = yield (c.wb_out.stb) + if cyc and stb: + break + yield + addr = (yield c.wb_out.adr) << 3 + if addr not in mem.rom: + mem.debug.write("%s LOOKUP FAIL %x\n" % (name, addr)) + stop = True + return + + yield + data = mem.rom[addr] + yield c.wb_in.dat.eq(data) + mem.debug.write("%s get %x data %x\n" % (name, addr, data)) + yield c.wb_in.ack.eq(1) + yield + yield c.wb_in.ack.eq(0) def setup_i_memory(imem, startaddr, instructions): @@ -166,6 +196,7 @@ class TestRunner(FHDLTestCase): sim.add_clock(1e-6) def process(): + global stop # start in stopped yield from set_dmi(dmi, DBGCore.CTRL, 1<