How to see the contents of floating-point registers by using spike?

85 views
Skip to first unread message

mermaid

unread,
Jun 4, 2018, 7:20:23 AM6/4/18
to RISC-V ISA Dev
Hello. I have a problem. 
I have written an assembly file test.s and compile it with riscv64-unknown-elf-gcc.
When I run the command  " spike pk test ", the terminal only shows general-purpose regs.
But I want to see the contents of floating-point regs. What should I do?
" spike -d pk test " can't work correctly.
Thank you.  
 

Tommy Murphy

unread,
Jun 4, 2018, 7:25:19 AM6/4/18
to RISC-V ISA Dev
Use GDB to debug the program running on spike?

mermaid

unread,
Jun 4, 2018, 9:28:10 AM6/4/18
to RISC-V ISA Dev
No. I don't debug C program. I need to run assembly language.
Like this:  
30: mul t0, a6, a2
38: fcvt.s.wu ft1, t0  
40: fdiv.s ft2, ft1, ft0 
48: fcvt.wu.s t1, ft2, rdn   
50: fcvt.s.wu ft3, t1  
58: fsub.s ft4, ft2, ft3
I want to know the contents of floating-point registers.
Like this:








在 2018年6月4日星期一 UTC+8下午7:25:19,Tommy Murphy写道:

Bruce Hoult

unread,
Jun 4, 2018, 9:46:03 AM6/4/18
to mermaid, RISC-V ISA Dev
On Tue, Jun 5, 2018 at 1:28 AM, mermaid <merma...@gmail.com> wrote:
No. I don't debug C program. I need to run assembly language.
Like this:  
30: mul t0, a6, a2
38: fcvt.s.wu ft1, t0  
40: fdiv.s ft2, ft1, ft0 
48: fcvt.wu.s t1, ft2, rdn   
50: fcvt.s.wu ft3, t1  
58: fsub.s ft4, ft2, ft3

And so?

br *0x40

... will break on the fdiv.s

Your instructions are spaced 8 bytes apart whereas I'd expect 4 bytes. What's up?
 
I want to know the contents of floating-point registers.
Like this:









info all-registers  (or "i r a" or "i al")
 

John Burke

unread,
Jun 4, 2018, 11:24:28 AM6/4/18
to RISC-V ISA Dev, merma...@gmail.com
Hello,

If you launch spike with the interactive option -d, which you mentioned, does running until a certain instruction and typing "fregs <core no.> <reg no.>" not work properly?  I think I'm seeing the contents of simulated fp registers using it over a quick piece of dummy code to multiply two floats. It seems, unfortunately, that this command in spike does not enumerate all registers nicely like the integer one will when no register is specified


-John

Tommy Murphy

unread,
Jun 4, 2018, 11:34:55 AM6/4/18
to RISC-V ISA Dev
GDB can debug more than just c programs.
E.g. there's nothing to stop it debugging an assembly language program.
But there seem to be other solutions here anyway so GDB may be moot.

mermaid

unread,
Jun 4, 2018, 12:50:50 PM6/4/18
to RISC-V ISA Dev, merma...@gmail.com
There is a strange phenomenon.
If I type " spike pk test ", I can see the correct results of integer registers. That means this file is correct.
But if I type " spike -d pk test " and " run ", I can't find my instructions.
And I type " fregs 0 ft0 " or other ft, then it shows " non ".
I'm trying to use GDB. 
If you want, I can give you my test file. I write this assembly language according to the C program of down-sampling.
Anyway, thank you for your reply.  

在 2018年6月4日星期一 UTC+8下午11:24:28,John Burke写道:

mermaid

unread,
Jun 4, 2018, 12:52:49 PM6/4/18
to RISC-V ISA Dev
OK. I'm trying to use GDB. 
Thank you for your reply.

在 2018年6月4日星期一 UTC+8下午11:34:55,Tommy Murphy写道:
Reply all
Reply to author
Forward
0 new messages