Pages

Saturday 15 December 2012

a LIL bit about MIPS by Zulhaizam Zafrie

SPIM - the MIPS simulator

a)  Membaca fails MIPS assembly language dan translates fails tersebut kepada machine language.
b) Executes the machine language instructions.
c) Menunjukkan kandungan  registers dan memory.
d) Berfungsi sebagai debugger.


Arithmetic Operations

a) Tambah dan tolak, 3 operan.
    -2 sumber (sources) dan 1 destinasi (destination)
        
                               add a, b, c
 






C code:
          a = b + c + d + e;
MIPS code:
          add a, b, c # hasil tambah b dan c dimasukkan ke dalam a
          add a, a, d # hasil tambah b,c dan d dimasukkan ke dalam a
         add a, a, e # hasil tambah b,c,d dan e dimasukkan ke dalam a






C code:
          f = (g + h) - (i + j);
MIPS code:
          add t0, g, h # temp t0 = g + h
          add t1, i, j # temp t1 = i + j
         sub f, t0, t1 # f = t0 - t1




Register Operations

a) Nama untuk assembler.
    - $t0, $t1, ..., $t9  -->  nilai 'temporary'
    - $s0, $s1, ..., $s7  -->  'variables'








Memory Operands

a) Memori yang digunakan untuk data komposit (composite data).
-Arrays, structures, dynamic data
b) Untuk menggunakan arithmetic operations
-Load values from memory into registers
-Store results from register to memory
c) Memory is byte adressed
-Setiap 'adress' mengenalpasti 8-bit byte
d) Adress perlu berada dalam kiraan gandaan 4 (multiple of 4)
_________________________________________________________________________________






Immediate Operands

a) Data pemalar (constant) yang dinyatakan dalam instruction.
   x = y + 4
   addi $s3, $s3, 4

b) Walaubagaimanapun, tiada operasi tolak dalam immediate operands.
    ~ just use -ve constant
       x = y - 1
       addi $s2, $s1, -1






---------------Zulhaizam Zafrie--------------
---------------TEKANsiniTEKAN--------------


















Muted Professor

No comments:

Post a Comment