























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
























Haonan Wang
Reference: CMPE 140, Hyeran Jeon CMPE 140, Donald Hung
A Brief Review
2
Arithmetic operations add, sub, mult, div, … Logical operations shift, and, or, xor, … Conditional operations jump, branch on condition, …
Data load operations move, load data, …
Data store operations move, store data, …
About MIPS Assembly
MIPS Processor Organization
5
Memory
CPU
$ ... $
Integer Registers
Arithmetic Unit
Multiply Divide
Lo Hi (^) Coprocessor 1 (FPU)
$ ...
$
Floating -point
Arithmetic Unit
Coprocessor 0 (Traps and Memory)
VAddr Cause Status EPC
32 bit 32~64bit
Our Focus
Registers
MIPS Data Sizes
7
Your Thoughts
8
When storing a series of bytes data in the
memory, how it can be uniquely identified
and therefore retrievable?
Endian-ness
larger unit (word, long, etc.)
The longword value:
Big-Endian Little-Endian
0 x 1 2 3 4 5 6 7 8 can be stored differently
78
0x
56
0x01 34 0x
12
0x03 12
0x
34
0x01 56 0x
78
0x
10
Memory Characteristics & Assumptions
among the bytes in the data
to bottom
11
0x 0x
Logical Word-Oriented View
Memory Organization Example 2
Example: If the memory layout in MIPS is given like below
The half-word value in address
0x0000 is ( )
0x0001 is ( )
0x0002 is ( )
The word value in address
0x0002 is ( )
0x0004 is ( )
13
0x 0x
Logical Word-Oriented View
0xF33B Incorrect addressing 0x7C
Incorrect addressing 0x8E
Tips to Remember Endianness
14
Looks normal (same as writing order) when address is from low to high
Looks strange here But same as writing order when address is from high to low
word value:
Little-Endian
0 x 1 2 3 4 5 6 7 8
78
0x
56
0x02 34 0x
12
0x00 12
0x
34
0x01 56 0x
78
0x
0x
Logical Word-Oriented View
Basic Instruction Formats
add $4, $3, $2 # $4 = $3 + $
16
Register File
If $2 and $3 have integer values 3 and 2 each,
R-Type Instructions
17
Instructions Using Immediate Value
addi Rt, Rs, imm # Rt = Rs + imm
19
Command (operation)
Destination Register (stores calculation result)
Source Register (stores operand value)
Immediate operand (stores immediate operand value)
Instructions Using Immediate Value
addi $4, $3, 1 # $4 = $3 + 1
20
Register File
If $3 has integer value 2,