riscvspike

How can I see the content of a float-point register on spike?


I'm working with a riscv code and I want to simulate it using the spike tool. The aim of the simulation is to see the content of some float-point registers.

So, if i want to see the content of an integer register i use the next command:

reg 0 s0

but if i attempt to use the same command for a float-point register:

reg 0 ft0 

it always shows me all the bits set to zeros............

I attach some of the assembler code that i'm working....

 10164: 0000f053            fadd.s  ft0,ft1,ft0
 10168: fe042227            fsw ft0,-28(s0)

In this fragment of the code I used the command reg to see the content of the float-point registers ft1 and ft0 (reg 0 ft1 or reg 0 ft0) after the fadd.s instruction, the result is:

core   0: 0x0000000000010164 (0x0000f053) fadd.s  ft0, ft1, ft0
: reg 0 ft0
0x0000000000000000

But if i look for the content saved in memory after the execution of the fsw instruction, the result is not zero and it is correct

core   0: 0x0000000000010168 (0xfe042227) fsw     ft0, -28(s0)
: mem 0 7fffff04
0x0000000040e00000

As you can see the question is why using the reg command to see the content of a float-point register always bring me zeros as the content of the register. It's something wrong with the reg format and the float-point registers?


Solution

  • For floating point registers, the command fregs or fregd must be used, depending on whether you wish to see the value represented as a single-precision or double-precision value.