olofk / serv

SERV - The SErial RISC-V CPU

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

addi opcode wrong result

MaximMndv opened this issue · comments

Tried to run GCC C compiled code on SERV RISC V.
Seems the addi opcode behaviour is wrong.
assembly code like:
addi sp,sp,-64
or
deadc1b7 lui gp,0xdeadc
eef18193 addi gp,gp,-273 # 0xdeadbeef

result in wrong value in the target register.
Same code on PicoRV32 and on DarkRISCV works fine.

Ouch. That sounds really bad. I can't reproduce this issue here and haven't seen any problems when running the RISC-V compliance test suite. Would it be possible to send me a VCD trace, simulator logs or something like that? Really want to get this fixed soon if it's an issue.

What simulator are you using? Or is it a synthesis issue?

Hi Maxim,

Sorry for the delay. I was away most of the week. Wanted to take a look at this now but it looks like the VCD is missing.

So instead I created a program from your listing to see if I could recreate your issue but I don't see the same thing that you see. gp is set to 0xdeadbeef after 298: eef18193 addi gp,gp,-273 # 0xdeadbeef and b80: 00112e23 sw ra,28(sp) generates a store to address 0x7f8.

I'm attaching my trace file and the memory file I used (which is just a subset of your program listing). If you want to run it yourself with Verilator you can run fusesoc run --target=verilator_tb servant --firmware=issue17.vh --vcd --timeout=200000

Would be very interesting to see your VCD. It looks like you responded via e-mail, but perhaps you need to zip it and submit it through the github GUI for it to show up
issue17.tar.gz

Hi Maxim,

The attachment still doesn't show up. Either send it to me directly in a mail (not through github) or attach it to the issue using the github gui

I completely forgot about this one, but was reminded earlier today. I looked at the trace now and I believe the problem is that the slave is not following the wishbone protocol. At time 256784, SERV lowers the cyc signal, but the slave keeps ack asserted. This breaks SERV

Closing this due to inactivity. Please reopen if issue remains