Central Processing Unit 35 Conditional Branch Instruction BZ Branch if zero Z 1

Central processing unit 35 conditional branch

This preview shows page 35 - 41 out of 46 pages.

Central Processing Unit 35 Conditional Branch Instruction BZ Branch if zero Z = 1 BNZ Branch if not zero Z = 0 BC Branch if carry C = 1 BNC Branch if no carry C = 0 BP Branch if plus S = 0 BM Branch if minus S = 1 BV Branch if overflow V = 1 BNV Branch if no overflow V = 0 BHI Branch if higher A > B BHE Branch if higher or equal A B BLO Branch if lower A < B BLOE Branch if lower or equal A B BE Branch if equal A = B BNE Branch if not equal A B BGT Branch if greater than A > B BGE Branch if greater or equal A B BLT Branch if less than A < B BLE Branch if less or equal A B BE Branch if equal A = B BNE Branch if not equal A B Unsigned compare conditions (A - B) Signed compare conditions (A - B) Mnemonic Branch condition Tested condition
Image of page 35

Subscribe to view the full document.

Central Processing Unit 36 Subroutine Call and Return Call subroutine Jump to subroutine Branch to subroutine Branch and save return address First Location in the subroutine (Memory) Fixed Location in memory In a processor Register In memory stack - most efficient way Subroutine Call Instructions are executed by performing two operations : (1). Save PC as Return Address to get the address of the location in the Calling Program upon exit from the Subroutine (2). Branch to the beginning of the Subroutine - Same as the Branch or Conditional Branch Locations for storing Return Address CALL SP SP - 1 M[SP] PC PC EA RTN PC M[SP] SP SP + 1 Subroutine : self contained sequence of instructions that performs a given computation task
Image of page 36
Central Processing Unit 37 Interrupt Procedure Program Interrupt refers to the transfer of program control from a currently running program to another service program as a result of an external or internal generated request
Image of page 37

Subscribe to view the full document.

Central Processing Unit 38 Interrupt Procedure - The interrupt is usually initiated by an internal or an external signal rather than from the execution of an instruction (except for the software interrupt) - The address of the interrupt service program is determined by the hardware rather than from the address field of an instruction - An interrupt procedure usually stores all the information necessary to define the state of CPU rather than storing only the PC. The state of the CPU is determined from: Content of the PC Content of all processor registers Content of status bits Many ways of saving the CPU state depending on the CPU architectures Interrupt Procedure and Subroutine Call
Image of page 38
Central Processing Unit 39 Interrupt Procedure - CPU does not respond to interrupt until end of instruction cycle, checks just before next fetch phase - If interrupt pending, control passed to h/w interrupt cycle: - Content of PC and PSW is pushed into stack - branch address of interrupt transferred to PC and new PSW loaded into status registers - Service Program executed starting from branch address and status of CPU as specified by new PSW - Last instruction from service program is return from interrupt instruction
Image of page 39

Subscribe to view the full document.

Central Processing Unit 40 Program Interrupt Types of Interrupts
Image of page 40
Image of page 41
  • Fall '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes