Professional Documents
Culture Documents
Instructions: Language
of the Computer
(Computer Organization: Chapter 2)
Yanyan Shen
Department of Computer Science
and Engineering
1
Fundamentals
3
Fundamentals
MIPS-32 ISA
Registers
p Instruction Categories
m Computational R0 - R31
m Load/Store
m Jump and Branch
m Floating Point
PC
m Memory Management HI
m Special LO
5
Fundamentals
6
Fundamentals
op rs rt td sa funct
9
Fundamentals
10
Fundamentals
35 19 8 2410
Byte Addresses
p Since 8-bit bytes are so useful, most architectures
address individual bytes in memory
m Alignment restriction - the memory address of
a word must be on natural word boundaries (a
multiple of 4 in MIPS-32)
p Big Endian: leftmost byte is word address
m E.g., IBM 360/370, Motorola 68k, MIPS, Sparc, HP PA
p Little Endian: rightmost byte is word address
m Intel 80x86, DEC Vax, DEC Alpha (Windows NT)
little endian byte 0
3 2 1 0
msb lsb
0 1 2 3
big endian byte 0
12
Fundamentals
Memory
q What value is left in $t0? (big endian)
0x 0 0 0 0 0 0 0 0 24
0x 0 0 0 0 0 0 0 0 20 q What word is changed in Memory
0x 0 0 0 0 0 0 0 0 16
and to what? (big endian)
0x 1 0 0 0 0 0 1 0 12
0x 0 1 0 0 0 4 0 2 8 q What if the machine was little
0x F F F F F F F F 4 endian?
0x 0 0 9 0 1 2 A 0 0
Data Word
Address (Decimal) 14
Fundamentals
m Example: if (i==j) h = i + j;
bne $s0, $s1, Lbl1
add $s3, $s0, $s1
Lbl1: ...
p Instruction Format (I format):
0x05 16 17 16 bit offset
0 16 17 8 0x24
p Alternate versions of slt
slti $t0, $s0, 25 # if $s0 < 25 then $t0=1 ...
sltu $t0, $s0, $s1 # if $s0 < $s1 then $t0=1 ...
sltiu $t0, $s0, 25 # if $s0 < 25 then $t0=1 ...
18
Fundamentals
19
Fundamentals
26
32
4
PC 32
20
Fundamentals
Summary
p Instructions: machine language
p MIP-32 ISA
m Register file
m R-type, I-type, J-type instruction formats
m Arithmetic, memory access, control flow
n Assembly language vs machine code
22