MIPS and RISCV Components - muneeb-mbytes/computerArchitectureCourse GitHub Wiki

Register file

reg2 drawio

For every add,subtract and other similar operations, we need two operands that have to come from the register file and the result has to go to the register file.It's nothing but an array of flip-flops.

It may be a 2D array of flip-flop or 1D array of registers, each register being 32 bit. In any of the case, it has provision for

INPUT: Two Read Register - 5 bit Each One Write Register - 5 bit One Write Data

OUTPUT: Two Read Data

It has a total of 32 into 32 bits of storage and it has provision for reading two 32-bit values and writing one 32-bit value.

RISC V:

Register file:

reg2 drawio

A register file is a structure that will store the processor’s 32 general purpose registers. A register file is a collection of registers in which any register can be read or written by specifying the number of the register in the file. The register file contains the register state of the computer. In addition, we will need an ALU to operate on the values read from the registers. For each data to be read from the registers, we need an input to the register file that specifies the register number to be read (Read register 1 & 2) and an output from the register file (Read data 1 & 2) that will carry the value that has been read from the registers. To write a data word, we will need two inputs: one to specify the register number to be written (write register) and one to supply the data to be written into the register (write data). The register file always outputs the contents of whatever register numbers are on the Read register inputs. Writes, however, are controlled by the write control signal (RegWrite), which must be asserted for a write to occur at the clock edge. writes are edge-triggered, so that all the write inputs (i.e., the value to be written, the register number, and the write control signal) must be valid at the clock edge. We need a total of four inputs (three for register numbers and one for data) and two outputs (both for data). The register number inputs are 5 bits wide to specify one of 32 registers (32 = 2^5), whereas the data input and two data output buses are each 64 bits wide The register file always outputs the contents of the registers corresponding to the Read register inputs on the outputs.