Internal Registers and ALU
We continue our discussion with internal registers and ALU. There are four functional blocks in a generalized microprocessor connected to the internal data bus and they all use registers. Let's jump ahead just a moment here. What are we talking about here? Well, here we have the four generalized blocks that are connected to the data bus and notice we have the general purpose register, the instruction register, the ALU, and the accumulator. All of these are what we call registers. First of all, we probably ought to say we got these four functional blocks and they're all registers, but what is a register? Well, a register is a series of flip flops or a pre-settable counter into which groups of bits can be stored and retrieved. It is a preferred location to store commands in a microprocessor since it is faster than storing in memory. It is the same width as the data bus. For our purpose eight bits. It is a preferred location for storing commands in a microprocessor since it's stored right within the processor it doesn't have to go external to it to be stored in memory and it can be done very quickly.
We have these four functional blocks. The first one is the general purpose register. This is for temporary storage of data during program execution. The second one, we're going to be looking at something called the instruction register. The microprocessor accesses memory and retrieves commands through the data bus. Okay, it does that. Once received, the command is temporarily stored in the instruction register while the microprocessor decodes and interprets the instructions. It holds commands that are currently being decoded by the microprocessor. It is called the instruction register. The third one is the ALU, this is short for arithmetic logic unit, and it is where all of the arithmetic and logic functions are carried out. Here we have some commands, for example, we have add, subtract, equality, greater than. These are all math functions that are carried out in the ALU. Also in the ALU logic functions are addressed. Things like and, or, exclusive or, etc.
The fourth is the accumulator. It is a register that is similar to the general purpose register. It holds data or the results of an operation during the processing cycles. The accumulator can hold one of the two operands during any ALU operation. If we want to add two bytes together, this would just be an example here; one byte would go to the accumulator, and the other in memory or general purpose register. When executed the two numbers serve as the input to the ALU. You have two bytes, one would go to the accumulator, one to, probably, the general purpose register and then when executed the two numbers serve as inputs to the ALU, which we talked about up here. The output of the ALU is fed back into the accumulator. The accumulator would receive the results, the two bytes. The specific features of accumulators will vary from processor to processor. The accumulator is the only register that can perform the shift function that we discussed earlier. Remember if we shifted right or shifted left we could effectively divide by two or multiply by two.
Here we have the picture that we started out with in this discussion and here are the four registers we discussed, the general purpose, instruction, arithmetic, and accumulator. Notice that they all function in respect to the data bus.