Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
docu...
CPU AND ITS EXECUTION OF
INSTRUCTION
Jaseena A P
jsnp65@gmail.com
www.facebook.com/Jaseena
Muhammed A P
twitter.com/userna...
WHAT IS CPU?
 Central Processing Unit
 Brain of every computer
Two main components:
- ALU
- Control unit
COMPONENTS OF CPU
 ALU
-Arithmetic and Logical Unit
-Performs all arithmetic and logical operations.
Control Unit
- Extr...
REGISTERS
 Registers are temporary memory units that
store words.
 The registers are located in the processor, instead o...
Program Counter: Stores the address of the macro
instruction currently being executed.
Accumulator: Stores a previously ...
REGISTERS(CONTD..)
Address Mask: When the CPU needs to know the
address of a target word that an instruction is using,
th...
REGISTERS(CONTD….)
 Process status register:
This register contains the various information about
the cpu.
 Data registe...
REGISTERS(CONTD…)
 MDR(Memory data register)
-It is the register that contains the data to be
stored in the computer stor...
HOW CPU COMMUNICATES?
 Pathway that interconnect CPU to all the other
components on the motherboard
Two types:
-Internal
-External
 The lines...
Address - the components pass memory addresses
to one another over the address bus.
Control - used to send out signals t...
INSTRUCTION
 Single operation of a processor defined by
the processor instruction set.
 An instruction has two component...
INSTRUCTION TYPES
 Instructions can be divided into six groups:
-Data transfer
eg: MOV, LOAD
-Arithmetic
eg: ADD, SUB, DI...
Program control can be divided into:
-Unconditional Branch
eg:JMP NEXT % Jump to the label NEXT
-Conditional Branch
eg: J...
INSTRUCTION CYCLE
1. Load the address of next instruction in the PC into the
MAR.
So that the control unit can fetch the instruction from th...
2.DECODE
1. Contents of IR split into operation code and address
if present e.g. store, add or jump instructions.
2. Decod...
3.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 a store instruction then:
Copy address part of the instruction (to store in) in the IR into
MAR.
C...
• If the instruction is an output (from memory)
instruction then:
Copy address part of part of the instruction (of data to...
4.STORE THE OUTPUT
Result of calculations in cpu stored in main memory
or sent to output devices.
Program Counter could ...
AN EXAMPLE
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.co...
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, N...
CPU and its execution of instruction
CPU and its execution of instruction
Upcoming SlideShare
Loading in …5
×

CPU and its execution of instruction

445 views

Published on

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

No Downloads
Views
Total views
445
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
17
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

CPU and its execution of instruction

  1. 1. 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
  2. 2. CPU AND ITS EXECUTION OF INSTRUCTION Jaseena A P jsnp65@gmail.com www.facebook.com/Jaseena Muhammed A P twitter.com/username in.linkedin.com/in/profilena me 9539443588
  3. 3. WHAT IS CPU?  Central Processing Unit  Brain of every computer Two main components: - ALU - Control unit
  4. 4. COMPONENTS OF CPU  ALU -Arithmetic and Logical Unit -Performs all arithmetic and logical operations. Control Unit - Extracts instruction from memory, decodes and executes them - Calls ALU whenever necessary.
  5. 5. REGISTERS  Registers are temporary memory units that store words.  The registers are located in the processor, instead of in RAM. Some registers are PC, AC, IR, Index register, AMASK, MAR, and MDR, General purpose register, Data register and Process status register.
  6. 6. Program Counter: Stores the address of the macro instruction currently being executed. Accumulator: Stores a previously calculated value or a value loaded from the main memory. Instruction Register: Stores a copy of the instruction loaded from main memory (Instruction being executed currently). REGISTERS(CONTD..)
  7. 7. REGISTERS(CONTD..) Address Mask: When the CPU needs to know the address of a target word that an instruction is using, the AMASK is AND'ed with the instruction to eliminate the opcode, leaving only the desired address.  Memory Address Register: This register contains the address of the place the CPU wants to work with in the main memory. It is directly connected to the RAM chips on the motherboard.
  8. 8. REGISTERS(CONTD….)  Process status register: This register contains the various information about the cpu.  Data register: A register used in microcomputers to temporarily store data being transmitted to or from a peripheral device.  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
  9. 9. REGISTERS(CONTD…)  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.
  10. 10. HOW CPU COMMUNICATES?
  11. 11.  Pathway that interconnect CPU to all the other components on the motherboard Two types: -Internal -External  The lines or pins of a bus are of three types: -Data -Address -Control SYSTEM BUS
  12. 12. Address - the components pass memory addresses to one another over the address bus. Control - used to send out signals to coordinate and manage the activities of the motherboard components. Data - transferred between peripherals, memory and the CPU. Obviously, the data bus can be a very busy pathway. SYSTEM BUS(CONTD..)
  13. 13. INSTRUCTION  Single operation of a processor defined by the processor instruction set.  An instruction has two components: opcode operand Eg: ADD Ro 100
  14. 14. INSTRUCTION TYPES  Instructions can be divided into six groups: -Data transfer eg: MOV, LOAD -Arithmetic eg: ADD, SUB, DIV -Logical eg: AND, OR, NOT -System-control eg: STOP -I/O eg: IN and OUT -Program Control
  15. 15. Program control can be divided into: -Unconditional Branch eg:JMP NEXT % Jump to the label NEXT -Conditional Branch eg: JZ LABEL % jump to label if current value in AC is ZERO -Subroutine call eg: CALL SUB -Interrupt handling eg:TRAP INSTRUCTION TYPES
  16. 16. INSTRUCTION CYCLE
  17. 17. 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. 1.FETCH
  18. 18. 2.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
  19. 19. 3.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
  20. 20. • 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 arithmetic then: Copy address part of the instruction (of number to perform arithmetic operation) in the IR into MAR. Copy number from memory address held in MAR into MDR. Perform operation to number in accumulator (accumulator will now hold the result). EXECUTE(CONTD..)
  21. 21. • 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. EXECUTE(CONTD…)
  22. 22. 4.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
  23. 23. AN EXAMPLE
  24. 24. 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
  25. 25. 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

×