Lesson 3. The Processor
Lesson Objective
- Explain the role and operation of the major components of the processor.
- Produce a diagram that illustrates the flow of data in a CPU and how all the components link together.
- Identify the processor components involved in the fetch decode execute cycle.
- Be able to explain the steps involved in completing the fetch decode execute cycle.
- Describe the stages and purpose of the Interrupt process.
Lesson Notes
The Processor
It is the brain of the computer. The processor is a device that carries out computation. The processor executes instructions and processes information.
What is it made of?
- A thin slice of silicon approximately 2cm square
- Contains millions of tiny transistors. The transistors control the flow of electrical pulses and are timed via the computer's clock.
- Microscopic wires called BUSES connect groups of transistors.
Internal Structure of Processor
Program Control Unit:
- Fetches and executes instructions from memory.
- Coordinates the activity of all other components.
- Control signals are sent along the control bus between the control unit and the other components of the computer.
Arithmetic and Logic Unit (ALU):
- Performs arithmetic and logical operations on data.
- Arithmetic: Addition, subtraction, fixed point calculations.
- Boolean Logic: AND, OR, XOR.
- Shift operations: Move bits to the left or right within a register.
Registers
Fast memory locations that are used to store data.
- General purpose registers: are available for the programmer to use to run programs if needed. Accessed using with instructions such as LOAD, STORE, ADD.
- Dedicated Registers: are assigned a specific role by the processor designer. Programmers have access to some by not all registers.
- Program Counter (PC): points to the next instruction to be executed or fetched.
- Status Register (SR): holds codes to indicate the outcome of an operation. It is used to set flags (e.g. carry or overflow) or to detect error conditions.
- Accumulator (ACC): holds the immediate result of the current set of calculations. Some processors have a single general purpose register called an Accumulator.
- Current Instruction Register (CIR): holds the current instruction to be executed. Which is split into Opcode and Operand.
- Memory Address Register (MAR): holds the address of the memory location currently being accessed.
- Memory Buffer Register (MBR): holds the data item being transferred to the memory location being used.
System Clock
- Comes from the system clock, controls the speed of the processor, so is connected directly to it.
The Fetch Decode Execute Cycle
- The processor works by using the "Fetch Decode Execute Cycle":
- Fetch: Retrieves instructions from memory.
- Decode: Interprets the instructions.
- Execute: Carries out the instructions.
- Repeat
- The CU issues control signals to other hardware components. It also ensures coordinated operations within the CPU.
Interrupts (A-Level ONLY)
An interrupt is a signal by a software program or a hardware device sent to the CPU.
A software interrupt occurs when an application program terminates or requests certain services from the operating system.
A hardware interrupt occurs , for example, when an I/O operation is complete or an error such as “Printer out of paper” occurs.
A test for interrupts is made at the end of each instruction cycle:
Execution is suspended and the contents of all registers are temporarily saved.
An interrupt service routine is called to deal with the interrupt.
Depending on the type of interrupt, a particular routine will be run in order to service it. Once the interrupt has been serviced, the original values of the registers are retrieved and the Fetch-Execute cycle resumes from the point that it left off.