YosysHQ / picorv32

PicoRV32 - A Size-Optimized RISC-V CPU
ISC License
3.15k stars 759 forks source link

Help regarding Simulation of PicoRV32 in vivado #267

Open Tanishqgithub opened 4 months ago

Tanishqgithub commented 4 months ago

Respected sir

I am Tanishq.S , studying in PES UNIVERSITY Bangalore India and i am writing this mail to seek help regarding simulation of picorv32 in vivado

  1. I choose to implement the picorv32 using the testbench given in testbench_ez [i am simulating without any RISCV Compiler toolchain]

While trying the program u have given as reference i,e :

memory[0] = 32'h 3fc00093; //       li      x1,1020
memory[1] = 32'h 0000a023; //       sw      x0,0(x1)
memory[2] = 32'h 0000a103; // loop: lw      x2,0(x1)
memory[3] = 32'h 00110113; //       addi    x2,x2,1
memory[4] = 32'h 0020a023; //       sw      x2,0(x1)
memory[5] = 32'h ff5ff06f; //       j       <loop>

everything looks fine and works correctly

  1. Then i tried to substitute this code with the factorial assembly level program [RISCV ISA] i,e :

    memory[0] = 32'h 00500313;    //       addi t1,zero,5
    memory[1] = 32'h 00100293;    //       addi t0,zero,1
    memory[2] = 32'h 00100393;    //       addi t2,zero,1
    memory[3] = 32'h 00534863;    //       start: blt t1,t0,end
    memory[4] = 32'h 025383B3;    //       mul t2,t2,t0
    memory[5] = 32'h 00128293;    //       addi to,to,1
    memory[6] = 32'h FF5FF0EF;   //       jal <start>
                                                  //       <end>

    **Note the code is also beside the memory declaration But i see that the instruction gets stuck at 32'h00128293 and do not proceed itself i clearly don't know why this happens See "factorial.png" for results factorial

** Note in the results I have shown the mem_read signal getting stuck at 32'h00128293

  1. Then i tried to substitute this code with the Summation assembly level program [RISCV ISA] i,e

    memory[0] = 32'h 00500293; //      addi t0, zero, 5
    memory[1] = 32'h 00000313; //      addi t1, zero, 0
    memory[2] = 32'h 00100393; //      addi t2, zero, 1
    memory[3] = 32'h 0053AE33; //      START:  slt t3, t2, t0
    memory[4] = 32'h 00538463; //       beq t2, t0, BODY
    memory[5] = 32'h 000E0863; //       beq t3, zero, END
    memory[6] = 32'h 00730333; //       BODY: add t1, t1, t2
    memory[7] = 32'h 00138393; //       addi t2, t2, 1
    memory[8] = 32'h FEDFF06F; //     j  <START>
                                                //     <END>

    **Note the code is also beside the memory declaration Here the code gets iterated for some time but gets stuck at 32'h00730333 after 5th iteration see "summation.png" for results. summation

** Note in the results I have shown the mem_read signal getting stuck at 32'h00730333

  1. Can you please state the correct procedure to give our own Assembly level programs and am I following the correct procedure?