1 / 16

Decoding MIPS Assembly

Decoding MIPS Assembly. MIPS Memory. MIPS 32 and 64 bit versions 32 bits for Data width Instruction size Address space 2 32 ~ 4 billion addresses. MIPS Memory. 2 32 ~ 4 billion addresses Assigned to bytes 32 bits : 4 GB addressable memory. OS & Memory.

yaphet
Télécharger la présentation

Decoding MIPS Assembly

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. Decoding MIPS Assembly

  2. MIPS Memory • MIPS • 32 and 64 bit versions • 32 bits for • Data width • Instruction size • Address space • 232 ~ 4 billion addresses

  3. MIPS Memory • 232 ~ 4 billion addresses • Assigned to bytes • 32 bits : 4 GB addressable memory

  4. OS & Memory • OS generallyreserves memory fordevices andcritical OS code

  5. MIPS Memory • MIPS takes top half of space • Program space • 0x00000000-0x7FFFFFFF • ~2GB

  6. MIPS Memory • Text : code • Data : • Static : allocated by assembler • Dynamic : allocated by OSat run time (heap) • Stack : local variable storage • Managed by compiler

  7. Memory Units byte — eight bits. word — four bytes, 32 bits double word — eight bytes, 64 bits • Addresses in bytes, instructions/data often words

  8. Dissection • A simple program: • #XXX Comment • .XXX Assembler directive • XXX: Label

  9. Directives • Common directives: • .text # the succeeding lines contain instructions • .data # the succeeding lines contain data • .globl name # name is global symbol (visible to code in other files) • .asciiz# store a null terminated string

  10. Labels • Label : human readable alias for location in code • Can be on same line or line before named code • Assembler replaces label with named thing/address:

  11. Main • Global main tells OS whereto start • MARS doesn't need • Well behaved program should also tell OS when it is done… later

  12. An Instruction • Instructions combine registers or literal valuesput results in registers

  13. Instruction • Registers • Can use register #or memnonic • Don't use 0 or 1!!!

  14. Instruction • An instruction:

  15. Standardized Format • Op Operation code • RsFirst source register operand • RtSecond source register operand • Rd Destination register operand • ShamtShift amount - used in shift instructions • FunctSelect the variant of the operation in the op code field

  16. Instruction • An instruction:

More Related