chipsalliance / dromajo

RISC-V RV64GC emulator designed for RTL co-simulation
Apache License 2.0
210 stars 63 forks source link

maxinsns flag does not work when ncpus > 1 #73

Closed kabylkas closed 1 year ago

kabylkas commented 1 year ago

Dromajo does not respond to maxinsns variable when ncpus > 1

To reproduce:

./dromajo --trace 0 --maxinsns 100000 --ncpus 2 [riscv-bin]
kabylkas commented 1 year ago

It seems the issue is related to the unsignedness of maxinsns or the fact that it is common to all cores. Once maxinsns riches zero, the next core in the loop overflows it here: https://github.com/chipsalliance/dromajo/blob/6f68f74a2a3ca26c5460f7864d5769face2c69bd/src/dromajo.cpp#L125

and this condition fails: https://github.com/chipsalliance/dromajo/blob/6f68f74a2a3ca26c5460f7864d5769face2c69bd/src/dromajo.cpp#L127

kabylkas commented 1 year ago

Fixed in #76