Cpu & its execution of instruction

4,257 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
4,257
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
92
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Cpu & its execution of instruction

  1. 1. CPU & ITS EXECUTION OF INSTRUCTION Rajishma T rajishmatnair@gmail.com www.facebook.com/ Rajishma T Nair twitter.com/username in.linkedin.com/in/profilena me 9020217968
  2. 2. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  3. 3. CPU • Cpu or central processing unit is the brain of every computer. • Structure of a cpu:
  4. 4. • ALU – The arithmatic/logic unit contains electronic circuitry that executes all arithmatic and logical operations. • CONTROL UNIT – The control unit of the CPU contains cicuitry 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.
  5. 5. 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.
  6. 6. Registers • General purpose registers: – A general purpose register is a memory cell. – Each general purpose register has a unique name – 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..
  7. 7. • 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 regster is used to access data and instructions from memory during the execution of an instruction.
  8. 8. • 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.
  9. 9. • 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.
  10. 10. • 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
  11. 11. Types of instruction • Cpu executes following 3 types of instructions • Arithmatic and logic operation • Eg: +,-,and,or • The result of an arithmatic operation is often stored in general purpose registers. • Memory transfer instruction • Transfer the content from some specific memory location to a specific register(memory cell) in the cpu and vice versa
  12. 12. • 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.
  13. 13. Instruction execution cycle • Fetch the instruction • Decode the instruction • Execute the instruction • Store the instruction
  14. 14. 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.
  15. 15. 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
  16. 16. 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
  17. 17. • Execute contd • If the instruction is a store instruction then: – Copy address part of the instruction (to store in) in the IR into MAR. – Copy data in accumulator to MDR. – Copy data in MDR into memory address held in MAR. • If the instruction is an add instruction then: – Copy address part of the instruction (of number to add) in the IR into MAR. – Copy number from memory address held in MAR into MDR. – Add number in MDR to number in accumulator (accumulator will now hold the result).
  18. 18. • If the instruction is an output (from memory) instruction then: – Copy address part of part of the instruction (of data to output) in IR into MAR. – Output contents of MDR.
  19. 19. 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
  20. 20. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  21. 21. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com

×