unicorn icon indicating copy to clipboard operation
unicorn copied to clipboard

How do you execute the JALR instruction of riscv-32?

Open qiluge opened this issue 3 years ago • 1 comments

The tracing code log the state of UNICORN executing result:

t=2022-08-24T16:44:57+0800 lvl=info GID=50 msg="registers: map[0:0 1:1000928 2:4294966816 3:0 4:0 5:0 6:0 7:0 8:0 9:0 10:4294966816 11:5 12:0 13:0 14:0 15:0 16:0 17:5 18:0 19:0 20:0 21:0 22:0 23:0 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:1070564]"
t=2022-08-24T16:44:57+0800 lvl=info GID=50 msg="executing instruction: 001055e4: 4dc080e7 \tjalr 1244(ra)"
t=2022-08-24T16:44:57+0800 lvl=info GID=50 msg="registers: map[0:0 1:913948 2:4294966112 3:0 4:0 5:0 6:0 7:0 8:4294966768 9:90712 10:4294966144 11:0 12:204 13:0 14:0 15:0 16:0 17:5 18:1 19:0 20:0 21:0 22:4294966144 23:0 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:1391532]"

But in my program, the result is:

t=2022-08-24T16:03:22+0800 lvl=info GID=21 msg="registers: map[0:0 1:1000928 2:4294966816 3:0 4:0 5:0 6:0 7:0 8:0 9:0 10:4294966816 11:5 12:0 13:0 14:0 15:0 16:0 17:5 18:0 19:0 20:0 21:0 22:0 23:0 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:1070564]"
t=2022-08-24T16:03:22+0800 lvl=info GID=21 msg="executing instruction: 001055e4: 4dc080e7 \tjalr 1244(ra)"
t=2022-08-24T16:03:22+0800 lvl=info GID=21 msg="registers: map[0:0 1:1070568 2:4294966816 3:0 4:0 5:0 6:0 7:0 8:0 9:0 10:4294966816 11:5 12:0 13:0 14:0 15:0 16:0 17:5 18:0 19:0 20:0 21:0 22:0 23:0 24:0 25:0 26:0 27:0 28:0 29:0 30:0 31:0 32:1002172]"

There are too many difference between UNICORN and my program, not only the value of nextPC, but also others registers, such as x[1](RA) and x[2](SP).

note: register[0,31] are x[0,31], register[32] is pc

qiluge avatar Aug 25 '22 07:08 qiluge

should write 1070564+4 to rd, and nextPC should be 1000928 + 1244.

qiluge avatar Aug 25 '22 09:08 qiluge

Hello, could you provide a small reproduction script? It's hard to infer anything from such logs.

wtdcode avatar Sep 25 '22 16:09 wtdcode

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.

github-actions[bot] avatar Nov 25 '22 05:11 github-actions[bot]

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.

github-actions[bot] avatar Jan 31 '23 05:01 github-actions[bot]