YosysHQ / picorv32

PicoRV32 - A Size-Optimized RISC-V CPU
ISC License
3.08k stars 748 forks source link

Building code with riscv32imc toolchain the execution is stucking #262

Closed SyedFahimuddinAlavi closed 2 months ago

SyedFahimuddinAlavi commented 3 months ago

Building code with riscv32imc toolchain, the code is stucking in simulation cxxdemo and it is not stucking when built with the riscv32ic toolchain. Looks like there is some problem with the PCPI/Multiplication implementation.

Update: I noticed from objdump that mul, mulhu, div and divu instructions are introduced when compiled with riscv32imc tool-chain. So ENABLE_MUL is not only sufficient so you have to enable div too!

Questions is that what is the design principle of PicoRV32 CPU core that implements the RISC-V RV32IMC Instruction Set and best other way to debug this problem?

SyedFahimuddinAlavi commented 3 months ago

I found that some codes are not stucking when using mul, mulhu, div and divu. I analyzed and found that it could be some memory corruption in firmware that is introduced when using riscv32imc toolchain. I think ticket can be shelved or reference for someone who has faced same problem.