SpinalHDL / NaxRiscv

MIT License
267 stars 40 forks source link

Accessing addr 0x0000001e doesn't throw access fault exception #108

Closed zhangkanqi closed 5 months ago

zhangkanqi commented 6 months ago

Hi,

I found that when accessing addr 0x0000001e, NaxRiscv doesn't throw access fault exception. This might be a pretty obvious bug.

By the way, could you offer the address map in NaxRiscv like the following format? I didn't find that either in docs and source codes. Thanks a lot.

zhangkanqi commented 6 months ago

For debug: mem_not_ae.zip

For reproduce: NaxRiscv: f335738370e50d5d23614150c3e8c4a85685e43a

cd $NAXRISCV
vim NaxRiscv/src/main/scala/naxriscv/Gen.scala # enable Rvc&float&double in Gen64
sbt "runMain naxriscv.Gen64"
cd $NAXRISCV/src/test/cpp/naxriscv
./obj_dir/VNaxRiscv --load-elf=./input_nax_86.elf --start-symbol=_start --pass-symbol=write_tohost --timeout=100000 --name=input_nax_0 --trace --trace-ref --spike-debug
Dolu1990 commented 5 months ago

Hi,

The NaxRiscv default regions are : ioRange : UInt => Bool = (31 downto 28) === 0x1, fetchRange : UInt => Bool = (31 downto 28) =/= 0x1,

Meaning [0x1000_0000, 0x1FFF_FFFF] is io mapped, and also can't be used to execute instruction There is a few peripherals emulated in that range.

[0x000_0000, 0x0FFF_FFFF] is cached but will always return fault by the testbench [0x200_0000, 0xFFFF_FFFF] is cached and always ok

NaxRiscv will not give you a fault on cached memory store. So the issue you have is expected by design. The reason is that memory store happen after commit for performance reason.

zhangkanqi commented 5 months ago

Get it. Thanks for you reply!