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 necessary low-level assembly code that I have executed was the following:

Transact-SQL

1

2

3

4

SETA"0001"

SETB"0010"

MOV8

HLT

The pure binary code was the following:

Transact-SQL

1

2

3

4

11100001//SETA"0001"

11110010//SETB"0010"

10001111//MOV8

11000011//HLT

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):

Transact-SQL

1

MOVD,0b00100001

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:

Transact-SQL

1

2

3

4

11100001//SETA"0001"

11110010//SETB"0010"

10001111//MOV8

11011000//MOV_ALU_OUTD

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.