Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FROM_BLINKER_TO_RISCV step 14 multiply simulates but doesn't run on IceStick #84

Open
dbenn opened this issue Dec 14, 2022 · 0 comments

Comments

@dbenn
Copy link

dbenn commented Dec 14, 2022

I'm enjoying your FemtoRV/TUTORIALS/FROM_BLINKER_TO_RISCV tutorial!

I came up with a few multiplication subroutine variants. This one, for example, simulates fine with run.sh but does not yield the expected LED outputs on the IceStick. I have had no problems with previous exercises and examples.

`include "riscv_assembly.v"
   integer START_    = 0;
   integer MUL_      = 20;
   integer MUL_LOOP_ = 28;
   integer MUL_DONE_ = 44;

   initial begin
   Label(START_);
      // 3 x 4 = 12 = 0b1100
      LI(a0,3);
      LI(a1,4);
      CALL(LabelRef(MUL_));
      
      EBREAK();

   // multiply function
   Label(MUL_);
      LI(a2,0); // result
      LI(a3,0); // 1..a1
   Label(MUL_LOOP_);
      BEQ(a3,a1,LabelRef(MUL_DONE_));
      ADD(a2,a2,a0); // result += a0
      ADDI(a3,a3,1);
      J(LabelRef(MUL_LOOP_));
   Label(MUL_DONE_);
      MV(a0,a2);
      RET();

      endASM();
   end

The output of:

./run.sh step14_mul_func.v 

is:

Label:          0
Label:         20
Label:         28
Label:         44
LEDS = 01100

which is the expected result.

However, running this on the IceStick does not yield the expected LED pattern. Actually, no LEDs are lit at all.

I can provide the complete step14_mul_func.v if necessary, but it's literally just the assembly code section that has changed from step14.v, changed to the listing above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant