CSCI341 Lecture 27, ASCII &Unicode, Addressing Modes ASCII - - PowerPoint PPT Presentation

csci341
SMART_READER_LITE
LIVE PREVIEW

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-1
SLIDE 1

CSCI341

Lecture 27, ASCII &Unicode, Addressing Modes

slide-2
SLIDE 2

ASCII

American Standard Code for Information Interchange One byte = One character How many possible characters?

slide-3
SLIDE 3

COMMON INSTRUCTIONS

  • lb (as signed)
  • sb
  • lbu (used in C compilers)
slide-4
SLIDE 4
slide-5
SLIDE 5

256 CHARACTERS

  • How many symbols in Chinese?
  • Arabic?
  • Hindi?
slide-6
SLIDE 6

UNICODE

  • 16 bits to represent a character (how many are possible?)
slide-7
SLIDE 7

COMMON INSTRUCTIONS

  • lh (load halfword, as signed)
  • lhu (more appropriate, common)
  • sh (store halfword)
slide-8
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 9
slide-10
SLIDE 10

I-TYPE INSTRUCTIONS

  • 16-bit “immediate” field
  • What about longer numbers?
  • What about longer addresses?
slide-11
SLIDE 11

PROBLEM

Store the number 4,000,000 in a register. 0000 0000 0011 1101 0000 1001 0000 0000

slide-12
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
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
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
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
SLIDE 16

BIGGER JUMPS (EG, TO FUNCTION LABELS)

  • J-type instruction: 26-bits for addressing
slide-17
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
SLIDE 18

HOMEWORK

  • Reading: 2.10 & 2.11
  • Finish Project 5, “Absolutely!”

MIPS vs. E-Days... hmm...