bluespec / Piccolo

RISC-V CPU, simple 3-stage pipeline, for low-end applications (e.g., embedded, IoT)
Apache License 2.0
311 stars 49 forks source link

No C extension causes Piccolo compile failure #19

Closed jsburke closed 5 years ago

jsburke commented 5 years ago

I tried building Piccolo as a simple RV32 IM yesterday, and the compile failed, saying:

Error: "../../src_Core/CPU/CPU_Stage1.bsv", line 243, column 35: (T0004)
  Unbound variable `instr_C'

It comes from here, where instr_C is used outside of an ISA_C block.

I'm not sure the most elegant way to handle this, but I've done this in the meantime locally and it works fine as far as I can tell:

         if (alu_outputs.exc_code == exc_code_ILLEGAL_INSTRUCTION)
`ifdef ISA_C
            tval = (is_i32_not_i16
                    ? zeroExtend (instr)
                    : zeroExtend (instr_C));                   // The instruction
`else
            tval = zeroExtend (instr);
`endif
rsnikhil commented 5 years ago

You are quite right (both the diagnosis and the solution). Thanks. I have made this fix in both Piccolo and Flute.

jsburke commented 5 years ago

Thanks for the quick response, Nikhil!

I hope you don't mind me pointing this out after you closed the issue here, but the same fix wasn't needed in Flute because of the struct used in the similar piece of code. Minor, but thought maybe you'd like to know

rsnikhil commented 5 years ago

Thanks John. Comments always welcome! Best regards!