The MIPS Processor Computer Organization The MIPS Processor Appendix A.

10
The MIPS Processor Computer Organization The MIPS Processor Appendix A

Transcript of The MIPS Processor Computer Organization The MIPS Processor Appendix A.

Page 1: The MIPS Processor Computer Organization The MIPS Processor Appendix A.

The MIPS Processor Computer Organization

The MIPS Processor

Appendix A

Page 2: The MIPS Processor Computer Organization The MIPS Processor Appendix A.

The MIPS Processor Computer Organization

Assembly Language

Symbolic representation of a computer's machine language. more readable than machine language each processor has its own assembly language no two assembly languages are the same.

Page 3: The MIPS Processor Computer Organization The MIPS Processor Appendix A.

The MIPS Processor Computer Organization

Why Use Assembly Language

Primary reason: for speed or size of a critical application

compiler may not produce the best instructions have better control over which instructions are used

Example: embedded systems or devices

Page 4: The MIPS Processor Computer Organization The MIPS Processor Appendix A.

The MIPS Processor Computer Organization

Drawbacks of Assembly Language

Are not widely used by everyday programmers programs are machine dependent programs are longer than those in a high-level language programs have no structure; hard to read

Page 5: The MIPS Processor Computer Organization The MIPS Processor Appendix A.

The MIPS Processor Computer Organization

The Assembler

Translates assembly language instructions into machine language instructions

Page 6: The MIPS Processor Computer Organization The MIPS Processor Appendix A.

The MIPS Processor Computer Organization

Translation

Symbols can be used before they are defined. A two step translation is required:

resolve labels (find memory locations) translate assembly instructions

Page 7: The MIPS Processor Computer Organization The MIPS Processor Appendix A.

The MIPS Processor Computer Organization

Sample Program # # Prints all primes in the numbers 1 - 100 # .text

main:

li $t0, 1 WHILE: bgt $t0, 100, WHILE_END

move $a0, $t0 jal TEST_PRIME beqz $v0, INC1

la $a0, Message move $a1, $t0, jal PRINTF INC1: addi $t0, $t0, 1 j WHILE WHILE_END:

li $v0, 10 syscall

###################################

.data

Message: .asciiz "This number is prime: " NEWLINE: .asciiz "\n"

Page 8: The MIPS Processor Computer Organization The MIPS Processor Appendix A.

The MIPS Processor Computer Organization

Object File

object code - machine instructions, data, and bookkeeping info. can not be executed directly it may refer to routines in other object files

Six distinct sections on Unix systems:

Page 9: The MIPS Processor Computer Organization The MIPS Processor Appendix A.

The MIPS Processor Computer Organization

The Linker

linker - combines a collection of object files into an executable file. programs can be split into smaller pieces (files) each file contains logically related routines and data

Page 10: The MIPS Processor Computer Organization The MIPS Processor Appendix A.

The MIPS Processor Computer Organization

The Loader

loader - used to load a program into memory sets the registers initializes the program counter

For the MIPS processor: