The Arithmetic Logic Unit or the ALU is a digital circuit that performs arithmetic and logical operations. Where arithmetic operations include things such as ADD and SUBTRACT and the logical operations include things such as AND, OR, NOT.
The ALU is a fundamental building block in the central processing unit (CPU) of a computer and without it the computer wouldn't be able to calculate anything! Some examples of assembly code instructions that would use the ALU are as follows (not all processors will have all these instructions):
ADD ;add one number to another number SUB ;subtract one number to another number INC ;increment a number by 1 DEC ;decrements a number by 1 MUL ;multiply numbers together OR ;boolean algebra function AND ;boolean algebra function NOT ;boolean algebra function XOR ;boolean algebra function JNZ ;jump to another section of code if a number is not zero (used for loops and ifs) JZ ;jump to another section of code if a number is zero (used for loops and ifs)
The control unit sits inside the CPU and coordinates the input and output devices of a computer system. It coordinates the fetching of program code from main memory to the CPU and directs the operation of the other processor components by providing timing and control signals.
Processor clock - A timing device connected to the processor that synchronises when the fetch, decode execute cycle runs
Your computer might contain several clocks that each regulate different things. The clock we are going to look at here will keep the processor in line. It will send the processor a signal at regular times telling it to start the fetch decode execute routine.
Clock speed - The number of cycles that are performed by the CPU per second
Clock speed is measured in Hertz, which means 'per second'. You have probably heard of clock speeds such as 1 MHz, this means 1,000,000 cycles per second and potentially a million calculations. A computer of speed 3.4 GHz means it might be capable of processing 3,400,000,000 instructions per second! However it isn't as simple at that, as some processors can perform more than one calculation on each clock cycle, and processors from different manufacturers and using different architecture are often difficult to compare. (See the Megahertz myth). Also with the increase in multi-core processors such as the PS3 (7 cores) and the Xbox 360 (3 cores) there might be times where the clock might be ticking but there is nothing for the processor to calculate, the processor will then sit idle.
Registers - a small amount of fast storage which is part of the processor
For immediate calculations, using main memory is too slow. Imagine having to send a signal along the address bus and some data along the data bus when all you want to do is store the result of adding two numbers together. The distance between the processor and main memory, even though it might be a few centimetres, is far enough for the signal to take a significant time to get there. To get past this issue there are small amounts of memory stored inside the processor itself, these are called registers. Registers are incredibly fast pieces of memory that are used to store the results of arithmetic and logic calculations.
Different processors will have different sets of registers. A common register is the Accumulator (acc) which is a data register, where the user is able to directly address (talk to) it and use it to store any results they wish. Processors may also have other registers with particular purposes:
There are also 4 registers in particular that you need to know, we'll meet them in more detail in the next chapter:
Match the following components to the numbers on the diagram: Processor, Data bus, Control Bus, Main memory, Keyboard, Secondary storage, Address bus, Clock, Monitor, VDU controller, disk controller, keyboard controller
Don't worry about the size of this problem, we are going to tackle it bit by bit. the first step is to remember the differences between each of the components:
Now we have remembered what each device does, can you label them all?