A register bank is used for the programmable registers used by assembly language programmers. It can be viewed as the hardware equivalent of a software array. It has ports for reading and writing data given an index. Main memory and caches have similar interfaces for reading and writing data.
A register number is used as the index in a register bank. A memory address is used as the index in main memory. A portion of a memory address is used as the index in a cache.
A register bank implemented with a set of registers together with extra circuitry for read and wite ports.
A read port provides read access to a selected word. It consists of two or three signals.
A read enable control input is usually only needed when the output is going to a bus that is shared with other devices.
Each read port in a register bank is implemented with a multiplexer.
The multiplexer data inputs are the D
outputs from each of
the registers.
The multiplexer select control input is the index input for the register
bank.
The read port output is the output of the multiplexer.
A write port provides write access to a selected word. It consists of two or three signals.
If a register bank has only one write port then it is implemented with a demultiplexer with a data output for each register in the register bank. The demultiplexer data outputs are connected to the write enable inputs of the registers in the register bank. The demultiplexer input is the write enable input for the register bank. The demultiplexer select control input is the index input of the register bank.
A register bank can have multiple write ports. This is more complex, and it only needed in more complex processor organizations such as register renaming.