cpu and its execution statements

20

Upload: baabtracom-no-1-supplier-of-quality-freshers

Post on 12-Jul-2015

157 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Cpu and its execution statements
Page 2: Cpu and its execution statements

CPU and its execution of instructions

DHEERAJA PREMDAS

[email protected]

Dheeraja Premdas

LinkedIn Profile

Page 3: Cpu and its execution statements

CPU

• Cup or central processing unit is the brain of every computer.

• Structure of a cpu:

Page 4: Cpu and its execution statements

• ALU-The arithmetic/logic unit contains electronic circuitry that

executes all arithmetic and logical operations

• CONTROL UNIT-The control unit of the CPU contains circuitry that uses electrical signals to direct the entire computer system to carry out, or execute, stored program instructions.

– The control unit must communicate with both the

arithmetic/logic unit and memory.

Page 5: Cpu and its execution statements

System bus• Control bus

-The control bus is used by the CPU to direct and monitor the actions of the other functional areas of the computer

• Address bus

-The address bus consists of all the signals necessary to define any of the possible memory address locations within the computer

-The control bus is used by the CPU to direct and monitor the actions of the other functional areas of the computer.

• Data Bus

- The bidirectional data bus, sometimes called the memory bus, handles the transfer of all data and instructions between functional areas of the computer.

Page 6: Cpu and its execution statements

Registers

• General purpose registers:

– A general purpose register is a memory cell.

– Each general purpose register has a unique

– It is used to store intermediate result of complex computation

• Accumulator :

– This Register is used for storing the Results those are produced by the System..

Page 7: Cpu and its execution statements

• Instruction register:

– Instruction register Contains the current instruction being executed by the CPU. – The CPU will perform the operation indicated by the instruction code contained in the instruction register.

• MAR(memory address register):

– This register holds the memory addresses of data and instructions.

– This register is used to access data and instructions from memory during the execution of an instruction.

Page 8: Cpu and its execution statements

• MDR(Memory data register):

- It is the register that contains the data to be stored in the computer storage or data after a fetch from the computer storage. – It acts like a buffer and holds anything that is copied from the memory ready for the processor to use it,

• Index register:

– A hardware element which holds a number that can be added to (or, in some cases, subtracted from) the address portion of a computer instruction to form an effective address.

– An index register in a computer's CPU is a processor register used for modifying operand addresses during the run of a program.

Page 9: Cpu and its execution statements

Data register:

– A register used in microcomputers to temporarily store data being transmitted to or from a peripheral device

• Program counter:

– This register contains the address of the next instruction

– The value in the program counter will be increased after the cpu finishes executing one instruction.

Page 10: Cpu and its execution statements

• Process status register:

• – This register contains the various information about the cpu.

• – For ex: the result of a comparison operation.

• – When the CPU compares 2 numbers a and b the outcome of the comparison is stored in the PSR The outcome of a compare operation will allow the CPU to determine the following fact between a and b

• Equal

• Not equal

• Greater than

• Greater than or equal

• Less than

• Less than or equal

Page 11: Cpu and its execution statements

Types of instruction

Cpu executes following 3 types of instructions

1. Arithmatic and logic operation • Eg: +,-,and,or

• The result of an arithmatic operation is often stored in general purposeregisters.

• Memory transfer instruction

• Transfer the content from some specific memory location to a specificregister(memory cell) in the cpu and vice versa

Page 12: Cpu and its execution statements

2.Branch instructions

• – A branch instruction will cause the cpu to branch or jump to the

specified location in memory.

• – after the jump has occurred the cpu will continue to execute the instructions in sequence until another branch or jump instruction is encountered

• – There are two types of branch instructions:

• A unconditional branch instruction always cause the cpu to jump to the target location.

• A conditional branch instruction will only cause the cpu to jump to the target location when the specified condition is met.

Page 13: Cpu and its execution statements

Instruction execution cycle

• Fetch the instruction

• Decode the instruction

• Execute the instruction

• Store the instruction

Page 14: Cpu and its execution statements

Fetch

• 1. Load the address of next instruction in the PC into the MAR.

– So that the control unit can fetch the instruction from the right part of the memory.

2. Copy the instruction/data that is in the memory address given by the MAR into the MDR.

– MDR is used whenever anything is to go from the CPU to main memory, or vice versa.

3. Increment the PC by 1.

– So that it contains the address of the next instruction, assuming that the instructions are in consecutive locations.

4. Load the instruction/data that is now in the MDR into the IR. –

Thus the next instruction is copied from memory -> MDR -> IR.

Page 15: Cpu and its execution statements

Decode

• 1. Contents of IR split into operation code and address if present e.g. store, add or jump instructions.

• 2. Decode the instruction that is in the IR

Page 16: Cpu and its execution statements

Execute

• If the instruction is a jump instruction then

– Load the address part of the instruction in the IR into the PC.

• If the instruction is an input / load (directly) instruction then take data input and place in accumulator.

• If the instruction is a load (from memory) instruction.

– Copy address part of the instruction (to load from) in the IR into MAR.

– Copy data from memory address held in MAR to MDR. – Copy data in MDR into accumulator

Page 17: Cpu and its execution statements

Store the output

• Result of calculations in cpu stored in main memory or sent to output devices.

• program Counter could be updated to a new address

Page 18: Cpu and its execution statements

Want to learn more about programming or Looking to become a good programmer?

Are you wasting time on searching so many contents online?

Do you want to learn things quickly?

Tired of spending huge amount of money to become a Software professional?

Do an online course @ baabtra.com

We put industry standards to practice. Our structured, activity based courses are so designedto make a quick, good software professional out of anybody who holds a passion for coding.

Page 19: Cpu and its execution statements

Follow us @ twitter.com/baabtra

Like us @ facebook.com/baabtra

Subscribe to us @ youtube.com/baabtra

Become a follower @ slideshare.net/BaabtraMentoringPartner

Connect to us @ in.linkedin.com/in/baabtra

Give a feedback @ massbaab.com/baabtra

Thanks in advance

www.baabtra.com | www.massbaab.com |www.baabte.com

Page 20: Cpu and its execution statements

Emarald Mall (Big Bazar Building)Mavoor Road, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550

NC Complex, Near Bus StandMukkam, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550

Cafit Square,Hilite Business Park,Near Pantheerankavu,Kozhikode

Start up VillageEranakulam,Kerala, India.

Email: [email protected]

Contact Us