1 / 11

Overview

Overview. The Operate Instructions - ADD, AND, NOT The Data Movement Instructions - Load, Load Address, Store Example Using Operate & Data Movement The Control instructions - BR, JMP, TRAP. Example. Opcode. Branch Instruction. BR [0000 nzp PCoffset9]

Télécharger la présentation

Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Overview The Operate Instructions - ADD, AND, NOT The Data Movement Instructions - Load, Load Address, Store Example Using Operate & Data Movement The Control instructions - BR, JMP, TRAP

  2. Example Opcode

  3. Branch Instruction BR [0000 nzp PCoffset9] • Branch specifies one or more condition codes • If the set bit is specified, the branch is taken: • PC is set to the address specified in the instruction • Target address is made by adding SEXT(IR[8:0]) to the PC • If the branch is not taken: - the next sequential instruction (PC) is executed.

  4. BR ///////////// ///// + SEXT

  5. Jump Instruction JMP BaseR [1100 000 BaseR 000000] • Jump is an unconditional branch -- always taken. • Base • Address is contents of the register • Allows any target address.

  6. TRAP • Calls a service routine, identified by 8-bit “trap vector.” • When routine is done, PC is set to the instruction following TRAP.

  7. LC-3 Memory Map

  8. TRAPS

  9. Using Branch Instructions • Compute sum of 12 integers.Numbers start at location x3100. Program starts at location x3000. R1  x3100R3  0R2  12 R2=0? R4  M[R1]R3  R3+R4R1  R1+1 R2  R2-1 NO YES

  10. Sample Program

  11. clear R2 add R4 to R2 decrement R5 R5 = 0? No Yes HALT Example 1: Multiply • This program multiplies two unsigned integers in R4 and R5. x3200 0101010010100000 x3201 0001010010000100 x3202 0001101101111111 x3203 0000011111111101 x3204 1111000000100101 R2 <- 0 R2 <- R2 + R4 R5 <- R5 – 1 BRzp x3201 HALT

More Related