Page 1

The Central Processing Unit is a chip, containing million of transistors, which is responsible for almost all operations that happen within the computer system. Amongst the crucial operations/tasks that the CPU has to handle, one can mention:  The execution of programs (set of instruction) which are located in main memory  Storing and retrieving of information on disks and other media  Communication with I/O devices—where data is transferred between the CPU and these peripheral devices  Transfer of data between the CPU and main memory  Carrying out of calculations both arithmetic and logic  Providing timing and control signals for the transfer of data In terms of computing power, the CPU is the most important element of a computer system

Main Memory and addresses The memory unit (also called central memory, internal memory immediate access store) is a storage area. Programs and data must be in the memory unit before being processed. This implies that a program on secondary storage has first to be transferred into the memory unit. Memory unit is made up of a set of locations in order, located one after the other. These locations can hold certain number of bits. Data and programs are stored in these locations, ready to be used by the CPU. Therefore, a location is a kind of storage. The operation of putting items in memory is usually referred to as WRITING TO, while that of fetching a copy from memory is READING FROM. The ACCESS TIME of memory is the time taken to write or to read from memory. Access time is very small and is measured in nanoseconds.

The Organisation of Memory The main memory unit consists of a large number of units of storage called LOCATIONS. Each loction has a uniue number called the location ADDRESS. The address is used by the CPU to identify the location. Addresses start from 0 (base address) to some maximum value that the CPU can access. The maximum number of cells a computer can have is called its ADDRESS SPACE. Therefore the larger the access space the larger he memory.

Daniela Attard

Page 1

System Buses A bus is a set of parallel wires connected to two or more components of a computer. There are three important buses: the address, the data, and the control buses. Together they are known as the system bus. Data and program instructions that are stored in memory locations are moved to and from the CPU over the data bus. The CPU selects the required memory locations by sending addresses over the address bus. The CPU informs the memory unit whether it intends to perform a read or write operation over the control bus. Graphically, this is illustrated in the following diagram.

Address bus and address space When the processor wants to read data from memory, it first puts the address of the desired word in the address bus. Address space (memory capacity) would depend on the width of the address bus. For example, a bus width of 20 lines would give a memory capacity of 220, equivalent to 1MB. The table below illustrates how number of addressable cell (memory capacity) is directly related to bus width. No of address line, n

Maximum no. of addressable cells

Maximum no. of addressable cells expressed as a power of two, 2n






















We can generalize the above and say that for a bus with ‘n’ lines we will have: n

An address space (memory capacity) of: 2 n Starting from address 0 to address 2 -1

Data Bus Unlike the address bus, the data bus provides a bi-directional (two-way) path for moving data and instructions between system components. The data found in the location indicated by the address is returned to the CPU on this data bus. The width of the data bus is a key factor in determining overall system performance. For example if the data bus is 8 bits wide and each instruction is 16 bits long, then the processor must access the main memory twice during each instruction cycle. Daniela Attard

Page 2

Control Bus Carries control information between the CPU and other devices within the computer. Whereas the data bus carries actual data that is being processed, the control bus carries signals that report he status of various devices. For example, one line of the bus is used to indicate whether the CPU is currently reading from or writing to man memory.

Word Length The group of bits which can be addressed and handled as a single unit by the central processor is known as the word. The size of such a word is known as word length. It is determined by the width of the data pathways within the computer. Large word size mean that a computer can work faster than a computer with a smaller word size.

The System Clock Computers can only do one thing at a time, it may appear the many things are happening simultaneously, but in reality a computer can only process one instruction at a time, just because the computer is so fast, everything seems to be happening at once. The CPU processes digital data by taking data one-at-a-time and doing something with it. The amount of time it has to process each piece of data is controlled by a system clock in the CPU. With every Click of the clock, the CPU is able to process one type of data or execute one instruction. The CPU clock speed is measured in cycles per second. 1 cycle per second is known as 1 Hertz. A computer running at 1GHZ can carry out 1 thousand million instructions per second. The Clock on a modern desktop runs extremely quickly, typically 3 thousand million times a second (36Hz). Its hard to imagine how fast this is. But it does mean that the CPU running at this clock speed can handle a huge amount of data in a very short time. The speed of the clock determines the basic performance of the CPU - the faster it goes the more powerful the computer. Clock Speed Higher - faster performance but runs hotter and consumes more power Clock Speed Lower - lower performance, less costly, needs less power - good for battery life in laptops Over Clocking - some people try to get the most extreme performance out of their CPU. They do this by over clocking, this means that they adjust the clock to run faster than the CPU was designed for, this makes the CPU hotter and so extra cooling are needed

Registers Registers are temporary storage locations of fixed size providing the computer system with additional storage locations that offer the advantage of faster speed. Registers offer high speed because the CPU does not have to wait for data or instructions to be retrieved from the hard disk or main memory (which takes some time). Registers store data in machine code or binary numbers.

Daniela Attard

Page 3

There are two types of registers: general-purpose registers, and special-purpose registers. General purpose registers that can store any data, i.e they have no specific task. Special purpose registers are registers which store specific data, such as the Accumulator which always stores the result of the ALU. Special-purpose registers are used by the ALU or the CU. These registers are refreshed after an instruction is executed.

Arithmetic Logic Unit (ALU) The ALU is responsible for the actual processing of data. It is capable of performing arithmetic operations ( + X /), comparison operations ( =, <,>,<=,>=,<>) and logical operations (NOT, AND,OR). The ALU is made up from a group of registers (a register is a fast storage location in which the data being operated upon is temporary held). Two important registers in the ALU are:

Accumulator Shift Register

The Accumulator: is used to accumulate (hold) results of calculations temporarily before being put out to the computerâ&#x20AC;&#x2122;s memory. Shift Register: capable of shifting its contents one or more positions to the right or to the left in order to carry out an arithmetic operation. Shift right: division by 2 Shift left: multiplication by 2

The ALU is also connected to the data and control bus.

Control Unit The control unit coordinates and supervises the activities performed by the memory unit, the ALU and the peripheral devices. Like the traffic police, the CONTROL decides which action will occur. For example, the CONTROL decides which electrical signal coming into the CPU will get through first, and which action by the CPU will continue next. Has 3 main jobs: 1. Controls and monitors the hardware attached to the system to make sure the given to it by the application software are used. 2. Controls the input and output of data so that signals go to the right place at the right time. 3. Controls the flow within the CPU - which is the fetch execute cycle.

Instruction Regis- commands

Program Counter

These tasks are achieved through the use of two important registers found in this unit: Instruction Register and Program Counter


Instruction Register (IR): stores a copy of the instruction that has been fetched from main memory and is being executed (obeyed).

Program Counter (PC): The program counter holds the address of the next instruction. After an instruction is fetched, the address of the program counter is automatically incremented to point to the memory address of the next instruction. The three buses in the system bus have links to the control unit. Daniela Attard

Page 4

Other Registers Memory Address Register (MAR) - This register is used to store the address of the memory location from which data will be read or to which data will be written. Memory Data Register (MDR) - This register is used to store the data read from or written to memory. All data transfers that occur from main memory to the processor go through this register

The instruction Set Every computer has what is called an instruction set. This means the set of instructions that the CPU can understand and hence perform. No matter what computer is used, all the instructions have a unique (different) code. Therefore, if we look at an 8-bit computer we may see something along the following lines. Memory Address (hex)

Memory Contents (binary)













The set of binary digits in each memory location represent the machine code for several instructions like ADD, LOAD etc. For example: 11100011 â&#x20AC;&#x201D;>This binary code might mean LOAD the accumulator with the contents of the next memory location. Although the computer can be programmed in this way, it is not very convenient. It would be vey difficult to find errors in the program with all the 1s and os. To get over this problem we are able to use mnemonics such as ADD, LOAD etc. directly. Programming in terms of these mnemonics is called assembly language programming. It is easier to understand and to correct any errors.

Opcodes and Operands One machine code instruction and its equivalent mnemonic is shown below: 0001 ADD

Add contents of Memory Location to Accumulator

Suppose we want to store the instruction in mnemonic form ADD 3, to its machine code equivalent in an 8-bit register, then it will look as follows: Means ADD Means 3 in binary 0




OPCODE 0 0 0 Daniela Attard









8â&#x20AC;&#x201C; Bit Register

Page 5

OPCODE (Operation Code) Specifies which operation is to be performed (which action to do). In our example, the opcode (0001) refers to the operation Add contents of Memory location to Accumulator. If the length of the OPCODE portion was 8 bits, then 256 (28) different instructions could be represented.

OPERAND The operand refers to the value on which the opcode should operate. In our case it refers to the contents of Memory location 3 (0011)

Fetch Execute Cycle When dealing with the control unit we have mentioned that one of its main task is to carry out the instructions which are stored in the main memory. But how is this done? A program in memory is obeyed through the repetitive process of fetching an instruction from main memory unit, decide what to do (by decoding the instruction) and then carry out any action which might be needed—called the execution of the instruction. It is the sole task of the microprocessor inside the computer to carry out the fetch-decode-execute cycle and over and over again operating on different instructions from memory. 1. Fetch The first step the CPU carries out is to fetch main memory then store them in their own internal temporary memory areas. These memory are called "registers". For this to happen the CPU makes use of vital hardware called the "Address Bus". The CPU places the address of the next item on the address bus. Data from this address moves from main memory to CPU by traveling along the "Data bus" 2. Decode The next step is for the CPU to make sense of the instruction it has just fetched. This is called DECODE. The CPU is designed to understand a specific set of commands which are called the "instruction set" of the CPU. Each make of CPU has a different instruction set. The CPU decodes the instructions and prepares various areas within the chip in readiness of the next step. 3. Execute The part of the cycle where data processing actually takes place. The instruction is carried out upon the data (executed). The result of this is processing is stored in yet another register. Once the execute stage is complete, the CPU sets itself up again to begin another cycle once more. Putting it in steps: A. Set value of the PROGRAM COUNTER to the address of the 1st instruction. B. Fetch the instruction from the location specified by the PROGRAM COUNTER. C. Store a copy of this instruction in the INSTRUCTION REGISTER. D. Increment the PROGRAM COUNTER by 1. E. EXECUTE the instruction meaning: Fetch any data required by the instruction from main memory. Place it in storage location within the ALU called DATA REGISTERS.  Activate the correct circuits for the instruction to be carried out. Move any results from the data registers back to main memory.

F. GO TO step B. (Step 1 is only done the first time a program starts) Daniela Attard

Page 6

Block Diagram of the CPU ALU Accumulator Shift Register

Control Unit Instruction Register

Input Unit

Program Counter

Output Unit

Main Memory Unit Read Only Memory Random Access Memory

Data Bus

Secondary Storage

Control Bus

Address Bus

Daniela Attard

Page 7

Computer Architecture Notes  

Notes of Computer Architecture

Read more
Read more
Similar to
Popular now
Just for you