The open-source RISC-V instruction set architecture has become a popular choice due to its performance, versatility, ease of implementation and extensibility. The instructions in the base architecture are, in the RISC fashion, all of uniform size. The C extension introduces compressed instructions as alternatives to frequently used instructions in the base architecture, which is useful for improving code density. Implementing the extensions brings its own challenges: in a system implementing the C extension, programs contain both compressed and non-compressed instructions. This means that instructions are no longer 32-bit aligned in instruction memory. We must remove all assumptions regarding alignment in our design, and we must adapt the instruction fetch mechanism to handle intermixed instructions of variable length.
RVJ1 is an open-source in-order RISC-V core that implements a five-stage pipeline. It is written in the SystemVerilog language. In this thesis, we present the implementation of the C extension on the RVJ1 core and the verification of this design. The instruction fetch unit has been adapted to handle compressed instructions, using a FIFO queue to buffer fetched data and a combinational module to expand the compressed instructions into their base 32-bit forms.
The design has been verified via simulation (utilising open-source Python-based tools) and the RISC-V architectural test suite. After verifying the design, we performed synthesis and benchmarking, and analysed the results. As expected, the size of the core has increased. The critical path, however, experienced no significant negative change. We also observed that the Coremark benchmark produced a somewhat better score for the new design.
|