PULP Community
Access Stack Pointer in RiscV Pulp - Printable Version

+- PULP Community (https://pulp-platform.org/community)
+-- Forum: PULP's Community forum (https://pulp-platform.org/community/forumdisplay.php?fid=1)
+--- Forum: PULP General questions (https://pulp-platform.org/community/forumdisplay.php?fid=2)
+--- Thread: Access Stack Pointer in RiscV Pulp (/showthread.php?tid=205)



Access Stack Pointer in RiscV Pulp - RiscV - 08-22-2020

Hi ,
I am trying  C to hex conversion for a simple (addition) program. My disassembly code is as follows:

Code:
00010000 <main>:
   10000:    fe010113              addi    sp,sp,-32
   10004:    00812e23              sw    s0,28(sp)
   10008:    02010413              addi    s0,sp,32
   1000c:    00a00793              li    a5,15
   10010:    fef42623              sw    a5,-20(s0)
   10014:    00500793              li    a5,5
   10018:    fef42423              sw    a5,-24(s0)
   1001c:    fec42703              lw    a4,-20(s0)
   10020:    fe842783              lw    a5,-24(s0)
   10024:    00f707b3              add    a5,a4,a5
   10028:    fef42223              sw    a5,-28(s0)
   1002c:    00000793              li    a5,0
   10030:    00078513              mv    a0,a5
   10034:    01c12403              lw    s0,28(sp)
   10038:    02010113              addi    sp,sp,32
   1003c:    00008067              ret

I used elf2hex for getting hex file. Hex files are generated successfully. I am using Riscv Pulppissimo testbench, and using readmemh for reading the generated hex file. My issue is after generating the .vcd file (gtkwave) I am not getting the result of addition. As per the disassembly section the result will go to the stack pointer, But how can I access SP in .vcd file.
In my vcd file regfile_alu_wdata loading the input values ie;5 and F but the result getting is 000102CE. I am getting the same result  for other input values too.......


RE: Access Stack Pointer in RiscV Pulp - RiscV - 08-25-2020

How to add SP registers in testbench module?