bluespec / Flute

RISC-V CPU, simple 5-stage in-order pipeline, for low-end applications needing MMUs and some performance
Apache License 2.0
356 stars 56 forks source link

Optimise some adders in CPU_Fetch_C #29

Open ivanmgribeiro opened 4 years ago

ivanmgribeiro commented 4 years ago

This pull request has two commits to reduce the number of adders in CPU_Fetch_C and reduce the area footprint of the design.

There is one change that replaces addr_of_b32 with imem32.pc when they are equal - I would expect either the Bluespec compiler to see this optimisation or the synthesis tool to optimise it away but it looks like neither of these things happen and the design ends up using an extra adder for no reason.

The other change replaces the check for imem32.pc == rg_pc + 2 with a Bool register that is set each time rg_pc is updated or a request is made to imem32. There are comments in the code that explain my reasoning for this. I'm not sure if these comments should remain in the final design or not. Let me know what you think.

Thanks, Ivan