Computer Architecture Chapter 2.8, Spring 2005 Department of - - PowerPoint PPT Presentation
Computer Architecture Chapter 2.8, Spring 2005 Department of - - PowerPoint PPT Presentation
Computer Architecture Chapter 2.8, Spring 2005 Department of Computer Science Kent State University 32-bit word alignment in byte addressed memory Aligned at 4 (Good): Unaligned at 5 ( Bad! ): 0 1 2 3 0 1
32-bit word alignment in byte addressed memory
- Aligned at 4 (Good):
- Unaligned at 5 (Bad!):
4 8 MSB LSB 0 1 2 3 4 8 MSB 0 1 2 3 LSB
Section 2.8: Communicating with People
American Std Code for Info Interchange (ASCII): 8-bit bytes representing characters
| 124 l 108 L 76 < 60 , 44 FF 12 { 123 k 107 K 75 ; 59 + 43 11 z 122 j 106 J 74 : 58 * 42 LF 10 y 121 i 105 I 73 9 57 ) 41 tab 9 x 120 h 104 H 72 8 56 ( 40 bksp 8 w 119 g 103 G 71 7 55 ‘ 39 7 ACK EOT Null
Char
15 6 5 4 3 2 1
ASCII
v 118 f 102 F 70 6 54 & 38 u 117 e 101 E 69 5 53 % 37 DEL t s r q p
Char
127 116 115 114 113 112
ASCII
- 111
O 79 ? 63 / 47 d 100 D 68 4 52 $ 36 c 99 C 67 3 51 # 35 b 98 B 66 2 50 “ 34 a 97 A 65 1 49 ! 33 ` 96 @ 64 48 space 32
Char ASCII Char ASCI I Char ASCII Char ASCII
ASCII “Tricks”
- “0” in ASCII -> encoded as 4810
- -> 0011 00002
- “6” in ASCII -> encoded as 5410
- -> 0011 01102
- “9” in ASCII -> encoded as 5710
- -> 0011 10012
- Unicode: all encodings for 0-127 are the same as ASCII. Why?
More Data Transfer
- Bytes (8-bit)
- Load byte (lb)
- Store byte (sb)
- C++ signed char
- Halfwords (16-bit)
- Load halfword (lh)
- Store halfword (sh)
- C++ short
- Load upper immediate (lui)
- lui $t0, 255 What does $t0 hold after?
More Data Transfer (2.9)
- Load upper immediate (lui)
- lui $t0, 255 What does $t0 hold after?
0000 0000 1111 1111 0000 0000 0000 0000 001111 00000 01000 0000 0000 1111 1111 Machine language instruction $T0 What is the value of this in hex? How about decimal (base 10)?
Pseudoinstructions
- Assembler supports some "instructions" that
are not implemented by the hardware
- These are pseudoinstructions or synthetic
instructions
- Makes assembly code easier to read/write
- Assembler may use $at as a temporary
register
Arithmetic
- Absolute value
- abs dest, src
- Negate
- neg dest, src
- NOT
- not dest, src
Data Transfer
- Load address
- la dest, offset(base)
- Load immediate
- li dest, immed
- Move register
- move dest, src
Branch
- Branch if greater than or equal (bge)
- bge src1, src2, target
- Branch if greater than (bgt)
- bgt src1, src2, target
- Branch if less than or equal (ble)
- ble src1, src2, target
- Branch if less than (blt)
- blt src1, src2, target