Closed jimin-kiim closed 2 years ago
MIPS assembly language
f = (g+h) - (i+j)
add t0, g, h add t1, i, j sub f, t0, t1
MIPS assembly language
f = (g+h) - (i+j) f, g, h, i , j are assigned to the registers $s0, $s1, $s2, $s3, $s4
add $t0, $s1, $s2 add $t1, $s3, $s4 sub $s0, $t0, $t1
MIPS assembly language
incrementing : addi $t0, $t0, 4 moving : add $t0, $t1, $zero
fast locations for data
faster to access than memory
# of registers is determined by ISA
compilers must use registers for variables as much as possible
variables for operations are stored in register
each of 32 registers (in MIPS) has its conventional name and usage
large, single dimensional array that can contain billions of data elements
complex data(arrays, structures, dynamic data) and instructions are stored in memory
operating on memory data requires additional data transferring instructions (loads, stores)
practically most of the data must be in the main memory first and when we have to do some operations, then fetch the data from the memory to the registers. After the operation, put the result back to the memory.
words
MIPS assembly language
lw $t0, 32($s3) add $s1, $s2, $t0
running a program
op | rs | rt | rd | shamt | funct |
---|---|---|---|---|---|
6 bits | 5 bits | 5 bits | 5 bits | 5 bits | 6 bits |
op | rs | rt | constant or address |
---|---|---|---|
6 bits | 5 bits | 5 bits | 16 bits |
op | address |
---|---|
6 bits | 26 bits |