I've been trying to simulate small binary file (translated to hex) using the cycle-accurate RISC-V Rocket-chip C++ emulator. The build process of emulator was successful and make run generates correct test/benchmark results.
However, when I compiled a custom source code and simulated it, it just printed lots of 000000... in log file. Surely, I checked those logs with enough cycle counts and there weren't any changes as it runs. It just kept printing 0000.. in operand number, inst, DASM and so on without stopping simulation. Some of exceptions are the first few lines, see below.
C0: 0 [0] pc=[00000002000] W[r 0=0000000000000048][0] R[r13=00000000003741c8] R[r28=36f000000000006c] inst=[a3c6f23b] DASM(a3c6f23b)
C0: 1 [0] pc=[00000002000] W[r 0=0000000000000048][0] R[r13=00000000003741c8] R[r28=36f000000000006c] inst=[a3c6f23b] DASM(a3c6f23b)
C0: 2 [0] pc=[00000002000] W[r 0=0000000000000048][0] R[r13=00000000003741c8] R[r28=36f000000000006c] inst=[a3c6f23b] DASM(a3c6f23b)
C0: 3 [0] pc=[00000002000] W[r 0=0000000000000048][0] R[r13=00000000003741c8] R[r28=36f000000000006c] inst=[a3c6f23b] DASM(a3c6f23b)
C0: 4 [0] pc=[00000002000] W[r 0=0000000000000048][0] R[r13=00000000003741c8] R[r28=36f000000000006c] inst=[a3c6f23b] DASM(a3c6f23b)
C0: 5 [0] pc=[00000002000] W[r 0=0000000000000000][0] R[r 0=0000000000000000] R[r 0=0000000000000000] inst=[00000000] DASM(00000000)
repeating the last line 0000....
In the middle of simulations, pc eventually increases but it still prints 0000.. over and over again, it didn't stop. Here is the C source code and process I've tried. (Also, I tried many other sources.)
int main(){
int a=0, i;
for (i=0; i<100; i++){
a += 1;
}
return 0;
}
And, command lists.
riscv-unknown-elf-gcc hello.c -o hello
elf2hex 16 16384 hello > hello.hex
emulator-DefaultCPPConfig +dramsim +max-cycles=100000000 +verbose +loadmem=hello.hex none 2> hello.out
I think the simulator doesn't correctly recognize the translated hex format. So, it cannot triggers correct instruction streams. Can anyone help?
Thanks,