computer architecture
play

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


  1. Computer Architecture Chapter 2.8, Spring 2005 Department of Computer Science Kent State University

  2. 32-bit word alignment in byte addressed memory • Aligned at 4 (Good): • Unaligned at 5 ( Bad! ): 0 1 2 3 0 1 2 3 0 0 4 4 MSB LSB MSB 8 8 LSB

  3. Section 2.8: Communicating with People

  4. American Std Code for Info Interchange (ASCII): 8-bit bytes representing characters ASCII Char ASCII Char ASCII Char ASCI Char ASCII Char ASCII Char I 0 Null 32 space 48 0 64 @ 96 ` 112 p 1 33 ! 49 1 65 A 97 a 113 q 2 34 “ 50 2 66 B 98 b 114 r 3 35 # 51 3 67 C 99 c 115 s 4 EOT 36 $ 52 4 68 D 100 d 116 t 5 37 % 53 5 69 E 101 e 117 u 6 ACK 38 & 54 6 70 F 102 f 118 v 7 39 ‘ 55 7 71 G 103 g 119 w 8 bksp 40 ( 56 8 72 H 104 h 120 x 9 tab 41 ) 57 9 73 I 105 i 121 y 10 LF 42 * 58 : 74 J 106 j 122 z 11 43 + 59 ; 75 K 107 k 123 { 12 FF 44 , 60 < 76 L 108 l 124 | 15 47 / 63 ? 79 O 111 o 127 DEL

  5. ASCII “Tricks” • “0” in ASCII -> encoded as 48 10  -> 0011 0000 2 • “6” in ASCII -> encoded as 54 10  -> 0011 0110 2 • “9” in ASCII -> encoded as 57 10  -> 0011 1001 2 • Unicode: all encodings for 0-127 are the same as ASCII. Why?

  6. 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?

  7. More Data Transfer (2.9) • Load upper immediate ( lui )  lui $t0, 255 What does $t0 hold after? Machine language instruction 001111 00000 01000 0000 0000 1111 1111 $T0 0000 0000 1111 1111 0000 0000 0000 0000 What is the value of this in hex? How about decimal (base 10)?

  8. 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

  9. Arithmetic • Absolute value  abs dest , src • Negate  neg dest , src • NOT  not dest , src

  10. Data Transfer • Load address  la dest , offset ( base ) • Load immediate  li dest , immed • Move register  move dest , src

  11. 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

Recommend


More recommend