1 / 14

Computer Science 210 Computer Organization

Computer Science 210 Computer Organization. Machine Language Instructions: Data Movement. Data Movement. Move data from memory to a register (load - LD, LDR, LDI, LEA) Move data from a register to memory (store - ST, STR, STI).

Download Presentation

Computer Science 210 Computer Organization

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. Computer Science 210Computer Organization Machine Language Instructions: Data Movement

  2. Data Movement • Move data from memory to a register (load - LD, LDR, LDI, LEA) • Move data from a register to memory (store - ST, STR, STI) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Opcode Src or Address info Dst

  3. PC-Relative Mode • To compute the memory address: • Sign-extend the address info (9-bit twos comp) • Add the result to the incremented PC 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Opcode Src or Address info Dst

  4. PC-Relative: LD and ST 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 RDst M[PC + offset] 0 0 1 0 0 1 0 1 1 0 1 0 1 1 1 1 LD R2 x1AF 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 M[PC + offset]  RSrc 0 0 1 1 0 1 0 1 1 0 1 0 1 1 1 1 ST R2 x1AF The operation is executed after the PC has been incremented Address must be within +256 or -255 of the LD or ST instruction

  5. Data Path for LD

  6. Data Path for ST

  7. PC-Indirect Mode • To compute the memory address: • Sign-extend the address info (9-bit twos comp) • Add the result to the incremented PC • Use this address to locate another address in memory 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Opcode Src or Address info Dst

  8. PC-Indirect: LDI and STI 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 RDst M[M[PC + offset]] 1 0 1 0 0 1 1 1 1 1 0 0 1 1 0 0 LDI R3 x1CC 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 M[M[PC + offset]]  RSrc 1 0 1 1 0 1 1 1 1 1 0 0 1 1 0 0 STI R3 x1CC Contents at the address is another address, which can be anywhere in memory

  9. Data Path for LDI

  10. Base + Offset Mode • To compute the memory address: • Sign-extend the offset info (6-bit twos comp) • Add the result to contents of the base register 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Opcode Src or Base Offset Dst

  11. Base + Offset: LDR and STR 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 RDst M[base + offset] 0 1 1 0 0 0 1 0 1 0 0 1 1 1 0 1 LDR R1 R2 x1D 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 M[base + offset]  RSrc 0 1 1 1 0 0 1 0 1 0 1 0 1 1 1 1 STR R1 R2 x1D Address does not depend on the PC Offset must range from -32 to +31

  12. Data Path for LDR

  13. Load Effective Address (LEA) • Computes the address like PC-relative and just stores the result in the destination register • Memory is not accessed 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Opcode Src or Address info Dst

  14. Data Path for LEA

More Related