/RISCV-32I-Single-Cycle-Processor

Implementation of RISCV32I Single Cycle Architecture consisting of six base instructions (R, I, B, S, J, U).

Primary LanguageSystemVerilog

RISCV-32I Single Cycle Processor

This basic design supports six base instructions mentioned as:

  • R-Type
  • I-Type
  • S-Type
  • B-Type
  • J-Type
  • U-type

All above instructions are 32 bits encoding based.

DataPath

In order to implement B-type U-type and J-Type I did some ammendments according to the requirements but the main underlying datapath is same which is provided below.

image

Simulation

For Simulation I have used QuestaSim,and I have also uploaded my complete project folder with name project. If you have QuestaSim setup istalled in your computer you can simply download this folder and can run RV32I.mpf file inside project folder. If you want to make your own project then you need to make a new project and all the modules that are in RTL folder add them as design source

Testing

For Testing purposes I have added gcd.s assembely file which calculates the GCD of two given numbers

image

The value stored in x8 is 10 and for x9 is 50 the above algorithm calculates the GCD of two numbers and store the result calculated in register file x10.For verification purpose the algorithm has been tested in Venus and the result obtained is shown as below

Venus output

After running these assembly instructions in QuestaSim the same result has been obtained

Output 3 Output 4

Output 5

The GCD of 5 and 50 is calculated as 10 and is stored back in register x10

Reference

Some part of this material and understanding is taken from book " Digital Design and Computer Architecture RISC-V Edition " by Sarah L Harris and David M Harris.