L3 - Representing Instructions in The Computer
L3 - Representing Instructions in The Computer
Computer
Representing Instructions in the Computer
• Instructions are kept in the computer as a series of high and low
electronic signals
• Represented as numbers
• Each piece of an instruction can be considered as an individual
number
• Placing these numbers side by side forms the instruction
• Translating ARM Assembly Instructions into a Machine
Instructions
• Real ARM language version of the instruction represented
symbolically as
• ADD r5, r1, r2
• First as a combination of decimal numbers and then of binary
numbers
ARM Fields
Cond F I Opcode S Rn Rd Operand2
• Layout of instruction
• Instruction represented as fields of binary numbers
• 32 bit long
1110 00 0 0100 0 0001 0101 000000000010
4 bits 2 bits 1 bit 4 bits 1 bit 4 bits 4 bits 12 bits
• Numeric version of instructions machine language
and a sequence of such instructions machine code
• Instruction format - A form of representation of an
instruction composed of fields of binary numbers
• Machine language - Binary representation used for
communication within a computer system
ARM instruction format
14 1 24 3 5 32
14 0 0 4 0 2 5 5
1110 1 11001 0011 0101 0000
0111
1 000
ARM Machine Language
Name Format Example Comments
ADD DP 14 0 0 4 0 2 1 3 ADD
r1,r2,r3
SUB DP 14 0 0 2 0 2 1 3 SUB
r1,r2,r3
LDR DT 14 1 24 2 1 100 LDR r1,
100(r2)
STR DT 14 1 25 2 1 100 STR r1,
100(r2)
Field 4 bits 2 1 bit 4 bits 1 4 4 12 bits All ARM
size bits bit bits bits instructions
are 32 bits
long
DP DP Cond F I Opcode S Rn Rd Operan Arithmetic
format d2 instruction
format
DT DT Cond F Opcode Rn Rd Offset1 Data
format 2 transfer
format
• What ARM instruction does this represent?
Cond F I Opcode S Rn Rd Operand2
14 0 0 4 0 0 1 2