SLIDE 1
CSCI341 Lecture 27, ASCII &Unicode, Addressing Modes ASCII - - PowerPoint PPT Presentation
CSCI341 Lecture 27, ASCII &Unicode, Addressing Modes ASCII - - PowerPoint PPT Presentation
CSCI341 Lecture 27, ASCII &Unicode, Addressing Modes ASCII American Standard Code for Information Interchange One byte = One character How many possible characters? COMMON INSTRUCTIONS lb (as signed) sb lbu (used in C
SLIDE 2
SLIDE 3
COMMON INSTRUCTIONS
- lb (as signed)
- sb
- lbu (used in C compilers)
SLIDE 4
SLIDE 5
256 CHARACTERS
- How many symbols in Chinese?
- Arabic?
- Hindi?
SLIDE 6
UNICODE
- 16 bits to represent a character (how many are possible?)
SLIDE 7
COMMON INSTRUCTIONS
- lh (load halfword, as signed)
- lhu (more appropriate, common)
- sh (store halfword)
SLIDE 8
OPTIONAL READING
The Absolute Minimum Every Software Developer Absolutely,Positively Must Know About Unicode and Character Sets (No Excuses!) http://www.joelonsoftware.com/articles/Unicode.html
SLIDE 9
SLIDE 10
I-TYPE INSTRUCTIONS
- 16-bit “immediate” field
- What about longer numbers?
- What about longer addresses?
SLIDE 11
PROBLEM
Store the number 4,000,000 in a register. 0000 0000 0011 1101 0000 1001 0000 0000
SLIDE 12
LOAD UPPER IMMEDIATE
lui $s0, 61 first half: 0000 0000 0011 1101
- ri $s0, $s0, 2304
second half: 0000 1001 0000 0000
SLIDE 13
BIG CONSTANTS?
- Assembler must be aware, and break them down into pieces
at the instruction level.
- Uses register $at (reserved for assembler) to temporarily
store 32-bit constant
SLIDE 14
WHAT ABOUT ADDRESSES?
- I-Type instruction: address is 16 bits.
- Maximum address?
- Can’t a program consist of more instructions than that? (yes)
SLIDE 15
PC-RELATIVE ADDRESSING
- Assumption: conditional branches are within 215 away
- Branch address = PC + offset(in words)
- So for conditional branches, MIPS uses PC-relative addressing
SLIDE 16
BIGGER JUMPS (EG, TO FUNCTION LABELS)
- J-type instruction: 26-bits for addressing
SLIDE 17
ADDRESSING MODES
Immediate:
- perand is constant
Register:
- perand is value in a
register Base/Displacement:
- perand is register value
plus constant PC-Relative:
- perand PC + constant
Pseudodirect: Think: J-Type
SLIDE 18
HOMEWORK
- Reading: 2.10 & 2.11
- Finish Project 5, “Absolutely!”