In this document, we shall have an in depth look into the circuit of the processor and its components. Furthermore, we shall have a look
The key components of this processor are
- The ALU
- The CU
- The Memory Interface
- The Instruction Address Generator
- The Instruction Decoder
- The Datapath
The ALU, for now, has no flags, and supports only four operations:
- ADD
- SUB
- AND
- OR
It takes in two inputs INPUT_A
and INPUT_B
and gives out the result of the operation in OUTPUT
. The parameter used for the operations is given by input ALU_SELECT
and it also uses another control signal ALU_ENABLE
to function
The RF, or Register File, houses a family of registers that stores the temporary usage data for the datapath. It has interface to 8 General Purpose Registers and 3 muxes to select the register to use to store data from RY
or to channel data to RA
and RB
.
Each register has a Enable Write Pin, Clock, Clear, Input and Output attached to it. Furthermore, it has 3 MUXes.
RA SELECT
selects the register to feed data to RARB SELECT
selects the register to feed data to RAWRITE SELECT
selects the register to input data from RY
Pins that we use for the register are ENABLE_RO_SELECT
, ENABLE_RA_SELECT
and ENABLE_RB_SELECT
to activate the registers, and SELECT_RA
, SELECT_RB
and SELECT_RO
to refer their addresses.
Data comes in via DATA_IN
and goes out to RA and RB via RA_OUT
and RB_OUT
respectively
Furthermore, its worth mentioning that we use another pin RO_RB_BYPASS
to bypass RO value directly into RB in case of STORE
instruction. More of which we shall come into later.
The Memory Interface is the abstraction around memory which consists of various control and data signal tunnels. All of them are described below
MEM_ADDR
takes in the address where data needs to be written to/read fromRM_OUTPUT
takes in the output from RM register (from the datapath) and feeds into the Memory. It needs theMEM_WRITE
signal to be active in order to write succesfullyMEM_OUTPUT
tunnels the output from the memory. It shares the data stored at [MEM_ADDR
] and needsMEM_READ
signal to be active to read succesfully.MEM_CLEAR
is used to clear the memoryCLK
is clock (obviously)
The IAG in this processor is responsible for generating the address to read the instructions from the memory. It starts at address 0000 and proceeds to next segment incrementing by 1. It needs the following signals to function:
CLOCK
as the system clock,PC_ENABLE
to see if the PC needs to be incremented,CLEAR
to reset the PC back to 0PC
pin is used to output the current address (16-bit)- Its only notable constituents are the PC Register, and an adder that increments the register and these pins.
The instruction decoder is responsible for extracting the data from the 32bit instruction. All the codes in this processor architecture are non-overlapping and uses the entirety of 32-bits to represent the instruction. More about the same in the encoding scheme.
The input pins are:
INPUT
: The 32bit Input being put into the IR(INSTRUCTION REGISTER)IR_ENABLE
: Enables the usage of IRIR_CLEAR
: Clears the IR
Output pins are:
OPCODE
: The 4-bit opcodeRA_SELECT
: The 4-bit address of RARB_SELECT
: The 4-bit address of RBRY_SELECT
: The 4-bit address of RYIMMEDIATE
: The 16-bit immediate value
The interface around Instruction Decoder in the MAIN Circuit looks something like
- Note that
MEM_OUTPUT
is being channelled intoINPUT
and the outputs are being channelled into their respective pins for control signals or output
- The OPCODE is being fed into this MUX here for further decoding into the respective operation channel. These operations trigger respective control signals in the control unit.
The datapath is THE most significant and active component of the processor. All the other components are built around it and according to its convenience.
The datapath of our 32-bit RISC processor is a 5 stage pipeline, each stage executing a specific part in completing the instruction. More about that here
The control unit takes in signals for all the instructions and stages and triggers respective signals in the dataline and several other components. It is being extensively discussed here