Execute
The last step of our instruction cycle is execution. Here the operands are loaded into the ALU as well as a control signal indicating the operator and the result is either taken as the jump address for the next clock and loaded into the PC register, or the result is either loaded into the register file or the main memory. There are two possibilities for the input a, either it is the immediate value or the value from the addressed rs1 register. It must be emphasized that the ALU is always involved regardless of the instruction. In the example of a jump, the immediate value is obtained from the instruction and passed through the ALU using a NOP instruction. The result is then written to the PC register.

ALU
The arithmetic logic unit (ALU) is the central unit that performs arithmetic operations. It is probably included in every processor that exists and is crucial. The ALU can be designed in different ways. For example, there are many ways in which a simple addition can be performed. Some variants require more logic blocks to be realized and others are faster.
As inputs, the ALU receives the operands, a control signal (op) which indicates which operation is to be carried out and a clock and reset signal. As can be seen in the source code, there are a total of 8 operations that the ALU supports.
Here we use a little trick to realize conditional jumps. We use flags that are set and checked by the controller. As an example the flag_zero, we can use this flag to realize a conditional jump like jump equal (je) or jump not equal (jne). What we use for this is that if the previous operation results in 0, this flag is set to 1. This is the case, for example, when a subtraction is performed and both numbers have the same value. This means that we can use the subtraction and this flag to compare whether two numbers are equal. If the subtraction is followed by a conditional jump operation, and both numbers were equal, it means that we are actually jumping.
