Skip to content

Commit

Permalink
timer irq second test - reached 'mret clears' failure (exit code 3)
Browse files Browse the repository at this point in the history
  • Loading branch information
bieganski committed Aug 18, 2024
1 parent 8a5bec3 commit cf079b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mtkcpu/tests/test_csr.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@
out_val=100,
timeout=2000,
mem_init=MemoryContents.empty(),
reg_init=RegistryContents.fill(),
reg_init=RegistryContents.empty(),
),
]

Expand Down
5 changes: 3 additions & 2 deletions mtkcpu/utils/tests/sim_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def reg_test(timeout=default_timeout_extra + timeout_cycles, expected_val=expect
yield Tick()
yield Settle()

for _ in range(timeout):
for i in range(timeout):
en = yield cpu.reg_write_port.en
if en == 1:
addr = yield cpu.reg_write_port.addr
Expand All @@ -311,9 +311,10 @@ def reg_test(timeout=default_timeout_extra + timeout_cycles, expected_val=expect
if check_reg_content and cond:
# TODO that mechanism for now allows for only one write to observed register per test,
# extend it if neccessary.
pc = yield cpu.pc
print(
f"== ERROR: Expected data write to reg x{addr} of value {hex(expected_val)},"
f" got value {hex(val)}.. \n== fail test: {name}\n"
f" got value {hex(val)} in cycle={i}, PC={hex(pc)}.. \n== fail test: {name}\n"
)
print(
f"{format(expected_val, '32b')} vs {format(val, '32b')}"
Expand Down
5 changes: 4 additions & 1 deletion mtkcpu/utils/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ def reg_test(
sim.add_sync_process(capture_write_transactions(cpu=cpu, dict_reference=result_mem))
# sim.add_sync_process(print_mem_transactions(cpu=cpu))
sim.add_sync_process(check_addr_translation_errors(cpu=cpu))

sim.add_sync_process(monitor_pc_and_main_fsm(cpu=cpu, wait_for_first_haltreq=False, log_fn=print))

sim.add_sync_process(
get_sim_register_test(
Expand Down Expand Up @@ -292,7 +294,8 @@ def get_code_mem(case: MemTestCase, mem_size_kb: int) -> MemoryContents:
import tempfile
with tempfile.NamedTemporaryFile(
suffix=".elf",
dir=Path(__file__).parent
dir=Path(__file__).parent,
delete=False
) as tmp_elf:
source = f"""
.global start
Expand Down

0 comments on commit cf079b9

Please sign in to comment.