Storing ALU Results in a General Purpose Register

Today I have made another huge step forward in my CPU project: I’m now able to transfer the result from an ALU operation into a General Purpose Register for further processing. As I have mentioned in my previous blog posting, my ALU consists of 2 Input Registers (A and B), and one Output Register (C). When you perform an ALU operation, the ALU takes both 8-bit input values from the A and B register, performs the calculation, and finally stores the 8-bit result in the C register.

And now I’m just transferring the content from the C register into one of the 8 General Purpose Registers (D, E, F, G, H, XL, XM, XH), where the 8-bit binary number is stored for further processing. The following picture shows you the overall CPU.

The current state of my CPU

On the left hand side you can see the ALU, the middle board contains the counter, the timer, the SRAM memory, the Program Counter, and the ALU input/output registers. And on the right hand side you can see the Instruction Decoder, which I’m referring to as the “brain of the machine” 😉 And on the board on the very right hand side I will wire up all 8-bit and 16-bit General Purpose Register. For today’s proof-of-concept I’ve just wired up one General Purpose Register (the D-register), which you can see on the desk in the front of the machine. I have executed here the following binary code.

You are maybe asking what the role of the XL, XM, and XH register is? Quite simple: My address bus is currently 8 bit wide. In the future I will extend it to 16 bits (64K addressable main memory), and finally to 24 bits (16 MB addressable main memory). To set a 16 or 24 bit address with my 8-bit wide data bus, I’m just transferring the individual bits into the XL (bit 0 - 7), XM (bit 8 - 15), and XH (bit 16 - 23) register. It’s mainly the same split as on the x86 platform with the AX register (which internally accessible through the AL and AH register).

What are the next steps?

  • Soldering the remaining General Purpose Registers (8-bit wide and 16-bit wide)
  • Soldering the remaining 14 ALU operations
  • Implementation of the various MOV opcodes (moving 8 and 16 bit values between the various registers
  • Working on the FLAGS register (I need here also some temporary “Buffer” registers, so that I don’t mess up the various status codes through other operations, which makes it a little bit complex…)
  • Implementation of unconditional and conditional Jumps!

Stay tuned!

-Klaus

Comments are closed.