Professional Documents
Culture Documents
Memory Locations
b n-1
b1 b0
...
...
Referred to as words
n is the word length
Word
Address
...
2 -1
Characters
8bits
8bits
8bits
8bits
ASCII
ASCII
ASCII
ASCII
Signed integer
b 31 b 30
...
b1 b0
sign bit
Machine instruction
8bits
24 bits
opcode
addressing information
Referred to as words
n is the word length
Byte ordering
For data spanning multiple bytes
May differ from one ISA to another
Word
addr
32-bit integer
0xABCD1234
bit 31
Word
addr
0
1
bit 0
Big Endian
34 12 CD AB
Byte addr
Word
addr
0
Little Endian
AB CD 12 34
1
4
Memory Operations
Instructions and data are stored in memory
Must be transferred to processor for execution
Results of execution also placed back to memory for later use
Instructions
Instruction types
Instruction Sequencing
Addr
Move A,R0
i+1
Add B,R0
i+2
Move R0,C
3-instruction
program
segment
A
Data for
program
...
...
start
here
...
Memory contents
Branch Instructions
Two kinds:
Conditional will only
modify PC value if a
specific condition is met
Unconditional
Program Loop
Clear R0
LOOP
Determine addr of
"Next" no and add
"Next" no to R0
Decrement R1
Branch>0 LOOP
Move R0,SUM
...
Move N,R1
SUM
N
NUM1
NUM2
...
...
Condition Codes
Processor keeps track of some information about results of
some instructions
These information are stored in condition code flags
Frequently grouped together in a register called condition
code or status register
Used by conditional branch instructions to make decision
Commonly used flags:
N (negative) set to 1 if result is negative; otherwise cleared to 0
Z (zero) set to 1 if result is 0; otherwise cleared to 0
V (overflow) set to 1 if arithmetic overflow occurs; otherwise cleared
to 0
C (carry) set to 1 if a carry-out results from the operation; otherwise
cleared to 0
10
Addressing Modes
Register Operand is the contents of a CPU register
Absolute Operand is in a memory location specified explicitly in the
instruction
Immediate Operand itself specified explicitly in the instruction
Indirect Effective address of operand (in memory) is the contents of a
register or main memory location whose address is specified in the instruction
Index Effective address of operand (in memory) is generated by adding a
constant value (index) to the contents of a register (base)
Autoincrement Effective address of operand is contents of register
specified in the instruction. After accessing the operand, the contents of said
register are incremented (to point to next item in list)
Autodecrement
11
Reference
12