The ALU is connected to the CPU!

Today I’ve made a huge step forward with my CPU: my ALU is now finally connected to the CPU, and performs its first calculation. The ALU itself is connected to 2 input registers and 1 output register of the CPU. These 3 registers are private to the ALU, and can’t be directly programmed by the assembler language. The 2 input registers are named A and B, and the output register has the name C.

In my case the ALU has performed the MOV8 instruction, which converts 2 4-bit values into a fully 8-bit value. When you look at the picture below, the A register holds the binary value 0001 and the B register holds the binary value 0010 (the upper nibbles are just zeros and are ignored by the MOV8 instruction). And the output register C contains the 8-bit binary value 00100001, which was calculated by the ALU.

The input and output registers of the ALU

The necessary low-level assembly code that I have executed was the following:

The pure binary code was the following:

In the next step the result of the ALU is transferred from the internal C register into one of the 8 general purpose registers (D, E, F, G, H, XL, XM, XH). And afterwards I have to solder the 14 additional ALU functions to have a fully functional ALU. When this functionality is implemented, you can perform for example the following CISC style assembly instruction (the assembly language also supports decimal and hex values for loading immediate values into the general purpose registers):

This high-level assembly instruction will be expanded by my assembler into the following low-level instructions that can be finally executed by the CPU:

You - as a developer - are programming the CPU with CISC level instructions, which will be finally converted by the assembler to RISC level instructions and its corresponding binary code.

Easy, isn’t it?


Comments are closed.