Lec 8 alu_cu

17
Ashis Talukder, MIS, DU. 1 Lecture 8 The Processor and Its Component

Transcript of Lec 8 alu_cu

Page 1: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 1

Lecture 8

The Processor and Its Component

Page 2: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 2

The CPU The brain. Performs all major calculations. Controls and manages the operations of other

components of the computer. Determines much of the performance of the

computer. The two basic components of the CPU are:

The Control Unit (CU). The Arithmetic Logic Unit (ALU).

Page 3: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 3

The CPU

Page 4: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 4

The CPU Fetches instruction from

main memory.

Decodes instruction to determine which action is required to be done.

Based on instruction, fetches data from memory or I/O.

Execution of instruction.

Stores Result

Start

Fetch Instruction

Decode Instruction

Fetch Operand

Execute Instruction

Store Result

More instructio

n?

Y

NEnd

Page 5: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 5

The CPUStart

Fetch Instruction

Decode Instruction

Fetch Operand

Execute Instruction

Store Result

More instructio

n?

Y

NEnd

Page 6: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 6

The Control Unit It selects and interprets program instructions

and then sees that they are executed. Contains:

Special purpose registers. instruction register (IR) program control register (PCR).

A decoder to perform various activities. IR holds the current instruction to be executed. PCR holds the address of the next instruction to

be executed.

Page 7: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 7

The Control Unit The decoder has necessary circuitry to

interpret the meaning of every instruction supported by the CPU.

Each instruction is determined by microcode – which tell the CPU how to execute the instruction.

CU does no processing by itself. It coordinates the entire computer system

including I/O units.

Page 8: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 8

The Control Unit Basic task – summary:

Obtain instructions from program stored in memory.

Interpret/decode those instructions. Issue signals. The signals cause other units of the system to do

their tasks.

Page 9: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 9

The ALU Actual data processing takes place here. CU hands control over to the ALU when it

encounters instructions such as add, divide etc. Contains:

Special purpose registers. Circuitry to perform arithmetic & logic operations

such as adder. Example: CU might load 2 numbers into the

ALU registers and then tell the ALU to add them.

Page 10: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 10

Instruction Set A set of machine instructions supported by the

processor such as add, compare etc. Each different processor has different

instruction set. So machine language programs for one processor will not execute in another processor.

When a manufacturer develops a CPU, they try to maintain upward compatibility.

Page 11: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 11

Registers Temporary storage of data. Not a part of main

memory. CPU always puts data from RAM to internal

register before it processes that data Most CPU registers of today are of 32 or 64 bits.

Known as word size. The bigger the word size the faster the CPU can

process data.

Page 12: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 12

Registers Number of registers vary from computer to

computer. Some are common to all computers:

Memory buffer register (MBR) Temporary storage for memory contents. Instructions are transferred to IR. Data are accessible to the ALU registers and can also be

sent to I/O registers. Data needed to be written in memory is placed here

first.

Page 13: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 13

Registers Memory address register (MAR)

Holds address of active memory location. Loaded from PCR.

Accumulator register (A) Holds data and result after processing. Mostly used. Result that is to be written in memory is

transferred from here to MBR.

Page 14: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 14

Registers Program control register (PCR)

Holds memory address of next instruction to be executed.

Instruction register (IR) Holds current instruction to be executed. The operation part is sent to CU. Address is part sent to MAR.

I/O register (I/O) Used to talk to I/O devices. Data & instruction from/to I/O devices are first put

in this register.

Page 15: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 15

Processor Speed Operations of ALU and CU are synchronized by

an internal clock called system clock.

Generates electrical pulses.

Several clock cycles are needed to execute a single instruction. (fetch, decode, execute).

Measured in megahertz. MHz and now-a-days GHz.

Page 16: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 16

Types of Processor CISC (complex instruction set computer)

Supports a large number of instructions. Makes it easier to translate high level languages. Adds more circuitry and complexity to the overall

design of the CPU. Supports variable length instructions. Supports various addressing modes. Expensive. Makes the job of machine level programmer easier. Most processors of today are CISC. Intel’s Pentium.

Page 17: Lec 8 alu_cu

Ashis Talukder, MIS, DU. 17

Types of Processor RISC (reduced instruction set computers)

Low design complexity. Supports few number of instructions. Complex instructions are performed by the basic

instructions. E.g. multiplication is performed by repeated addition.

Fixed length instructions. Supports small number of addressing modes. Puts extra burden on machine language

programmers. Less expensive. Faster for most applications. Motorola’s processors.