ࡱ>  (x/ t/ 0DArialoft Sans SttUD  0"DComic Sans MS SttUD  0B DWingdings MS SttUD  00DTimes New RomanttUD  0@DArial NarrowanttUD  0"PDSymbolarrowanttUD  0`DCourier NewanttUD  01pDLucida Sans Typewriter 01DMicrosoft Sans Serifr 0"@ .  @n?" dd@  @@`` 0( LM jR -r[3|&+-G(!4--PPw4vQ7r "f     8-/!.R?_)   4(3 mJ v-   )p 60@A>!.+/STYZ[ \ ^_`aNcefg] 7"f5stu wy0z{4v}~E6mC@0d:(W   +xK7 $ %"!L1O 6C#"L    7]F 0AA f3f@8PTʚ;ʚ;g4ddddXD  0fppp@ <4dddd@w 0tUD  0___PPT10 ''___PPT9?  %O  =MXInstruction Set Architecture ,COE 308 Computer Architecture Prof. Muhamed Mudawar Computer Engineering Department King Fahd University of Petroleum and MineralsB4Z 0Zd/Z ,OPresentation OutlineAInstruction Set Architecture Overview of the MIPS Processor R-Type Arithmetic, Logical, and Shift Instructions I-Type Format and Immediate Constants Jump and Branch Instructions Translating If Statements and Boolean Expressions Load and Store Instructions Translating Loops and Traversing Arrays Alternative ArchitectureBB 7Z*"Instruction Set Architecture (ISA)Critical Interface between hardware and software An ISA includes the following & Instructions and Instruction Formats Data Types, Encodings, and Representations Programmable Storage: Registers and Memory Addressing Modes: to address Instructions and Data Handling Exceptional Conditions (like division by zero) Examples (Versions) First Introduced in Intel (8086, 80386, Pentium, ...) 1978 MIPS (MIPS I, II, III, IV, V) 1986 PowerPC (601, 604, & ) 1993lQ - -( -f -0 (fW Instructions Instructions are the language of the machine We will study the MIPS instruction set architecture Known as Reduced Instruction Set Computer (RISC) Elegant and relatively simple design Similar to RISC architectures developed in mid-1980 s and 90 s Very popular, used in many products Silicon Graphics, ATI, Cisco, Sony, etc. Comes next in sales after Intel IA-32 processors Almost 100 million MIPS processors sold in 2002 (and increasing) Alternative design: Intel IA-32 Known as Complex Instruction Set Computer (CISC) a - -) -1 -A - -2 -a ()1A  ''Basics of RISC DesignAll instructions are typically of one size Few instruction formats Arithmetic instructions are register to register Operands are read from registers Result is stored in a register General purpose integer and floating point registers Typically, 32 integer and 32 floating-point registers Memory access only via load and store instructions Load and store: bytes, half words, words, and double words Few simple addressing modest 2@ 25 26 23 2< 2 2t@56< Next . . .AInstruction Set Architecture Overview of the MIPS Processor R-Type Arithmetic, Logical, and Shift Instructions I-Type Format and Immediate Constants Jump and Branch Instructions Translating If Statements and Boolean Expressions Load and Store Instructions Translating Loops and Traversing Arrays Alternative ArchitectureBB 7ZOverview of the MIPS Processor (Overview of the MIPS Registers32 General Purpose Registers (GPRs) 32-bit registers are used in MIPS32 Register 0 is always zero Any value written to R0 is discarded Special-purpose registers LO and HI Hold results of integer multiply and divide Special-purpose program counter PC 32 Floating Point Registers (FPRs) Floating Point registers can be either 32-bit or 64-bit A pair of registers is used for double-precision floating-point$ 7c 7$ 7, 7F 7x 7!c$,Fx ,zMIPS General-Purpose Registersp32 General Purpose Registers (GPRs) Assembler uses the dollar notation to name registers $0 is register 0, $1 is register 1, & , and $31 is register 31 All registers are 32-bit wide in MIPS32 Register $0 is always zero Any value written to $0 is discarded Software conventions Software defines names to all registers To standardize their use in programs $8 - $15 are called $t0 - $t7 Used for temporary values $16 - $23 are called $s0 - $s7$5>C%(&!5>C% (&  MIPS Register Conventions[Instruction FormatsAll instructions are 32-bit wide, Three instruction formats: Register (R-Type) Register-to-register instructions Op: operation code specifies the format of the instruction Immediate (I-Type) 16-bit immediate constant is part in the instruction Jump (J-Type) Used by jump instructionsO] 5 =\5 _Instruction CategoriesInteger Arithmetic Arithmetic, logical, and shift instructions Data Transfer Load and store instructions that access memory Data movement and conversions Jump and Branch Flow-control instructions that alter the sequential sequence Floating Point Arithmetic Instructions that operate on floating-point registers Miscellaneous Instructions that transfer control to/from exception handlers Memory management instructions ,  M  =  6  ] ,M= 6 ] Next . . .AInstruction Set Architecture Overview of the MIPS Processor R-Type Arithmetic, Logical, and Shift Instructions I-Type Format and Immediate Constants Jump and Branch Instructions Translating If Statements and Boolean Expressions Load and Store Instructions Translating Loops and Traversing Arrays Alternative ArchitectureBB 7<3'\ R-Type Format`Op: operation code (opcode) Specifies the operation of the instruction Also specifies the format of the instruction funct: function code  extends the opcode Up to 26 = 64 functions can be defined for the same opcode MIPS uses opcode 0 to define R-type instructions Three Register Operands (common to many instructions) Rs, Rt: first and second source operands Rd: destination operand sa: the shift amount used by shift instructions #X #* #l #6 #q #X%d6     #      . Pt;."Integer Add /Subtract Instructions`Addition/Subtraction ExampleConsider the translation of: f = (g+h)  (i+j) Compiler allocates registers to variables Assume that f, g, h, i, and j are allocated registers $s0 thru $s4 Called the saved registers: $s0 = $16, $s1 = $17, & , $s7 = $23 Translation of: f = (g+h)  (i+j) addu $t0, $s1, $s2 # $t0 = g + h addu $t1, $s3, $s4 # $t1 = i + j subu $s0, $t0, $t1 # f = (g+h) (i+j) Temporary results are stored in $t0 = $8 and $t1 = $9 Translate: addu $t0,$s1,$s2 to binary code Solution:Y""H  6+ Z+     c!gHg     e"C&Logical Bitwise Operations#Logical bitwise operations: and, or, xor, nor AND instruction is used to clear bits: x and 0 = 0 OR instruction is used to set bits: x or 1 = 1 XOR instruction is used to toggle bits: x xor 1 = not x NOR instruction can be used as a NOT, how? nor $s1,$s2,$s2 is equivalent to not $s1,$s2 1 23 2. 2( $ ( +e e,%dLogical Bitwise InstructionscShift OperationsIShifting is to move all the bits in a register left or right Shifts by a constant amount: sll, srl, sra sll/srl mean shift left/right logical by a constant amount The 5-bit shift amount field is used by these instructions sra means shift right arithmetic by a constant amount The sign-bit (rather than 0) is shifted from the lefthI ee      % e )bZoiShift InstructionsShifts by a variable amount: sllv, srlv, srav Same as sll, srl, sra, but a register is used for shift amount Examples: assume that $s2 = 0xabcd1234, $s3 = 16. ? 1   a a aa $a$((,a,*000448g8t [Binary Multiplication!Shift-left (sll) instruction can perform multiplication When the multiplier is a power of 2 You can factor any binary number into powers of 2 Example: multiply $s1 by 36 Factor 36 into (4 + 32) and use distributive property of multiplication $s2 = $s1*36 = $s1*(4 + 32) = $s1*4 + $s1*328 <% <3 < <H <- < a)%3 aa H -$a$ Your Turn . . .)!Integer Multiplication & DivisionConsider ab and a/b where a and b are in $s1 and $s2 Signed multiplication: mult $s1,$s2 Unsigned multiplication: multu $s1,$s2 Signed division: div $s1,$s2 Unsigned division: divu $s1,$s2 For multiplication, result is 64 bits LO = low-order 32-bit and HI = high-order 32-bit For division LO = 32-bit quotient and HI = 32-bit remainder If divisor is 0 then result is unpredictable Moving data mflo rd (move from LO to rd), mfhi rd (move from HI to rd) mtlo rs (move to LO from rs), mthi rs (move to HI from rs)F6  & 1  \  v  e e ee&      $$$$$$$$$$$$ ((,e,004e488 0) blez Rs,label branch to label if (Rs <= 0) bgez Rs,label branch to label if (Rs >= 0) No need for beqz and bnez instructions. Why?,&^+- e e  ee    ?          $e$((,e,000000 004e488$Compound Expression with ANDmProgramming languages use short-circuit evaluation If first expression is false, second expression is skippedHn 2Better Implementation for AND Compound Expression with OR Your Turn . . .vTranslate the IF statement to assembly language $s1 and $s2 values are unsigned $s3, $s4, and $s5 values are signedFw 2G   Next . . .AInstruction Set Architecture Overview of the MIPS Processor R-Type Arithmetic, Logical, and Shift Instructions I-Type Format and Immediate Constants Jump and Branch Instructions Translating If Statements and Boolean Expressions Load and Store Instructions Translating Loops and Traversing Arrays Alternative ArchitectureJB 72ALoad and Store Instructions?Instructions that transfer data between memory & registers Programs include variables such as arrays and objects Such variables are stored in memory Load Instruction: Transfers data from memory to a register Store Instruction: Transfers data from a register to memory Memory address must be specified by load and store  P) P P) P4 P))&Load and Store Word7Load Word Instruction (Word = 4 bytes in MIPS) lw Rt, imm16(Rs) # Rt = MEMORY[Rs+imm16] Store Word Instruction sw Rt, imm16(Rs) # MEMORY[Rs+imm16] = Rt Base or Displacement addressing is used Memory Address = Rs (base) + Immediate16 (displacement) Immediate16 is sign-extended to have a signed displacement (/ 2+ 2 2+ 2( 2s 2 2/ ememea  e  m  e  m  e      a0,":aExample on Load & StoreTranslate A[1] = A[2] + 5 (A is an array of words) Assume that address of array A is stored in register $s0 lw $s1, 8($s0) # $s1 = A[2] addiu $s2, $s1, 5 # $s2 = A[2] + 5 sw $s2, 4($s0) # A[1] = $s2 Index of a[2] and a[1] should be multiplied by 4. Why?6 29 2_ 27 2 ff_e      $ >pQ Load and Store Byte and Halfword}The MIPS processor supports the following data formats: Byte = 8 bits, Halfword = 16 bits, Word = 32 bits Load & store instructions for bytes and halfwords lb = load byte, lbu = load byte unsigned, sb = store byte lh = load half, lhu = load half unsigned, sh = store halfword Load expands a memory data to fit into a 32-bit register Store reduces a 32-bit register to fit in memory8 2 2 x j 822x3$GC  kLoad and Store Instructions! Next . . .AInstruction Set Architecture Overview of the MIPS Processor R-Type Arithmetic, Logical, and Shift Instructions I-Type Format and Immediate Constants Jump and Branch Instructions Translating If Statements and Boolean Expressions Load and Store Instructions Translating Loops and Traversing Arrays Alternative ArchitectureJB 7N(vTranslating a WHILE LoopConsider the following WHILE statement: i = 0; while (A[i] != k) i = i+1; Where A is an array of integers (4 bytes per element) Assume address A, i, k in $s0, $s1, $s2, respectively How to translate above WHILE statement? xor $s1, $s1, $s1 # i = 0 move $t0, $s0 # $t0 = address A loop: lw $t1, 0($t0) # $t1 = A[i] beq $t1, $s2, exit # exit if (A[i]== k) addiu $s1, $s1, 1 # i = i+1 sll $t0, $s1, 2 # $t0 = 4*i addu $t0, $s0, $t0 # $t0 = address A[i] j loop exit: . . .( # #( # # ("0 (7@ w!Using Pointers to Traverse ArraysConsider the same WHILE loop: i = 0; while (A[i] != k) i = i+1; Where address of A, i, k are in $s0, $s1, $s2, respectively We can use a pointer to traverse array A Pointer is incremented by 4 (faster than indexing) move $t0, $s0 # $t0 = $s0 = addr A j cond # test condition loop: addiu $s1, $s1, 1 # i = i+1 addiu $t0, $t0, 4 # point to next cond: lw $t1, 0($t0) # $t1 = A[i] bne $t1, $s2, loop # loop if A[i]!= k Only 4 instructions (rather than 6) in loop body`)Y  1   31-7#Copying a String$Summing an Integer Array Addressing Modes:Where are the operands? How memory addresses are computed?xBranch / Jump Addressing Modes Jump and Branch Limits" Next . . .AInstruction Set Architecture Overview of the MIPS Processor R-Type Arithmetic, Logical, and Shift Instructions I-Type Format and Immediate Constants Jump and Branch Instructions Translating If Statements and Boolean Expressions Load and Store Instructions Translating Loops and Traversing Arrays Alternative ArchitectureJB 7N(+Alternative Architecture6Design alternative: Provide more complex instructions Goal is to reduce number of instructions executed Danger is a slower cycle time and/or a higher CPI Let s look briefly at IA-32 (Intel Architecture - 32 bits) An architecture that is  difficult to explain and impossible to love Developed by several independent groups Evolved over more than 20 years History illustrates impact of compatibility on the ISAn F F; F F;+,IA 32 History@1978: Intel 8086 is announced (16-bit architecture) 1980: 8087 floating point coprocessor is added + 60 FP instructions 1982: 80286 increases address space to 24 bits 1985: 80386 extended to 32 bits + new addressing modes + paging 1989-95: 80486, Pentium, Pentium Pro aimed at higher performance 1997: Intel added 57 new  MMX instructions, Pentium II 1999: Pentium III added another 70  SSE instructions Streaming SIMD Extensions operate on 128-bit registers 2001: Another 144  SSE2 instructions 2003: AMD increases address space to 64 bits Widens all registers to 64 bits and other changes (AMD64) 2004: Intel embraces AMD64 (calls it Intel x64) + SSE3 (13 instr.) #-"IA-32 Registers & Addressing ModesRegisters in the 32-bit subset that originated with 80386 Only 8 GPR Registers, which are not  general purpose ,p_.Typical IA-32 InstructionsData movement instructions MOV, PUSH, POP, LEA, & Arithmetic and logical instructions ADD, SUB, SHL, SHR, ROL, OR, XOR, INC, DEC, CMP, & Control flow instructions JMP, JZ, JNZ, CALL, RET, LOOP, & String instructions MOVS, LODS, & First operand is a source and destination Can be register or memory operand Second operand is a source Can be register, memory, or an immediate constant   $ 3  !   * "  3 $3!  *"3/IA-32 Instruction FormatsComplexity: Instruction formats from 1 to 17 bytes long One operand must act as both a source and destination One operand can come from memory Complex addressing modes Base or scaled index with 8 or 32 bit displacement Typical IA-32 Instruction Formats:N 3# 3# Summary of Design PrinciplesSimplicity favors regularity Simple instructions dominate the instruction frequency So design them to be simple and regular, and make them fast Use general-purpose registers uniformly across instructions Fix the size of instructions (simplifies fetching & decoding) Fix the number of operands per instruction Three operands is the natural number for a typical instruction Smaller is faster Limit the number of registers for faster access (typically 32) Make the common case fast Include constants inside instructions (faster than loading them) Design most instructions to be register-to-register Good design demands good compromises Having one-size formats is better than variable-size formats, even though it limits the size of the immediate constants.vZ70Zx0ZiZ@ZvZ?ZvZuZ%vZxZ7xi@  ?u%  x$$/, z |}~"Shl   0` 33` Sf3f` 33g` f` www3PP` ZXdbmo` \ғ3y`Ӣ` 3f3ff` 3f3FKf` hk]wwwfܹ` ff>>\`Y{ff` R>&- {p_/̴>?" dd@$?vdd(@#?  n?" dd@   @@``PR    ?  ` p>>   <4 (    6mD   ` D  T Click to edit Master title style! !  0pD   `x D  RClick to edit Master text styles Second level Third level Fourth level Fifth level!     S  0vD " `* .Instruction Set Architecture COE 308  Computer Architecture  KFUPM Muhamed Mudawar  slide *0a 2Ec c _ H  0޽h ? 3380___PPT10.И@r Default Design  0 QI`(    6@!   `   T Click to edit Master title style! !  0t$   `b   W#Click to edit Master subtitle style$ $H  0޽h ? 3380___PPT10.88/k& 0 zr  (    0`  B  `  P*    0`   wB `  R*  d  c $ ?qU  `   0`   K `  RClick to edit Master text styles Second level Third level Fourth level Fifth level!     S  6  .  `  P*    6h   w.   R*  H  0rllC ? 3380___PPT10.J F  h((  h h N,X tt B    \* p88pp h Nb tt  wB   ^* p88pp h Te tt .    \* p88pp h TDw tt  w.   ^* p88ppH h 0rllC ? 3380___PPT10.Jp: 0  06(  0~ 0 s *T`  `r `  x 0 c $LU`  ` `  H 0 0޽h ? 33___PPT10i.И0+D='  = @B +  0 0T<(  T~ T s *`  `  `  ~ T s *` 0P `  H T 0޽h ? f3fy___PPT10Y+D='  = @B +   0L0 PR(  P P s *,`  `l `  "0~ P s *.D  `  D  H P 0޽h ? X(=^___PPT10i.z ɒ+D='  = @B +   0L0  5 0<(  ~  s *p`  `  `  ~  s *4`  `x `  H  0޽h ? U>=UU(___PPT10i.L`g+D='  = @B +  0  <(  ~  s *H  `    ~  s *\  `x   H  0޽h ? a(y___PPT10Y+D='  = @B +  0 0<(  ~  s *w`  `  `  ~  s *Tx` 0P `  H  0޽h ? f3fy___PPT10Y+D='  = @B +T  0  TTDPS(  r  S 0~`  `  `  R8 0w D0wH  C 7]5W   <`  A  DMemory"D   <` * XP  A $F   6`  z Up to 232 bytes = 230 wordsjFN FNF   <`   z ? "F  <3` k  N ? "F T ]# # ]#H  C 7]SH  C 7K]H  C 7]H  C 7]#B  3 7]#B  3 i  <;`  ~ ? "F   <@`   (~ ? "F   <E` # >~ ? "F B ' 3 we 0 6J` (/F T4 bytes per word(F  1 <N`  ? "F H < C / O@ H = C 75 N > S 7` ? <,e` 0L F$0(F   @ <j` J0e ? "F N A S 7`= B <n` L. F$1(F  N D S 7`4 E <` FL F$2(F  N G S 7` "  H <`  g  G$31(F  N J S 7t    K <` E   FHi(F  N M S 7 t p   N <`   FLo(F  N P S ̙7{ #  Q <!` !   AALU"F R <x&` !   ? "FN S S ̙7E  T <`  ! =  ? "FBB U 3 7K ` BB V 3 7   DT } |  Y# } | <B W # 7 Q  X lB=C<DEF#<= @`} @ | N Z S 7` H [ C  7 H \ C 7 7 N ] S 7 P ^ 6` :0 G$F0(F  N ` S 7 P= a 6 Ɠ :. G$F1(F  N c S 7 4P d 6 :F G$F2(F  N f S 7 P"  g 6    H$F31(F  N i S ̙7  j <౓  ! k  @FP"F k < % D k  ? "F l < o g U  ]Arith"F m < Q g p  ? "FBB n 3 7   N o S 7 P H p C 7  H q C 7 wN r S 7a   N t S 7a 1N v S 7a  N x S 7a   { <   EEPC&F  ~ <     GCause&F   <̓ "`a  h  nBadVaddr0 G C   <    HStatus&F H  C 7  B  3 5#  < G CEIU$F  << Kj A $FB  3     <    CFPU$F  <8  "  A $F  <  j  CTMU$FT ]9 # ]9H  C 7]iH  C 7`]H  C 7]H  C 7]9B  3 7]9T 0]N # 0]NH  C 70]~H  C 7u]H  C 7] H  C 7]NB  3 70]NT 5W # 5WH  C 7eWH  C 7]WH  C 7WH  C 75WB  3 75WT  W #  WH  C 7PWH  C 7GWH  C 7WH  C 7 WB  3 7 WB  3    6$ f  f$Execution & Integer Unit (Main proc)&%n$F  <<*  '  ? "FB  3 G   6. "` Floating Point Unit (Coproc 1)&nF  <3  ? "FB  3 G w  6p8    Trap & Memory Unit (Coproc 0) ( nFBB  3 7uD E DT [" D  # [" D <B  # 7u< vD   lB=C4DEF=44=4 @`[" V DT q |  ¬# q | <B  # 7 Q   lB<C<DEF<< @`q@ | DT " t  Ŭ# " t <B ì # 7< t  Ĭ lB=C4DEF=44=4 @`" V DT 1 m  Ȭ# 1 m <B Ƭ # 7K L  Ǭ lB<C<DEF<< @`1 m BB ɬ 3 7K Lt BB ʬ 3 7Kt u BB ˬ 3 7 BB ̬B 3 70 DT " S  Ϭ# " S <B ͬ # 70< 1  ά lB=C4DEF=44=4 @`" SV BB Ь 3 7 D DT  8  Ӭ#  8 <B Ѭ # 7    Ҭ lB=C<DEF<= @` 8 DT    ֬#   <B Ԭ # 7   լ lB=C<DEF#<= @` DT ]"   ٬# ]"  <B ׬ # 7w< x  ج lB=C4DEF=4#4=4 @`]" V BB ڬ 3 7 w B ۬ 3 E 6 ܬ <G <7  C. . ."F ݬ <L 8 CW  ? "F ߬ <`Q  8 C. . ."FB  3  m;E  <U    A $G B  3 5m  <lZ Og A $G   <_ q b  EInteger"F  <d  b  ? "F  <i h^  _mul/div"F  <n  ^  ? "F & 6Ts 0   YArithmetic & Logic Unit&F`B 4 0D1l l @ TL  CTL fB 5 6D1pp 6 <0y "`TL  `32 General Purpose Registers(nF|@ Pl jr :Pl jr`B 8B 0D1(l jB  9 0 Pf $r \Integer Multiplier/Divider&F ; 68 "`dLo  ]32 Floating-Point Registers&FfB < 6D1% {% @  l P  A l P  > 0 "`V P  `Floating-Point Arithmetic Unit&F`B ? 0D1 l {F H  0޽h ? ̙33y___PPT10Y+D='  = @B +  0L0 XP0 (  ~  s *0pl  ~  s * `   "  3 rp 1?"`V,7 rGPRs $0  $31"0( 2" @8 Mn  [V+  3 r1?"`Mn @LO"0( 2"  3 r1?"`M8 @HI"0( 2"  3 r 1?"`M   @PC"0( 2"&   3 rh 1?"`V,  vFPRs $F0  $F31"0( 2" H  0޽h ? X(=^80___PPT10.za   0 xp%l (  r  S   `   r  S Ȓ 0Ll   8 0Psn Y+I E TL "`0Ps E $0 = $zero 2 c  F T "`0sr C $1 = $at 2 c  H T "`0rs C $2 = $v0 2 c  I To "`0s C $3 = $v1 2 c  J T4 "`0s(  C $4 = $a0 2 c  K T "`0( s  C $5 = $a1 2 c  L TH "`0 sL  C $6 = $a2 2 c  M T "`0L s  C $7 = $a3 2 c  N T "`0 sp  C $8 = $t0 2 c  O T8 "`0p s  U $9 = $t1 2 c   P T, "`0 s  C $10 = $t2 2 c  Q T "`0 s&  C $11 = $t3 2 c  R T "`0& s  C $12 = $t4 2 c  S T "`0 sJ C $13 = $t5 2 c  T T "`0Js C $14 = $t6 2 c  U T "`0sn C $15 = $t7 2 c 8 P n l+ PI [ T "`P  C $16 = $s0 2 c  \ T "` r C $17 = $s1 2 c  ] T$ "`r  C $18 = $s2 2 c  ^ T( "`  C $19 = $s3 2 c  _ T0, "` (  C $20 = $s4 2 c  ` T(0 "`(  C $21 = $s5 2 c  a T3 "` L  C $22 = $s6 2 c  b T7 "`L  C $23 = $s7 2 c  c Tx; "` p  C $24 = $t8 2 c  d T? "`p   U $25 = $t9 2 c   e TH "`  C $26 = $k0 2 c  f TL "` &  C $27 = $k1 2 c  g ThP "`&  e $28 = $gp 2 c  h TT "` J C $29 = $sp 2 c  i TX "`J  e $30 = $fp 2 c  j T\ "` n e $31 = $ra 2 c H  0޽h ? 33___PPT10i.WT+D='  = @B +8  0 77 ?B{7(  ~  s *g  `   J5  R`h B #"F: rrrrrrrL `b  <   `c pGpG1? `h .Return address (used by jal for function call)//|$$``   `(} pGpG1? h _$31$gx$$``   ` pGpG1?  h $ra"gx$$``   `0 pGpG1? `  y%Frame pointer (points to stack frame)&&|$$``   `T pGpG1?   _$30$gx$$``    `l pGpG1?    $fp"gx$$``    ` pGpG1?U `  z&Stack pointer (points to top of stack)''|$$``    ` pGpG1?U   _$29$gx$$``    `T pGpG1? U   ]$sp"gx$$``     ` pGpG 1?"` `  dReserved for OS kernelx$$``   `ܔ pGpG 1?"`   n$26  $27$  gx$$``^   `D pGpG 1?"`    $k0  $k1n gg  gx$$``    ` pGpG 1?"`) `  dMore temporaries|$$``   `, pGpG 1?"`)   n$24  $25$  gx$$``^   ` pGpG 1?"` )   $t8  $t9n gg  gx$$``!   `̹ pGpG 1?"`x `)  {'Saved registers (preserved across call)((|$$``   ` pGpG 1?"`x )  n$16  $23$  gx$$``^   `! pGpG 1?"` x )  $s0  $s7n gg  gx$$``   ` pGpG1? `U  z&Global pointer (points to global data)''|$$``   `5 pGpG1? U  _$28$gx$$``   `> pGpG1?  U  $gp"gx$$``   `\A pGpG1?`x  dTemporary Values|$$``   `Q pGpG1?x  n $8  $15$  gx$$``P   `] pGpG1? x  $t0  $t7n gg  gx$$``   `Lg pGpG1?` eArguments of a functionx$$``   `X pGpG1? j$4  $7$gx$$``P   `D} pGpG1?  $a0  $a3n gg  gx$$``   `y pGpG1?e` iResult values of a functionx$$``    `| pGpG1?e j$2  $3$gx$$``P !  `,} pGpG1? e $v0  $v1n gg  gx$$`` "  ` pGpG1?`e hReserved for assembler usex$$`` #  ` pGpG1?e ^$1$gx$$`` $  `ܩ pGpG1? e ]$at"gx$$``  %  `H pGpG1?` qAlways 0 (forced by hardware)|$$`` &  `2 pGpG1? ^$0$gx$$`` '  `,Ϳ pGpG1?  _$zero"gx$$`` (  `0< pGpG1?R` WUsagex$$`` )  `\E pGpG1?R \Register  x$$`` *  `N pGpG1? R VNamex$$``xB + H 1 ? R`RrB , B 1 ? `rB - B 1 ? e`exB . H 1 ? h`hrB / B 1 ?RrB 0 B 1 ?RrB 1 B 1 ? `rB 2 B 1 ? `rB 3 B 1 ? x `x rB 4 B 1 ? ) `) rB 5 B 1 ?  ` rB 6 B 1 ?  ` rB 7 B 1 ? U `U rB 8 B 1 ?  ` rB 9 B 1 ?  ` rB : B 1 ?hrB ; B 1 ?hxB < H 1 ? R hxB = H 1 ? `xB > H 1 ?`R`hk ? T gֳgֳ ?0P+ Assembler can refer to registers by name or by number It is easier for you to remember registers by name Assembler converts register name to its corresponding number&6p6pH  0޽h ? a(___PPT10i.+D='  = @B +>  0L0 =5 (  ~  s *H  `     s * D  `l   * T|\dL Pz P  # m   TD 0e0ejJ?"`Pz   OOp600 UBJ  T} 0e0ejJ?"`z  ORs500 UBJ  T# 0e0ejJ?"` z P  ORt500 UBJ   T 0e0ejJ?"`P z   ORd500 UBJ   TG 0e0ejJ?"`z P  Rfunct600 UBJ   T`` 0e0efjJ?"` z   Osa500 UBJ L P P   #      T@S 0e0ejJ?"`P   OOp600 UBJ  TI 0e0ejJ?"`  ORs500 UBJ  T, 0e0ejJ?"` P  ORt500 UBJ  Tl 0e0efjJ?"`P P  W immediate160 0 U BJ>L P-PM #  >  THݿ 0e0ejJ?"`P-M OOp600 UBJ  T 0e0efjJ?"`-PM W immediate260 0 U BJH  0޽h ? X(=^___PPT10i.z+D='  = @B +  0 ,<(  ,~ , s *8#  `   ~ , s *$  `l   H , 0޽h ? a(___PPT10i.Qp+D='  = @B +  0 @<(  ~  s *@\[  `  [  ~  s *\[ 0P [  H  0޽h ? f3fy___PPT10Y+D='  = @B +  0  A(   ~   s *x[  `  [  ~   s *P[ i `x [  L Pz P   #  Y-   T0 [ 0e0ejJ?"`Pz   OOp600 UBJ   T [ 0e0ejJ?"`z  ORs500 UBJ   T[ 0e0ejJ?"` z P  ORt500 UBJ   Tt[ 0e0ejJ?"`P z   ORd500 UBJ   TR[ 0e0ejJ?"`z P  Rfunct600 UBJ   TW[ 0e0efjJ?"` z   Osa500 UBJH   0޽h ? a(___PPT10i.+D='  = @B +08  0 G7?78c6(  ~  s * '[  `  [  E1 0QO c #"&rrrr0QO [   # l)[ PFPFPFPF 1?"`0QO jf = 0x23$  |$$``  # l@7[ PFPFPFPF 1?"`0Q jf = 0x22$  |$$``  # l0Z PFPFPFPF 1?"`0?Q df = 0x21$  x$$``  # lZ PFPFPFPF 1?"`0Q? jf = 0x20$  |$$``(  # lZ PFPFPFPF 1?"`}0O vsa = 0|$$``(   # lZ PFPFPFPF 1?"`}0 vsa = 0|$$``"   # lZ PFPFPFPF 1?"`}?0 psa = 0x$$``(   # lZ PFPFPFPF 1?"`}0? vsa = 0|$$``   # l|L PFPFPFPF 1?"`}O jrd = $s1$  |$$``   # l * PFPFPFPF 1?"`} jrd = $s1$  |$$``  # l6 PFPFPFPF 1?"`?} drd = $s1$  x$$``  # l8 PFPFPFPF 1?"`}? jrd = $s1$  |$$``L  # l9 PFPFPFPF 1?"` O rt = $s3:   |$$``L  # l PFPFPFPF 1?"`  rt = $s3:   |$$``F  # l PFPFPFPF 1?"` ? rt = $s3:   x$$``L  # l\ PFPFPFPF 1?"` ? rt = $s3:   |$$``6  # lD PFPFPFPF 1?"`  O rs = $s2$  |$$``6  # l PFPFPFPF 1?"`   rs = $s2$  |$$``0  # l PFPFPFPF 1?"` ?  ~rs = $s2$  x$$``6  # l PFPFPFPF 1?"`  ? rs = $s2$  |$$``  # l PFPFPFPF 1?"`  O \op = 0|$$``$  # l0 PFPFPFPF 1?"` O r$s1 = $s2  $s3x$$``6   # l(3 PFPFPF 1?"`0O subu $s1, $s2, $s3|V$$`` ! # l< PFPFPFPF 1?"`   \op = 0|$$`` " # lE PFPFPFPF1?  r$s1 = $s2  $s3x$$`` # # l$O PFPFPF 1?"`0 isub $s1, $s2, $s3|V$$`` * # lD` PFPFPFPF 1?"` ?  Vop = 0x$$`` + # li PFPFPFPF1??  c$s1 = $s2 + $s3x$$``6 , # lk PFPFPF 1?"`0? addu $s1, $s2, $s3|V$$`` - # lu PFPFPFPF 1?"`  ? \op = 0|$$`` . # l PFPFPFPF1? ? c$s1 = $s2 + $s3x$$`` / # l PFPFPF 1?"`0? iadd $s1, $s2, $s3|V$$`` 0  ` ##1? Q _ R-Type Formatx$$`` 1  ` ##1?  YMeaningx$$`` 2  ` ##1?0 [ Instruction  x$$``xB 3 H 1 ?0QrB 4 B 1 ?0?Q?rB 5 B 1 ?0QxB 6 H 1 ?0OQOrB 7 B 1 ?rB 8 B 1 ?  rB ; B 1 ?0QrB < B 1 ?OrB = B 1 ?  OxB > H 1 ?00OxB ? H 1 ?0QxB @ H 1 ?QQOrB A B 1 ?  OrB B B 1 ?  OrB C B 1 ?OrB D B 1 ?}}OrB E B 1 ?00O H TT gֳgֳ ?t0P Hadd & sub: overflow causes an arithmetic exception In case of overflow, result is not written to destination register addu & subu: same operation as add & sub However, no arithmetic exception can occur Overflow is ignored Many programming languages ignore overflow The + operator is translated into addu The  operator is translated into subu(3C)?+N C  +*              Pv#H  0޽h ? a(___PPT10i.+D='  = @B +B  0 0(  0~ 0 s *J  `    0 s * 0P<$D  0   4  $`2l    0  ?,$D  0 0 NԆ) "`@ 8000000(2  0 Nd) S"`?  6op(2_z    0   ?,$D  0  0 N|) "`@ 710001(2 0 NL) S"`?  Vrs = $s1 (2 _z   0    ?,$D  0 0 Nx) "`@ 710010(2 0 N| S"`?  Vrt = $s2 (2 Ez   0   ?,$D  0 0 NY "`@ 701000(2 0 Nb S"`?  <rd = $t0 (2 Yz   0  ?,$D  0 0 N|f "`@ 700000(2 0 Nc S"`?  Psa(2\z   0  y?,$D 0 0 NP "`@ 8100001(2 0 NQ S"`?  Rfunc(2H 0 0޽h ? a(22___PPT101.TD+DyD1' = @B D}1' = @BA?%,( < +O%,( < +Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*0%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*0D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*0Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*0%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*0D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*0Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*0A%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*0AD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*0ADn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*0Ag%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*0AgD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*0AgDn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*0g%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*0gD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*0gDn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*0%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*0D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*0Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*0%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*0D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*0D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<* 0%(D' =-o6Bdissolve*<3<* 0D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<* 0%(D' =-o6Bdissolve*<3<* 0D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*0%(D' =-o6Bdissolve*<3<*0D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*0%(D' =-o6Bdissolve*<3<*0D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*0%(D' =-o6Bdissolve*<3<*0D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*0%(D' =-o6Bdissolve*<3<*0+.  0 {s9(  ~   s *x  `      s *L 0P<$D 0   l .J( *S.J,$D 0  TT 1"`.( U x 0 0 1 10(2  T$Y 1"`( U y 0 1 0 10(2   T|# 1"`J( qx and y 0 0 0 1F (2`B  0D1.Jz .J( + S$@ ,$D 0 , Nһ 1"`.( U x 0 0 1 10(2 - N 1"`( U y 0 1 0 10(2 . N 1"`J( px or y 0 1 1 1F (2ZB / s *D1.Jz .J( 0 S 6,$D 0 1 N4 1"`.( U x 0 0 1 10(2 2 Nd 1"`( U y 0 1 0 10(2' 3 N 1"`J( x xor y 0 1 1 0F (2 ZB 4 s *D1.Jz .J( 5 S,,$D 0 6 N 1"`.( U x 0 0 1 10(2 7 N# 1"`( U y 0 1 0 10(2 8 N) 1"`J( qx nor y 1 0 0 0F (2ZB 9 s *D1.JH  0޽h ? a(( ___PPT10.+TrD' = @B D' = @BA?%,( < +O%,( < +D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<**%(D' =-o6Bdissolve*<3<**D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*+%(D' =-o6Bdissolve*<3<*+D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*0%(D' =-o6Bdissolve*<3<*0D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*5%(D' =-o6Bdissolve*<3<*5D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<* 1d%(D' =-o6Bdissolve*<3<* 1dD' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<* d%(D' =-o6Bdissolve*<3<* dD' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<* %(D' =-o6Bdissolve*<3<* D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<* %(D' =-o6Bdissolve*<3<* Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<* $%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<* $D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<* $+(m  0 <<@VB<(  ~  s *l8  `   1 0Qt V #"&rrrr0Qt    # lT; PFPFPFPF 1?"`TQt jf = 0x27$  |$$``  # lH PFPFPFPF 1?"`TQ jf = 0x26$  |$$``  # llZ PFPFPFPF 1?"`TdQ df = 0x25$  x$$``  # lT PFPFPFPF 1?"`TQd jf = 0x24$  |$$``(  # l\g PFPFPFPF 1?"`Tt vsa = 0|$$``(   # lp PFPFPFPF 1?"`T vsa = 0|$$``"   # l| PFPFPFPF 1?"`dT psa = 0x$$``(   # l PFPFPFPF 1?"`Td vsa = 0|$$``   # l PFPFPFPF 1?"`t jrd = $s1$  |$$``   # lĘ PFPFPFPF 1?"` jrd = $s1$  |$$``  # l| PFPFPFPF 1?"`d drd = $s1$  x$$``  # l̤ PFPFPFPF 1?"`d jrd = $s1$  |$$``L  # l@ PFPFPFPF 1?"` t rt = $s3:   |$$``L  # lĺ PFPFPFPF 1?"`  rt = $s3:   |$$``F  # lž PFPFPFPF 1?"` d rt = $s3:   x$$``L  # lƾ PFPFPFPF 1?"` d rt = $s3:   |$$``6  # ll PFPFPFPF 1?"`  t rs = $s2$  |$$``6  # l| PFPFPFPF 1?"`   rs = $s2$  |$$``0  # l PFPFPFPF 1?"` d  ~rs = $s2$  x$$``6  # lL PFPFPFPF 1?"`  d rs = $s2$  |$$``  # l PFPFPFPF 1?"`  t \op = 0|$$``  # l( PFPFPF 1?"` t b$s1 = ~($s2|$s3)x$$``  # l Ta 1? ( % ,$  0 Sor $s0,$s1,$s2(0 g ?  `. 1? % ,$  0 V# $s0 = 0xffff1234(0 g% A T2 1?Q ( q ,$  0 mxor $s0,$s1,$s2(0 g  B  `(6 1?Q q ,$   0 V# $s0 = 0x54321234(0 g  G T: 1? ( ,$   0 Snor $s0,$s1,$s2(0 g H  `4? 1? ,$   0 V# $s0 = 0x0000edcb(0 gH  0޽h ? a(00___PPT10/.+aoD .' } = @B D-' = @BA?%,( < +O%,( < +Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*9 %(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*9 D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*9 Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*9 8%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*9 8D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*9 8D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*;%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*;D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*;D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*<%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*<D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*<D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*>%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*>D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*>D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*?%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*?D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*?D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*A%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*AD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*AD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*B%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*BD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*BD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*G%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*GD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*GD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*H%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*HD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*H++0+;0 ++0+<0 ++0+>0 ++0+?0 ++0+A0 ++0+B0 ++0+G0 ++0+H0 +R8  0 --0J@PS-(  @~ @ s *  `   ~ @ s *ؼ  `    l T k  @ Tk ,$D 0 X@ H S"`?} k  : shift-in 0 x   @ H "` k  *(2`B ,@ 0D(  `B -@ 0D&   .@ H "` lk  *(2`B /@ 0D   0@ H "`l Fk  *(2 2@ H "`F k  *(2 4@ H؂ "` ` k  ?. . .(2J F@ Ho "`` =k  *(2 H@ HpP "`= k  *(2 J@ Hdf "` k  *(2 L@ H`' "` k  *(2`B M@ 0D[ 4 `B P@ 0D  `B Q@ 0D i `B R@ 0D `B S@ 0D  `B T@ 0D ] `B U@ 0D 7  V@ Hz S"`?T k  ? shift-out MSBx @ HL S"`?,   ]sll$(2gfB @ 6D# #  W@ H S"`? ` m  C32-bit register(2 l . ,B  @ .,B ,$D 0 Y@ B, "`h B  *(2ZB Z@ s *D( & ZB [@ s *DI   \@ Bܾ "`h lB  *(2ZB ]@ s *D$   ^@ BpȾ "`lh FB  *(2 _@ B$ "`Fh B  *(2 `@ B "` h ` B  ?. . .(2J a@ Bo "`` h =B  *(2 b@ BL "`=h B  *(2 c@ Bq "`h B  *(2 d@ B< "`h B  *(2ZB e@ s *D~ X ZB f@ s *D  ZB g@ s *D ZB h@ s *D ZB i@ s *D  ZB j@ s *D  ZB k@ s *D Z  l@ BdM S"`?.h B  < shift-in 0 x  m@ B S"`?}h ,B  = shift-out LSBx @ Bd S"`?,   ]srl$(2gl   ,b @ ,b,$D 0 n@ H( "`@ *(2`B p@ 0DI q@ H8 "`@l *(2`B r@ 0D$ s@ HX "`l@F *(2 t@ Hl "`F@  *(2 u@ H` "` @`  ?. . .(2J v@ H| "`` @= *(2 w@ H "`=@ *(2 x@ H  "`@ *(2 y@ H\! "`@ *(2`B z@ 0D~X`B {@ 0D`B |@ 0D `B }@ 0D  `B ~@ 0D `B @ 0D`B @ 0DZ @ Hd, S"`? @ Cshift-in sign-bitx @ H0 S"`?}@, = shift-out LSBx @ H4 S"`?, d ]sra$(2g @ # BCDEFAA$ @L&bH @ 0޽h ? a(  ___PPT10 .&-+%{D '  = @B D ' = @BA?%,( < +O%,( < +D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*@%(D' =-o6Bdissolve*<3<*@D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*@%(D' =-o6Bdissolve*<3<*@D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*@%(D' =-o6Bdissolve*<3<*@+w  0 WW[`AW(   d  `? 1? u,$   0 T$s1 = 0x0000abcd(0 g ^  `C 1?! u ,$  0 T$s1 = 0xcd123400(0 gr  S 8I  `   D| 0Q  #"."rrrr0Q  Y # lL PFPFPFPF 1?"`yQ [f = 7|$$``& W # l| PFPFPF 1?"`}y tsa = 0|$$`` U # lt PFPFPFPF 1?"`} jrd = $s1$  |$$``6 S # l PFPFPFPF 1?"`  rt = $s2$  |$$``4 Q # lV PFPFPF 1?"`   rs = $s3"  |$$`` O # lha PFPFPFPF 1?"`   \op = 0|$$`` M # l z PFPFPFPF 1?"`  c $s1 = $s2 >> $s3x$$``4 K # l| PFPFPF 1?"`0 srav $s1,$s2,$s3 |V$$``  H # l PFPFPFPF 1?"`yOQ [f = 6|$$``& F # l PFPFPF 1?"`}Oy tsa = 0|$$`` D # lx PFPFPFPF 1?"`O} jrd = $s1$  |$$``6 B # l PFPFPFPF 1?"` O rt = $s2$  |$$``4 @ # lx PFPFPF 1?"` O  rs = $s3"  |$$`` > # l PFPFPFPF 1?"` O  \op = 0|$$`` < # l0 PFPFPFPF 1?"`O  b $s1 = $s2>>>$s3x$$``4 : # l PFPFPF 1?"`0O srlv $s1,$s2,$s3 |V$$``  # lL PFPFPFPF 1?"`yQO gf = 4$ |$$``  # lM PFPFPFPF 1?"`yQ gf = 3$ |$$``  # l@N PFPFPFPF 1?"`y?Q af = 2$ x$$``  # lX PFPFPFPF 1?"`yQ? gf = 0$ |$$``&   # l4k PFPFPF 1?"`}yO tsa = 0|$$``'   # lt PFPFPF 1?"`}y usa = 10|$$``!   # lH PFPFPF 1?"`}?y osa = 10x$$``'   # l PFPFPF 1?"`}y? usa = 10|$$``   # l PFPFPFPF 1?"`}O jrd = $s1$  |$$``  # l PFPFPFPF 1?"`} jrd = $s1$  |$$``  # l PFPFPFPF 1?"`?} drd = $s1$  x$$``  # l$ PFPFPFPF 1?"`}? jrd = $s1$  |$$``6  # lD PFPFPFPF 1?"` O rt = $s2$  |$$``6  # l PFPFPFPF 1?"`  rt = $s2$  |$$``0  # l8& PFPFPFPF 1?"` ? ~rt = $s2$  x$$``6  # l( PFPFPFPF 1?"` ? rt = $s2$  |$$``4  # l+ PFPFPF 1?"`  O rs = $s3"  |$$``2  # l5 PFPFPF 1?"`   rs = 0" |$$``,  # lp PFPFPF 1?"` ?  zrs = 0" x$$``2  # lU PFPFPF 1?"`  ? rs = 0" |$$``  # l PFPFPFPF 1?"`  O \op = 0|$$``  # l PFPFPFPF 1?"` O c $s1 = $s2 << $s3x$$``4  # l PFPFPF 1?"`0O sllv $s1,$s2,$s3 |V$$``  # l PFPFPFPF 1?"`   \op = 0|$$``  # ll+ PFPFPFPF1?  b $s1 = $s2 >> 10x$$``4  # lL- PFPFPF 1?"`0 sra $s1, $s2, 10|V$$``  # lL> PFPFPFPF 1?"` ?  Vop = 0x$$``   # l@ PFPFPFPF1??  a $s1 = $s2>>>10x$$``2 ! # l`{ PFPFPF 1?"`0? srl $s1,$s2,10 |V$$`` " # l4 PFPFPFPF 1?"`  ? \op = 0|$$`` # # l PFPFPFPF1? ? b $s1 = $s2 << 10x$$``2 $ # l PFPFPF 1?"`0? sll $s1,$s2,10 |V$$`` %  ` X ##1? Q _ R-Type Formatx$$`` &  `Lb ##1?  YMeaningx$$`` '  `l ##1?0 [ Instruction  x$$``~B ( N 1 ?0QxB ) H 1 ?0?Q?xB * H 1 ?0Q~B + N 1 ?0QxB , H 1 ?xB - H 1 ?  xB . H 1 ?0QxB / H 1 ?xB 0 H 1 ?  ~B 1 N 1 ?00~B 2 N 1 ?0Q~B 3 N 1 ?QQxB 4 H 1 ?  xB 5 H 1 ?  xB 6 H 1 ?xB 7 H 1 ?}}xB 8 H 1 ?yyZB ; s *1 ?0OQOZB L s *1 ?0Q0 9  4r 0e 3"0e`0KF <$D  0   0 ]  `s 1?!  ,$  0 lsll $s1,$s2,8(0 g 0 `  `8y 1?  ,$  0 lsra $s1,$s2,4(0 g  a  `w 1? u ,$  0 T$s1 = 0xfabcd123(0 g2 c  ` 1? G,$   0 nsrlv $s1,$s2,$s3(0 g _l 0 P> x 0P>,$D  0 l T "`db > X rt=$s2=10010 (2   f T "` d> ; op=000000 (2  i T`K "`d> X rs=$s3=10011 (2   o TE "`c d> > rd=$s1=10001 (2  r T "`d> Tsa=00000 (2  u Tt "`dP> :f=000110 (2 `b w 00  y  ` 1?!   ,$  0 P $s1 = $s2<<8( 0  g z  ` 1?   ,$  0 P $s1 = $s2>>4( 0  g {  ` 1? ,$   0 S$s1 = $s2>>>$s3(0 gH  0޽h ? 33N3F3___PPT10&3.T+RD1'  = @B D0' = @BA?%,( < +O%,( < +Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*9m%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*9mD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*9mD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*]%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*]D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*]D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*y%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*yD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*yD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*^%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*^D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*^D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*`%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*`D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*`D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*z%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*zD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*zD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*a%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*aD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*aD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*c%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*cD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*cD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*{%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*{D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*{D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*d%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*dD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*dD' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*x%(D' =-o6Bdissolve*<3<*x++0+d0 ++0+^0 ++0+]0 ++0+`0 ++0+a0 ++0+c0 ++0+y0 ++0+z0 ++0+{0 +z  0 :(  ~  s *,  `   ~  s *`  `      N0bh"` @,$D  0 6fsll $t0, $s1, 2 ; $t0 = $s1 * 4 sll $t1, $s1, 5 ; $t1 = $s1 * 32 addu $s2, $t0, $t1 ; $s2 = $s1 * 36\g0 (  ! $6   H  0޽h ? f3fxp___PPT10P+D'  = @B D' = @BA?%,( < +O%,( < +D' =%(D' =%(D>' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-m6Bbox(in)*<3<*+8+0+0 +%  0  (  ~  s *fh `  h $  N kh"`x ,$@ 0 dsll $t0, $s1, 1 ; $t0 = $s1 * 2 sll $t1, $s1, 3 ; $t1 = $s1 * 8 addu $s2, $t0, $t1 ; $s2 = $s1 * 10 sll $t0, $s1, 4 ; $t0 = $s1 * 16 addu $s2, $s2, $t0 ; $s2 = $s1 * 26$0  cZ     <Xyh0P KMultiply $s1 by 26, using shift and add instructions Hint: 26 = 2 + 8 + 16L0 (L"  <zh! 0P ,$ 0 JMultiply $s1 by 31, Hint: 31 = 32  1&0 <&  Nh"` x,$@  0 Dsll $s2, $s1, 5 ; $s2 = $s1 * 32 subu $s2, $s2, $s1 ; $s2 = $s1 * 31$E0  Ec$  H  0޽h ? f3fB:___PPT10+ DV'  = @B D' = @BA?%,( < +O%,( < +D8' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<* %(D' =-o6Bdissolve*<3<* D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<* @%(D' =-o6Bdissolve*<3<* @D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*@d%(D' =-o6Bdissolve*<3<*@dD' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*d%(D' =-o6Bdissolve*<3<*dD' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D8' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*!%(D' =-o6Bdissolve*<3<*!D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*!E%(D' =-o6Bdissolve*<3<*!E++0+0 ++0+0 ++0+0 +wB  0   P$w (  $~ $ s *  `    $ s *V 0u@<$D  0   4  $` `3 $# . ,$D  0~B $ N DjJ?J J  $ T

+B#style.visibility<*$6[%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$6[D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$6[Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$[%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$[D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$[Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$D ' =%(D ' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$D ' =%(D ' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$&%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$&D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$&D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$&U%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$&UD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$&UD' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$U%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$UD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$UD ' =%(D ' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*$%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*$D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*$+RY  0 iXaX`\\(W(  (~ ( s *  `   `T P  (3 #"6* rrr     (  ` pGpG 1?"`P f0x10$ |$$`` (  `X pGpG 1?"`C W0|$$``  (  ` pGpG 1?"`C erd5$ |$$``  (  ` pGpG 1?"` c0$ |$$``  (  `( pGpG 1?"`3  c0$ |$$``  (  `, pGpG 1?"` 3  sop6 = 0. |$$``  (  `( pGpG 1?"`V  [rd = hix$$``  (  ` pGpG 1?"`V ymfhi rd|$$``   (  ` pGpG 1?"`PP f0x12$ |$$``  (  ` pGpG 1?"`CP W0|$$``  (  ` pGpG 1?"`CP erd5$ |$$``  (  `pGpG 1?"`P c0$ |$$``  (  `\pGpG 1?"`3 P c0$ |$$`` (  ` pGpG 1?"` 3 P sop6 = 0. |$$`` (  ` pGpG 1?"`V P [rd = lox$$`` (  ` pGpG 1?"`VP ymflo rd|$$``  (  `\6pGpG 1?"`PP  f0x11$ |$$`` (  `:pGpG 1?"`CP  W0|$$``  (  `IpGpG 1?"`PC  c0$ |$$``  (  `LpGpG 1?"`P  c0$ |$$``  (  `]pGpG 1?"`3 P  ers5$ |$$`` (  `hapGpG 1?"` P3   sop6 = 0. |$$``# (  `(lpGpG 1?"`VP   }hi = rsx$$``1 (  `{pGpG 1?"`PV  mthi rs$|$$``  (  `0pGpG 1?"` P  f0x13$ |$$`` (  `pGpG 1?"`C   W0|$$``  (  ``pGpG 1?"` C  c0$ |$$``  (  `pGpG 1?"`   c0$ |$$``   (  `pGpG 1?"`3    ers5$ |$$`` !(  `pGpG 1?"`  3  sop6 = 0. |$$`` "(  `pGpG1?V  }lo = rsx$$``1 #(  ` pGpG 1?"` V  mtlo rs$|$$``  $(  `T֬pGpG 1?"`P f0x1b$ |$$``  %(  `0ڬpGpG 1?"`@P f0x1a$ |$$`` &(  `,pGpG 1?"`|P@ `0x19$ x$$``  '(  `0pGpG 1?"`P| f0x18$ |$$`` ((  `pGpG 1?"`C W0|$$`` )(  `$ pGpG 1?"`C@ W0|$$`` *(  `\pGpG 1?"`C|@ Q0x$$`` +(  `pGpG 1?"`C| W0|$$``  ,(  `pGpG 1?"`C c0$ |$$``  -(  `(pGpG 1?"`@C c0$ |$$`` .(  `2pGpG 1?"`|C@ ]0$ x$$``  /(  `<pGpG 1?"`C| c0$ |$$``  0(  `FpGpG 1?"` ert5$ |$$``  1(  `,QpGpG 1?"`@ ert5$ |$$`` 2(  `H[pGpG 1?"`|@ _rt5$ x$$``  3(  `dpGpG 1?"`| ert5$ |$$``  4(  `opGpG 1?"`3  ers5$ |$$``  5(  `(ypGpG 1?"`3 @ ers5$ |$$`` 6(  `$pGpG 1?"`3 |@ _rs5$ x$$``  7(  `ČpGpG 1?"`3 | ers5$ |$$`` 8(  `pGpG 1?"` 3  sop6 = 0. |$$``0 9(  `pGpG1?V  hi, lo = rs / rt, x$$``G :(  `HpGpG 1?"`V  divu rs, rt  6|$$`` ;(  `貱pGpG 1?"` |3 @ mop6 = 0. x$$``> <(  `pGpG 1?"`V| @ hi, lo = rs rt, x$$``H =(  `سpGpG 1?"`|V@  multu rs, rt  6|$$`` >(  `\ӱpGpG 1?"` 3 | sop6 = 0. |$$``> ?(  `4pGpG 1?"`V | hi, lo = rs rt, x$$``G @(  `pGpG 1?"`V|  mult rs, rt  6|$$`` A(  `apGpG 1?"` @3  sop6 = 0. |$$``0 B(  `tpGpG1?V@  hi, lo = rs / rt, x$$``< C(  `apGpG 1?"`@V  div rs, rt  ,|$$`` D(  `xa##1? P XFormatx$$`` E(  `T(a##1?V  YMeaningx$$`` F(  `+a##1?V [ Instruction  x$$``xB G( H 1 ?PxB H( H 1 ? P rB I( B 1 ?VVrB J( B 1 ?  rB K( B 1 ?|P|rB L( B 1 ?@P@rB M( B 1 ?PrB N( B 1 ?VV rB O( B 1 ?  xB P( H 1 ? xB Q( H 1 ?PxB R( H 1 ?PP rB S( B 1 ?3 3 rB T( B 1 ? rB U( B 1 ? rB V( B 1 ?CC rB W( B 1 ? rB X( B 1 ?PrB Y( B 1 ? P rB Z( B 1 ?PPPrB [( B 1 ?P \( T>aֳֳ ?"` 0Pb A Signed arithmetic: mult, div (rs and rt are signed) LO = 32-bit low-order and HI = 32-bit high-order of multiplication LO = 32-bit quotient and HI = 32-bit remainder of division Unsigned arithmetic: multu, divu (rs and rt are unsigned) NO arithmetic exception can occur4~\ ~ !1H ( 0޽h ? a(___PPT10i.+D='  = @B +  0 P<(  ~  s *h `  h ~  s *h0P h H  0޽h ? f3fy___PPT10Y+D='  = @B +  0 $(  $~ $ s *Gh `  h  $ s *h Px h 8$ $` L P P  $# rt $ T) 0e0ejJ?"`P   OOp600 UBJ $ T$) 0e0ejJ?"`  ORs500 UBJ $ T4h0e0ejJ?"` P  ORt500 UBJ $ T4 0e0efjJ?"`P P  W immediate160 0 U BJH $ 0޽h ? a(___PPT10i.  t7j+D='  = @B +;  0 ; ;p=P:(  P~ P s *4  `   F5 0P P #"."rrrrrrr0P   P  `༚ ## 1?"`YP p imm16 = 10.  x$$``0 P # l<  1?"`Y ~rt = $s1$  x$$``0 P # l  1?"`b Y ~rs = $s2$  x$$`` P # l  1?"` Yb  Vop = 0x9  x$$`` P  ` ## 1?"`Y  p$s1 = $s2 + 10*x$$``: P  `$ ## 1?"`0Y addiu $s1, $s2, 10*|$$`` P  `% ## 1?"`PY p imm16 = 10.  x$$``0 P # l&  1?"`Y ~rt = $s1$  x$$``0 P # l&  1?"`b Y ~rs = $s2$  x$$`` P # l@  1?"` b Y Vop = 0x8  x$$`` P  `J ## 1?"` Y p$s1 = $s2 + 10*x$$``9 P  `M ## 1?"`0Y addi $s1, $s2, 10*|$$`` P  `4` ## 1?"`P p imm16 = 10.  x$$``0 P # lj  1?"` ~rt = $s1$  x$$``0 P # l  1?"`b  ~rs = $s2$  x$$`` P # l  1?"` b  Vop = 0xc  x$$`` P  ` ## 1?"`  p$s1 = $s2 & 10*x$$``9  P  ` ## 1?"`0 andi $s1, $s2, 10*|$$``"  P  `& ## 1?"`PH | imm16 = 10:   x$$``$  P # lC  1?"`H rrt = $s1  x$$``0  P # l!  1?"`b H ~rs = $s2$  x$$``  P # ldV  1?"` b H Vop = 0xd  x$$`` P  `L` ## 1?"` H p$s1 = $s2 | 10*x$$``8 P  `8c ## 1?"`0H ori $s1, $s2, 10*|$$`` P  `u ## 1?"`HP p imm16 = 10.  x$$``$ P # l  1?"`H rrt = $s1  x$$``0 P # l  1?"`b H ~rs = $s2$  x$$`` P # l(  1?"` Hb  Vop = 0xe  x$$`` P  `엀 ## 1?"`H  p$s1 = $s2 ^ 10*x$$``9 P  `` ## 1?"`0H xori $s1, $s2, 10*|$$`` P  ` ## 1?"`P p imm16 = 10.  x$$``$ P # l  1?"` rrt = $s1  x$$`` P # l  1?"`b  ]0$ x$$`` P # l΀  1?"` b  Vop = 0xf  x$$`` P  `5 ## 1?"`  p$s1 = 10 << 16*x$$``3 P  `e## 1?"`0  lui $s1, 10*   |$$`` lP  `e##1? P _ I-Type Formatx$$`` mP  `te##1?  YMeaningx$$`` nP  `@Re##1?0 [ Instruction  x$$``xB oP H 1 ?0PxB qP H 1 ?0PrB rP B 1 ?rB sP B 1 ?  rB tP B 1 ?rB uP B 1 ?  xB vP H 1 ?00xB wP H 1 ?0PxB xP H 1 ?PPrB yP B 1 ?b b rB zP B 1 ?rB {P B 1 ?rB P B 1 ?0PrB P B 1 ?0HPHrB P B 1 ?0PZB P s *1 ?0YPYZB P s *1 ?0P P Tlegֳgֳ ?  * P T*( P$`~ 4 s *3)  `  )  8 4 T 1? . +,$ 0 A = B+5; translated as: gB n 4 Tv 1?-. M,$ 0 ,C = B 1; translated asZ gF BB   4 6p   d-,$ 0 eaddiu $s0,$s1,5 g    4 B̊ / dO,$ 0 faddiu $s2,$s1,-1 g : 4 T0e1?. ,$ 0 A = B&0xf; translated as:  gB Z 4 TT+1? . ! ,$  0 C = B|0xf; translated asZ  gF BB  4 <H +"`  ,$ 0 gandi $s0,$s1,0xf g  4 Bx + # ,$  0 gori $s2,$s1,0xf gH 4 T+1?# . C ,$  0 C = 5; translated asL gcB V 4 T+1?F . f ,$  0 A = B; translated asZ gF BB  4 6+% E ,$  0 gori $s2,$zero,5 g  4 B*+H h ,$ 0 eori $s0,$s1,0 g l 0) 4,r,$D 0 4 T0+"`Ob ) X rt=$s2=10010 (2   4 T$3+"` O) ; op=001001 (2  4 T.+"`O) X rs=$s1=10001 (2   4 Tl6+"`c O) gimm = -1 = 1111111111111111(2fb 4 60H 4 0޽h ? U>=UU(g0_0___PPT10?0..L`Kg+3(Dg-'  = @B D"-' = @BA?%,( < +O%,( < +D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<* 4%(D' =-o6Bdissolve*<3<* 4D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<* 4%(D' =-o6Bdissolve*<3<* 4D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*4%(D' =-o6Bdissolve*<3<*4D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*4<p%(D' =-o6Bdissolve*<3<*4<pD' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*4p%(D' =-o6Bdissolve*<3<*4p++0+40 ++0+40 ++0+ 40 ++0+ 40 ++0+40 ++0+40 ++0+40 ++0+40 ++0+40 ++0+40 ++0+40 ++0+40 +1  0L0  5 MEPH0 (  H^ H 6?  " H  f]+xaxaG  ? `l<$D  0 + 0$`~ H s *])  `  )   L P P  H#  t- H T_) 0e0ejJ?"`P   OOp600 UBJ H T,^+0e0ejJ?"`  ORs500 UBJ H Ta+0e0ejJ?"` P  ORt500 UBJ  H Th8+0e0efjJ?"`P P  W immediate160 0 U BJd  H # lL;+1?S"`?  ,$  0 nlui $s1,0xAC51*0 2g h  H # l k1?S"`?@ ,$  0 rori $s1,$s1,0x65D9*0 2gl @ @u H@@ u,$D 0  H 3 rk1?"`@ N0xAC51,0( 2g  H 3 rT k1?"`@u N0x65D9,0( 2g H 3 rtjl1?S"`?@ @  I$s1=$17&0( 2al > u  H > u ,$D 0 H 3 rol1?"`   N0xAC51,0( 2g H 3 rrl1?"` t  N0x0000,0( 2g H 3 rpl1?S"`?>   I$s1=$17&0( 2a  H 3 rd{l1?"` u  Sclear lower 16 bits$0   H 3 r}l1?"`   Rload upper 16 bits$0 H H 0޽h ? U>=UU(___PPT10.L`Kg+DD' tl= @B D' = @BA?%,( < +O%,( < +Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*H%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*HD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*HDn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*HF%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*HFD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*HFDn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*HF`%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*HF`D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*HF`D{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<* H%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<* HD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<* HD' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*H%(D' =-o6Bdissolve*<3<*HD{' =%(D#' =%(D' =A@BBBB0B%(D' =1:Bvisible*o3>+B#style.visibility<* H%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<* HD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<* HD' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*H%(D' =-o6Bdissolve*<3<*H+p+0+ H0 ++0+ H0 +  0 `<(  ~  s *dl `  l ~  s *Ll0P l H  0޽h ? f3fy___PPT10Y+D='  = @B +   0 `  *(  ~  s *@l `  l   s *l ` l 4 0P$`>L P-PM # VRv  TX) 0e0ejJ?"`P-M OOp600 UBJ  Tl0e0efjJ?"`-PM W immediate260 0 U BJx8 o ?  o?i@ o>  o>   3 r lfjJ?"`> < \ immediate26 4 0 2     3 r,lffjJ?"`o>  IPC4*0 2    3 r|lffjJ?"`:>  <000 2  0dl ? Wleast-significant 2 bits are 00 (2 H  0޽h ? a(___PPT10i. `q+D='  = @B +  0L0  5 vn0(  ^  6?|"   fXlxaxaG  ?0u] l 4  $`~  s *D  `  D  H  0޽h ? U>=UU(___PPT10i.L`g+D='  = @B +  0 P<(  ~  s *)  `  )  ~  s *N)  `x )  H  0޽h ? a(___PPT10i.pn+D='  = @B +6-  0   p $ (  ~  s *L5  `       Hal "`0P@<$D  0   8$ X$`* U }  #   ,$D  0r  T o?' }    0e0e    BCDDEF o 8c8c     ?1 d0u0@Ty2 NP'p<'pA)BCD|E||*&25D@  S" U r X * ]" |  # "  ,$D   0r  T o?& |     0e0e    BCDDEF o 8c8c     ?1 d0u0@Ty2 NP'p<'pA)BCD|E||*&25D@  S" ]" z fH  0޽h ? a(J"B"___PPT10"".xZW+^(D!' = @B D!' = @BA?%,( < +O%,( < +Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*7\%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*7\D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*7\D ' =%(D ' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*\w%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*\wD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*\wD' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*w%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*wD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*wD' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D ' =%(D ' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*+V[  0  p (  ~  s *I  `      s *J  `x<$D  0   z   felpGpG 1?"` w,$D  0 ori $s1, $zero, 0xabcd8 emx$$``p   f3x pGpG 1?"`v ,$D  0 li $s1, 0xabcd6emx$$``_   f4x pGpG 1?"`g w> ,$D   0 slt $s1, $s3, $s2" ex$$``\    f4x pGpG 1?"`g v > ,$D   0 sgt $s1, $s2, $s3 ex$$``7    fNx pGpG1? w,$D  0 mnor $s1, $s2, $s2" ex$$``/    fWx pGpG1?v ,$D  0 e not $s1, $s2 ex$$``{    fYx pGpG1?> w ,$D   0 +slt $at, $s1, $s2 bne $at, $zero, label", ,e$x$$``P    fZx pGpG1?> v ,$D   0 blt $s1, $s2, label ex$$``x   fx pGpG1? wd ,$D   0 (lui $s1, 0xabcd ori $s1, $s1, 0x1234") )e$x$$``f   fex pGpG1?v d ,$D  0 li $s1, 0xabcd12346emx$$``S   fx pGpG1?H w,$D  0 addu Ss1, $s2, $zero" ex$$``/   fpx pGpG1?Hv ,$D  0 e move $s1, $s2 ex$$``   # l`zx pGpG1?q wH qConversion to Real Instructions  x$$``  # l̃x pGpG1?qv H ePseudo-Instructionsx$$``pB  H 1 ?q HH  0޽h ? a(EE___PPT10E. 8%+T,DB' ) = @B DB' = @BA?%,( < +O%,( < +D' =%(Dc' =%(D ' =A@BBBB0B%())))?D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D' =%(Dc' =%(D ' =A@BBBB0B%())))?D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D' =%(Dc' =%(D ' =A@BBBB0B%())))?D' =1:Bvisible*o3>+B#style.visibility<* %(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<* D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<* D' =%(Dc' =%(D ' =A@BBBB0B%())))?D' =1:Bvisible*o3>+B#style.visibility<* %(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<* D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<* D' =%(DS' =%(D' =A@BBBB0B%()))D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D' =%(DS' =%(D' =A@BBBB0B%()))D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D' =%(DS' =%(D' =A@BBBB0B%()))D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D' =%(DS' =%(D' =A@BBBB0B%()))D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D' =%(DS' =%(D' =A@BBBB0B%()))D' =1:Bvisible*o3>+B#style.visibility<* %(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<* D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<* D' =%(DS' =%(D' =A@BBBB0B%()))D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D' =%(DS' =%(D' =A@BBBB0B%()))D' =1:Bvisible*o3>+B#style.visibility<* %(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<* D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<* D' =%(DS' =%(D' =A@BBBB0B%()))D' =1:Bvisible*o3>+B#style.visibility<* %(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<* D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<* D' =%(DF' =%(D' =4@BBBB%()))D' =1:Bvisible*o3>+B#style.visibility<*l%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*lD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*lD' =%(DF' =%(D' =4@BBBB%()))D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*++0+0 ++0+0 ++0+0 ++0+ 0 ++0+ 0 ++0+ 0 ++0+ 0 ++0+ 0 ++0+0 ++0+0 ++0+0 ++0+0 +Mh  0 dg\gq :f(  8~ 8 s *hx  `  x  N: 0P : #"2&0P  x  8  `x ## 1?"` Pn aimm26$ x$$`` 8  `|x ## 1?"`  n mop6 = 2. x$$``! 8 # lx 0*0* 1?"` n o jump to label* x$$`` 8  `x ## 1?"`0n oj label*|$$`` 8  `*x ## 1?"`6VP aimm16$ x$$``  8  `x ## 1?"`V6 ]0$ x$$``  8  `x ## 1?"` V _rs5$ x$$``  8  `kN ## 1?"` V  mop6 = 1. x$$``H  8 # lpN 0*0* 1?"`V  branch if (rs < 0)* x$$``H  8  `dsN ## 1?"`0V bltz rs, label*$|$$`` 8  `rN ## 1?"`6PV aimm16$ x$$`` 8  `PN ## 1?"`6V ]0$ x$$`` 8  `eN ## 1?"` V _rs5$ x$$`` 8  `N ## 1?"`  V mop6 = 7. x$$``H 8 # lN 0*0* 1?"` V branch if (rs > 0)* x$$``H 8  `ЈN ## 1?"`0V bgtz rs, label*$|$$`` (8  `N ## 1?"`6P aimm16$ x$$`` )8  `N ## 1?"`6 ]1$ x$$`` *8  `N ## 1?"`  _rs5$ x$$`` +8  `S7 ## 1?"`   mop6 = 1. x$$``G ,8 # lT7 0*0* 1?"`  branch if (rs>=0)* x$$``H -8  `W7 ## 1?"`0 bgez rs, label*$|$$`` .8  `7 ## 1?"`6nP( aimm16$ x$$`` /8  `7 ## 1?"`n6( _rt5$ x$$`` 08  `D7 ## 1?"` n( _rs5$ x$$`` 18  `7 ## 1?"` n ( mop6 = 4. x$$``\ 28 # l 7 0*0* 1?"`n ( branch if (rs == rt)*, x$$``] 38  `7 ## 1?"`0n( beq rs, rt, label*6|$$`` 48  `7 ## 1?"`6(P aimm16$ x$$`` 58  `7 ## 1?"`(6 _rt5$ x$$`` 68  `7 ## 1?"` ( _rs5$ x$$`` 78  `7 ## 1?"` (  mop6 = 5. x$$``\ 88 # l7 0*0* 1?"`(  branch if (rs != rt)*, x$$``] 98  `@7 ## 1?"`0( bne rs, rt, label*6|$$`` :8  `(s7 ## 1?"`6P aimm16$ x$$`` ;8  `|7 ## 1?"`6 ]0$ x$$`` <8  `7 ## 1?"`  _rs5$ x$$`` =8  `L7 ## 1?"`   mop6 = 6. x$$``G >8 # l(?7 0*0* 1?"`  branch if (rs<=0)* x$$``H ?8  ` ## 1?"`0 blez rs, label*$|$$`` H8  `T ##1? P XFormatx$$`` I8  `h# ##1?  YMeaningx$$`` J8  `@+ ##1?0 [ Instruction  x$$``xB K8 H 1 ?0PxB L8 H 1 ?0PrB M8 B 1 ?rB N8 B 1 ?  rB O8 B 1 ?rB P8 B 1 ?  xB Q8 H 1 ?00xB R8 H 1 ?0PxB S8 H 1 ?PPrB T8 B 1 ?  rB U8 B 1 ?0PrB V8 B 1 ?0PrB W8 B 1 ?0(P(rB ^8 B 1 ?0VPVrB _8 B 1 ?0PrB `8 B 1 ?0nPnrB a8 B 1 ?nrB b8 B 1 ?6n6+t 0i P  : #"&i 0P 9  `X ## 1?"`6 P aimm16$ x$$`` 9  `d ## 1?"` 6 _rt5$ x$$`` 9  `t ## 1?"`  _rs5$ x$$`` 9  ` ## 1?"`   S0xbx$$``Q 9 # l ## 1?"`  rt=(rs+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*+  0 PL(  L~ L s *_N  `  N   L c $WN P0v N  *?@AB L ND7 "`) |$if (($s1 > 0) && ($s2 < 0)) {$s3++;}"%4%   L Nt7 "`,$D 0 ^# One Possible Implementation ... bgtz $s1, L1 # first expression j next # skip if false L1: bltz $s2, L2 # second expression j next # skip if false L2: addiu $s3,$s3,1 # both are true next: 0x>#89"VH L 0޽h ? f3f___PPT10+iD'  = @B DC' = @BA?%,( < +O%,( < +D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*L"C%(D' =-o6Bdissolve*<3<*L"CD' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*LC[%(D' =-o6Bdissolve*<3<*LC[D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*L%(D' =-o6Bdissolve*<3<*LD' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*L[%(D' =-o6Bdissolve*<3<*L[D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*L%(D' =-o6Bdissolve*<3<*LD' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*L%(D' =-o6Bdissolve*<3<*L+  0 `P=(  P~ P s *p 7  `  7   P <н7 x  The following implementation uses less code Reverse the relational operator Allow the program to fall through to the second expression Number of instructions is reduced from 5 to 3<0 2a HUU P N7 "`T |$if (($s1 > 0) && ($s2 < 0)) {$s3++;}"%4%   P N8 "`# ,$D 0 # Better Implementation ... blez $s1, next # skip if false bgez $s2, next # skip if false addiu $s3,$s3,1 # both are true next: 0x>"VH P 0޽h ? f3f  ___PPT10 + D '  = @B Dm ' = @BA?%,( < +O%,( < +D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*P<%(D' =-o6Bdissolve*<3<*P<D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*P<\%(D' =-o6Bdissolve*<3<*P<\D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*P~%(D' =-o6Bdissolve*<3<*P~D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*P\~%(D' =-o6Bdissolve*<3<*P\~+  0 4,\(  \~ \ s *,-  `     \ 0 P0b,$@ 0 gShort-circuit evaluation for logical OR If first expression is true, second expression is skipped Use fall-through to keep the code as short as possible bgt, ble, and li are pseudo-instructions Translated by the assembler to real instructionsc 29 d) 1 2'  )e e e1>J?@AB0 \ N "`, *if (($sl > $s2) || ($s2 > $s3)) {$s4 = 1;}"+4+#   \ NtQ"` , ,$@ 0 s bgt $s1, $s2, L1 # yes, execute if part ble $s2, $s3, next # no: skip if part L1: li $s4, 1 # set $s4 to 1 next: t0nt>&' H \ 0޽h ? f3f ___PPT10+1%D'  = @B D_' = @BA?%,( < +O%,( < +D8' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*\%(D' =-o6Bdissolve*<3<*\D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*\)%(D' =-o6Bdissolve*<3<*\)D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*\)P%(D' =-o6Bdissolve*<3<*\)PD8' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*\Pn%(D' =-o6Bdissolve*<3<*\PnD@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*\nt%(D' =-o6Bdissolve*<3<*\ntD' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*\%(D' =-o6Bdissolve*<3<*\D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*\%(D' =-o6Bdissolve*<3<*\+8+0+\0 +x  0 0 D;(  D~ D s *  `  Q  D s *  ` <$@ 0   *?@AB D N "` ,$D 0 (bgtu $s1, $s2, next move $s3, $s4 next: H"0x0x"%   D N "`RB  | if( $s1 <= $s2 ) { $s3 = $s4 }&!4x!c  T D NH "`> XB ,$D 0 :if (($s3 <= $s4) && ($s4 > $s5)) { $s3 = $s4 + $s5 }$;40Z;    D N* "`>  w,$D 0 Abgt $s3, $s4, next ble $s4, $s5, next addu $s3, $s4, $s5 next: H;0x0x;6 H D 0޽h ? f3fu m ___PPT10M +թD '  = @B DD ' = @BA?%,( < +O%,( < +D ' =%(D' =%(Dp' =A@BB BB0B%()))D' =1:Bvisible*o3>+B#style.visibility<*D%(D' =-o6Bdissolve*<3<*DD+' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*DSw%(D' =-o6Bdissolve*<3<*DSwD@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*D%(D' =-o6Bdissolve*<3<*DD ' =%(D' =%(Dp' =A@BB BB0B%()))D' =1:Bvisible*o3>+B#style.visibility<* D%(D' =-o6Bdissolve*<3<* D++0+D0 ++0+D0 ++0+ D0 +  0 <(  ~  s *E  `   ~  s *F 0P   H  0޽h ? f3fy___PPT10Y+D='  = @B +-  0 D<$$l(  lx l c $PN  `    l  <(O "` x   v F P  l P ZB lB s *DX ZN f  l  P  l NT "`f  8Memory 2TB l c $DTB  l c $DPPTB  l c $D  TB  l c $D  TB  l c $D  TB  l c $DD D TB l c $DTB l c $DTB l c $D))TB l c $DrrTB l c $DTB l c $DTB l c $DKKTB l c $DTB l c $D  TB l c $D  TB l c $Dj j TB l c $D! ! TB l c $D  TB l c $D  N L  l pZ  l N^ "`L  ; Registers 2 TB l c $DTB l c $DTB  l c $D  TB !l c $DH H  "l 0c X >load(2ZB #l s *DX   $l 0|g X   ?store(2H l 0޽h ? 33___PPT10i.V+D='  = @B +   0 +(    s *  <$@ 0   4  $`~  s *HY  `     z  b   b,$D 0(T P P  #     Tl[ 0e0ejJ?"`P   OOp600 UBJ  T< 0e0ejJ?"`  ORs500 UBJ  T 0e0ejJ?"` P  ORt500 UBJ   TM 0e0efjJ?"`P P  W immediate160 0 U BJ   # lS 1?"`   ]Base or Displacement Addressing" 0 2     Td 0e0ejJ?"`J { _ s Memory Word0 0 U BJ||  TT   T 0e0effjJ?"`A ( X Base address0 0 U BJB  B T DjJ? BT j 3  #  u B  # l 1?"`j 3  =+ 0( 22  T jJ?j 3    ` GH\ IjJ?! H&    ` GHtIjJ?! " & B  T DjJ?u J   T jJ?J u bH  0޽h ?/@   a(___PPT10. I+\Dx'  = @B D3' = @BA?%,( < +O%,( < +D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*Zq%(D' =-o6Bdissolve*<3<*ZqD3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*q%(D' =-o6Bdissolve*<3<*qDY' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*7%(D' =-o6Bdissolve*<3<*7D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*+)  0 |t " (  x  c $x  `     c $,  ` <$D 0   "| l  \ " \,$D 0`B  0D `B  0D     Htl "`  d  Vsw(2   T,q S"`?   6Memory 2   T\. S"`? g  8A[1] 2    T0 S"`? e   8A[0] 2    T2 S"`? D   8A[2] 2    TT6 S"`? E  8A[3] 2   Tl: S"`?  9. . . 2   T> S"`?   9. . . 2   TA S"`?8 \D  8A+12 2   TXE S"`?8B Z  7A+8 2   TH S"`?8 Zf  7A+4 2   TL S"`?7f [  5A 2  T  # d # H #   NDP S"`? !  ; Registers 2 AT A  #  !   NS S"`?g A  @ address of A 2    NdW S"`?A h  = $s0 = $16 2  BT A  #  #    N] S"`?g A  A value of A[2] 2   N S"`?A h  = $s1 = $17 2  =T A  #  !   Nؿ S"`?g A  <A[2] + 5 2    N| S"`?A h  = $s2 = $18 2    N( S"`?E !  9. . . 2    N S"`? ! d 9. . . 2  ! H "` c  Vlw(2H  0޽h ? 33___PPT10.Vp (+UPVD'  = @B DX' = @BA?%,( < +O%,( < +D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*o%(D' =-o6Bdissolve*<3<*oD' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D' =%(D' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*"%(D' =-o6Bdissolve*<3<*"+  0   !(  /8 z > !z >  T 1? n ^   T 1? ~ n   T 1?n ^   T 1?~ n   T 1?n fU  ;00( 2  T 1?on MU  ;00( 2   TT 1? fn  ;s0( 2   T( 1?o~ Me  ;s0( 2   T 1?~ e  ;s0( 2   T yy1?R N>   T 1?NR >  T 1?R ^ N  T 1?^ R N  T 1?g fN ;s0( 2  T 1?% g  N ;s0( 2  T 1?Wf> ;00( 2  T` 1? W~ > ;00( 2  T 1? g ~ N ;s0( 2  T| 1? n U  Vbu0( 2  T 1?  n  ;b0( 2  T 1?R g N ;h0( 2  T 1?R W> Vhu0( 2  Th 1? `n  Rsign  extend0 2  T  1?n h U  Rzero  extend0 2  TD 1?g `N Rsign  extend0 2  Ta 1?N 5 Rzero  extend0 2B   ` D1?    Nc 1? z a  I32-bit Register0( 2  s *z  `    00$`~   s *ȃ  `    H  0޽h ? a(___PPT10i.60+D='  = @B +L  0 KKKKwK(  ~  s *  `    G 0P  # #"6* 0P     3 r4 _0*_0* 1?"`xPW aimm16$ x$$``  3 r4| _0*_0* 1?"`xW _rt5$ x$$``  3 r| _0*_0* 1?"`< xW _rs5$ x$$``   3 r _0*_0* 1?"`d x< W T0x23x$$``V  3 r8 _0*_0* 1?"`xd W rt = MEM[rs+imm16]:fffx$$``j   3 rt _0*_0* 1?"`0xW lw rt, imm16(rs)8 fff$ | $$``   3 r5]_0*_0* 1?"`WP6 aimm16$ x$$``   3 r@6]_0*_0* 1?"`W6 _rt5$ x$$``   3 rH]_0*_0* 1?"`< W6 _rs5$ x$$``    3 r6]_0*_0* 1?"`d W< 6 T0x24x$$``V  3 r*]_0*_0* 1?"`Wd 6 rt = MEM[rs+imm16]:fffx$$``k  3 r@4'_0*_0* 1?"`0W6 lbu rt, imm16(rs)8 fff$ | $$``  3 r<'_0*_0* 1?"`6P aimm16$ x$$``  3 r>'_0*_0* 1?"`6 _rt5$ x$$``  3 r '_0*_0* 1?"`< 6 _rs5$ x$$``   3 r4'_0*_0* 1?"`d 6<  T0x25x$$``V  3 rX '_0*_0* 1?"`6d  rt = MEM[rs+imm16]:fffx$$``k  3 r'_0*_0* 1?"`06 lhu rt, imm16(rs)8 fff$ | $$``  3 rd'_0*_0* 1?"`P  aimm16$ x$$``  3 r&'_0*_0* 1?"`  _rt5$ x$$``  3 rlb'_0*_0* 1?"`<   _rs5$ x$$``   3 rj'_0*_0* 1?"`d <  T0x29x$$``^  3 r(T'_0*_0* 1?"`d  MEM[rs+imm16] = rt: fffx$$``j  3 r o'_0*_0* 1?"`0  sh rt, imm16(rs)8 fff$ | $$``  3 r'_0*_0* 1?"`P aimm16$ x$$``  3 r_0*_0* 1?"` _rt5$ x$$``  3 r_0*_0* 1?"`<  _rs5$ x$$``   3 rT_0*_0* 1?"`d <  T0x28x$$``^   3 r, _0*_0* 1?"`d  MEM[rs+imm16] = rt: fffx$$``j ! 3 r&_0*_0* 1?"`0 sb rt, imm16(rs)8 fff$ | $$`` " 3 r\8_0*_0* 1?"`P aimm16$ x$$`` # 3 rB_0*_0* 1?"` _rt5$ x$$`` $ 3 r$M_0*_0* 1?"`<  _rs5$ x$$``  % 3 r_0*_0* 1?"`d <  T0x20x$$``f & 3 rH _0*_0* 1?"`d  rt = MEM[rs+imm16]Jffffx$$``p ' 3 r_0*_0* 1?"`0 lb rt, imm16(rs)H ffff | $$`` ( 3 rD]_0*_0* 1?"`Px aimm16$ x$$`` ) 3 rf_0*_0* 1?"`x _rt5$ x$$`` * 3 r\p_0*_0* 1?"`< x _rs5$ x$$``  + 3 r|y_0*_0* 1?"`d < x T0x21x$$``V , 3 r_0*_0* 1?"`d x rt = MEM[rs+imm16]:fffx$$``j - 3 r4_0*_0* 1?"`0x lh rt, imm16(rs)8 fff$ | $$`` . 3 rD_0*_0* 1?"` P  aimm16$ x$$`` / 3 r/_0*_0* 1?"`   _rt5$ x$$`` 0 3 r_0*_0* 1?"`<   _rs5$ x$$``  1 3 r_0*_0* 1?"`d <  T0x2bx$$``^ 2 3 r_0*_0* 1?"` d  MEM[rs+imm16] = rt: fffx$$``j 3 3 r_0*_0* 1?"`0   sw rt, imm16(rs)8 fff$ | $$`` 4  `##1?d P _ I-Type Formatx$$`` 5  `$ ##1?d  YMeaningx$$`` 6  `T##1?0 [ Instruction  x$$``xB 7 H 1 ?0PxB 8 H 1 ?0 P rB 9 B 1 ?rB : B 1 ?d d rB ; B 1 ? rB < B 1 ?d d xB = H 1 ?00 xB > H 1 ?0PxB ? H 1 ?PP rB @ B 1 ?< < rB A B 1 ?0xPxrB B B 1 ?0PrB C B 1 ?0PrB D B 1 ?0 P rB E B 1 ?0PrB F B 1 ? rB G B 1 ? rB H B 1 ?06P6rB I B 1 ?0WPW J T|gֳgֳ ?  * K T2ֳgֳ ?"` TP XBase or Displacement Addressing is used Memory Address = Rs (base) + Immediate16 (displacement) Two variations on base addressing If Rs = $zero = 0 then Address = Immediate16 (absolute) If Immediate16 = 0 then Address = Rs (register indirect)(8"q   "* >9JUH  0޽h ? a(___PPT10i.+D='  = @B +  0 <(  ~  s *  `   ~  s * 0P   H  0޽h ? f3fy___PPT10Y+D='  = @B +5  0 / (  ~  s *\  `     s *'0Pb<$@ 0   8$$ $` l J r@ / }Q,$@ 0 # T8 S"`?J   8Memory 2 $ TȬ S"`? +i  8A[2] 2  % T S"`? +G  RA[i] 2  & TT'S"`?j +  8A[1] 2  ' T'S"`? +  8A[0] 2  ( Tb'S"`?F +  9. . . 2  ) T,,'S"`? +  9. . . 2  * Tl'S"`?O   5A 2  + T0'S"`?Oh   7A+4 2  , TDE'S"`?O h  7A+8 2  - T+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*B%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*BD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*BDn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*Bl%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*BlD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*BlDn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*l%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*lD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*lDo ' =%(D ' =%(D3' =4@BB BB%(D' =1:Bvisible*o3>+B#style.visibility<*/%(D' =-o6Bdissolve*<3<*/D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*+)  0   (  ~  s *4S `     s *W0P]<$D  0  8$ $`H  0޽h ? a(p'h'___PPT10H'.c++qZD'' = @B D&' = @BA?%,( < +O%,( < +Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*~%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*~D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*~Dn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D4' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D4' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*a%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*aD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*aD' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*D4' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*=%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*=D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*=D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*=a%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*=aD' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*=aDn' =%(D' =%(D' =4@BBBB%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =+4 8?\CB#ppt_xBCB#ppt_xB*Y3>B ppt_x<*D' =+4 8?dCB1+#ppt_h/2BCB#ppt_yB*Y3>B ppt_y<*+r!  0  H(  ~  s *  `      BD "`J 0Pb,$@ 0 * move $t0, $s0 # $t0 = pointer to source move $t1, $s1 # $t1 = pointer to target L1: lb $t2, 0($t0) # load byte into $t2 sb $t2, 0($t1) # store byte into target addiu $t0, $t0, 1 # increment source pointer addiu $t1, $t1, 1 # increment target pointer bne $t2, $zero, L1 # loop until NULL char +0n+P|'))' c  <0P The following code copies source string to target string Address of source in $s0 and address of target in $s1 Strings are terminated with a null character (C strings)40 (+|   B"`0P,$D 0 ;i = 0; do {target[i]=source[i]; i++;} while (source[i]!=0); <0  <>   H  0޽h ? f3fbZ___PPT10:+l/D'  = @B Di' = @BA?%,( < +O%,( < +D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<* %(D' =-o6Bdissolve*<3<* D' =%(D(' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*)%(D' =-o6Bdissolve*<3<*)D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*)R%(D' =-o6Bdissolve*<3<*)RD' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*R{%(D' =-o6Bdissolve*<3<*R{D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*{%(D' =-o6Bdissolve*<3<*{D8' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*+%(D' =-o6Bdissolve*<3<*++p+0+0 ++0+ 0 +   0 a(  ~  s ** `   e  BX4"`0P,$@ 0 move $t0, $s0 # $t0 = address A[i] xor $t1, $t1, $t1 # $t1 = i = 0 xor $s2, $s2, $s2 # $s2 = sum = 0 L1: lw $t2, 0($t0) # $t2 = A[i] addu $s2, $s2, $t2 # sum = sum + A[i] addiu $t0, $t0, 4 # point to next A[i] addiu $t1, $t1, 1 # i++ bne $t1, $s1, L1 # loop if (i != n)e0 !0 e0 %0 e!e%#!V VV  H,"`0P) l2Assume $s0 = array address, $s1 = array length = n30(23<  BJ"` 0P- .sum = 0; for (i=0; i+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*#%(D' =-o6Bdissolve*<3<*#D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*#C%(D' =-o6Bdissolve*<3<*#CD@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*Ce%(D' =-o6Bdissolve*<3<*CeD' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*e%(D' =-o6Bdissolve*<3<*eD' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D8' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*D' =%(D' =%(D@' =A@BB BB0B%(D' =1:Bvisible*o3>+B#style.visibility<*%(D' =-o6Bdissolve*<3<*+8+0+0 +%  0 $$@00$(  ~  s *d `   F  M   M(T P P  #     Tf0e0ejJ?"`P   OOp600 UBJ  Tm0e0ejJ?"`  ORs500 UBJ  Tr0e0ejJ?"` P  ORt500 UBJ  Thw0e0efjJ?"`P P  W immediate160 0 U BJ   # l{1?"`   ]Base or Displacement Addressing" 0 2     Tԁ0e0ejJ?"`J c J pWord00 UBJ||  TT   Z1?"`J N  _!Operand is in memory (load/store)""0 2"   T0e0effjJ?"`,  cRegister = Base address00 UBJB  B T DjJ? -T j 3  #  u -  # l1?"`j 3  =+ 0( 22  T jJ?j 3    ` GH\ IjJ?! 3&    ` GHtIjJ?! & { B  T DjJ?u J   T jJ?J ` M   T0e0ejJ?"`J r- Halfword0 0 UBJ8@@  T0e0ejJ?"`J ^ PByte00 UBJF m  m(T P P  #  m  T0e0ejJ?"`P   OOp600 UBJ  TT0e0ejJ?"`  ORs500 UBJ  T$0e0ejJ?"` P  ORt500 UBJ  Td0e0efjJ?"`P P  W immediate160 0 U BJ  # l̸1?"` t RImmediate Addressing"0 2   `Լ1?"`J P QOperand is a constant 0 2B  T DjJ? J  F S    S T Pz P  !#     " T0e0ejJ?"`Pz   OOp600 UBJ # TP0e0ejJ?"`z  ORs500 UBJ $ T0e0ejJ?"` z P  ORt500 UBJ % T0e0ejJ?"`P z   ORd500 UBJ & T\0e0ejJ?"`z P  Rfunct600 UBJ ' T0e0ejJ?"` z   Osa500 UBJ ( # l1?"`S  QRegister Addressing"0 2 ) T0e0ejJ?"`J   TRegister0 0 UBJ * Z1?"`J    TOperand is in a register 0 2B + T DjJ?Z J Z T P< ,#  Z ~B - N DjJ?PP~B . N DjJ?~B / N DjJ?<< 0  fgֳgֳ ? v  H  0޽h ?/@  a(___PPT10i.b^o+D='  = @B +(  0 ''030 &(  ~  s * `   CL `P3 # &f  # l1?"`P `P @Used for branching (beq, bne, & )$!0( 2!,  T`0e0ejJ?"`P fPM Word = Target Instruction00 UBJ||  TT  T jJ?P *P3(T P P  #    T0e0ejJ?"`P   OOp600 UBJ   T0e0ejJ?"`  ORs500 UBJ   Td0e0ejJ?"` P  ORt500 UBJ   T0e0efjJ?"`P P  W immediate160 0 U BJ   # l0"1?"`  TPC-Relative Addressing"0 2   Tx 0e0effjJ?"`0c  PPC3000 UBJ"   fZ GHfIԖjJ?+S    ` GHIjJ?  }B  T DjJ?i P   # l,*ffjJ?"`c 0  >00 0 2 T j 3  #  j M  # l.1?"`j 3  >+1 0( 22  T jJ?j 3 8  3n  3 r21?"`}  :Target Instruction Address PC = PC + 4 (1 + immediate16)`;0  'B  @  3 r:ffjJ?"` ` PC30 + immediate16 + 1V0 2      3 r,BffjJ?"`` >00 0 2 2  #  CENHR!QjJ? `TEF`TEF`TEF`T w8 P- 2-P  3 rhFfjJ?"` -` \ immediate26 4 0 2    3 rKffjJ?"` -  IPC4*0 2   3 rPffjJ?"``- >00 0 2    3 rDT1?"`P-{  TTarget Instruction Address0  L  P  #       T4Y0e0ejJ?"`P P  sWord = Target Instruction"0 UB||  TT ! T jJ?P v P FT f M "#   # THb0e0efjJ?"`f M W immediate260 0 U BJ $ Tf0e0ejJ?"`fM OOp600 UBJ % # lk1?"`  VPseudo-direct Addressing"0 2 & T$p0e0effjJ?"`} c c  PPC2600 UBJT j 3  '#  i  ( # l4t1?"`j 3  ?:"0( 22 ) T jJ?j 3 " *  fZ GxHSvIjJ?  i  +  ` GHIjJ? h  B , T DjJ?i 1 P 1  - # lpxffjJ?"`c } c  >00 0 2   . # l|1?"`P Pd  XUsed by jump instruction$0( 22 /   ClENH^QjJ? `TPl`TPl`TPl`T a  0 # lffjJ?"`} c  IPC4*0 2 H  0޽h ?o  0)*#)+/ a(___PPT10i.+D='  = @B +   0   P NO (  ~  s * `    A T8gֳgֳ ?  * B T ֳֳ ?"`0ub FJump Address Boundary = 226 instructions = 256 MB Text segment cannot exceed 226 instructions or 256 MB Upper 4 bits of PC are unchanged Branch Address Boundary Branch instructions use I-Type format (16-bit immediate constant) PC-relative addressing: Target instruction address = PC + 4(1 + immediate16) Count number of instructions to branch from next instruction Positive constant => Forward Branch, Negative => Backward branch At most 215 instructions to branch (most branches are near)>2 2X 2 FZ 26 F 2:Z2   ?                  1 mF P- D t Z E # lfjJ?"` -` \ immediate26 4 0 2   F # ldffjJ?"` -  IPC4*0 2  G # lffjJ?"``- >00 0 2  H # l 1?"`P-{  TTarget Instruction Address0  8 #  r  M P  @ K 3 r\ffjJ?"`#    PC30 + immediate16 + 1V0 2     L 3 rx-ffjJ?"` r  >00 0 2 H  0޽h ? a(___PPT10i.+D='  = @B +  0 <(  ~  s *x^ `   ~  s *P_0P  H  0޽h ? f3fy___PPT10Y+D='  = @B +'  0L0  5  p,(  ,~ , s *  `x (  ^ , 6? ~ , s *8  `   H , 0޽h ? U>=UU(___PPT10i.L`g+D='  = @B +  0L0  5 4`(  4~ 4 s *^  `    4 s *(  `x   0$`H 4 0޽h ? U>=UU(___PPT10i.L`pg+D='  = @B +7  0 &66DE<5(  <~ < s *  `   ~" < s *  `   L V <# vTu# N Vj  < VjV  < T 1?VJ < # lg 1?"`fj CEAX$0 2c  < T 1?VJ0  < # l( 1?"`fj0 CECX$0 2c   < T 1?V0J  < # l( 1?"`f0j CEDX$0 2c   < T 1?VJP  < # l( 1?"`fjP CEBX$0 2c  < T 1?VPJ < # l0( 1?"`fPj CESP$0 2c  < T 1?VJp < # l1?"`fjp CEBP$0 2c  < T 1?VpJ  < # lX 1?"`fpj  CESI$0 2c  < T 1?V J  < # l1?"`f j  CEDI$0 2c kN V* J < Vc  < T 1?V* J  < # l1?"`f* j  CEIP$0 2c  < T 1?V JJ < # l#1?"`f J FEFLAGS$0 2c  N  j  <  j  < T 1?} J  < T 1? J}  < T 1?] J  < T 1? J]   < T 1?= J  !< T 1? J=  "< # l.1?"`f j=  BCS$0 2c  #< # l81?"`f= j  BSS$0 2c  $< # lB1?"`f j]  BDS$0 2c  %< # lK1?"`f] j  BES$0 2c  &< # lU1?"`f j}  BFS$0 2c  '< # lx_1?"`f} j  BGS$0 2c    E< #"&Inul2   )<  f(i 1?"`_   K$s0=index, $s1=base sll $t0, $s0, 1|2|3 add $t0, $s1, $t0 lw rt, im16($t0).L D >$ |$$`` *<  fXl1? _  1Base: any GPR Index: not ESP scale value: 0,1,2,32 2x$$`` +<  f{1?  |,Base + scaled index with 8- or 32-bit offset- -x$$`` ,<  fl 1?"`_K  H$s0=index, $s1=base sll $t0, $s0, 1|2|3 add $t0, $s1, $t0 lw rt, 0($t0)I I>$ |$$``x -<  f 1?"`_K $lw rt, im16(rs) im16 = 16-bit offsetD%    $ x$$``4 .<  f 1?"`_@  lw rt, 0(rs)   $x$$`` /<  fpGpG1?"`_@ cMIPS equivalentx$$`` 0<  fЯ1? K_  1Base: any GPR Index: not ESP scale value: 0,1,2,32 2x$$`` 1<  f1?K  cBase + scaled index x$$`` 2<  f1? _K dBase: not ESP or EBP x$$`` 3<  f1? K x(Base addressing with 8- or 32-bit offset) )x$$`` 4<  f1? @_ ^not ESP or EBP x$$`` 5<  fH1?@  aRegister Indirect x$$`` 6<  fpGpG1? _@ ` Restrictions  x$$`` 7<  fpGpG1? @ XModex$$``B 8< ZpGpG 1 ?B 9< TpGpG 1 ?B :< TpGpG 1 ?KKB ;< ZpGpG 1 ?  B << ZpGpG 1 ? B =< ZpGpG 1 ? B >< TpGpG 1 ? @ B ?< ZpGpG 1 ?@@rB @< B 1 ?  @rB A< B 1 ?__@rB B< B 1 ?_@_ rB C< B 1 ?   D< Thgֳgֳ ? ,U Base + scaled index mode is not found in MIPS MIPS immediate offsets are limited to 16 bits For 32-bit offsets, lui instruction is needed8 pgp$`H < 0޽h ? U>=UU(___PPT10i.]`0U+D='  = @B +  0 @<(  @~ @ s * `   ~" @ s *( `x  H @ 0޽h ? U>=UU(___PPT10i.^`0+D='  = @B +  0  D(  D~ D s *' `   ~" D s *, `x  VL  PM D#  M&T 0C   D# C  B D 3 0  N |C 6  D 0C   D 6M|C   OJ20 f"  D 6\WC   OE20 f"  D 6D`C   O 20 f"  D 6,jC   OE20 f"  D 6tC   OI20 f"  D 6l"C M  OP20 f" D 6,NC `  O 20 f" D 6bC   O+20 f" D 6lC   O 20 f" D 6쩂C   Od20 f" D 6C   Oi20 f" D 6,C   Os20 f" D 6ɂC   Op20 f" D 6lԂC +  Ol20 f" D 6,߂,C P  Oa20 f" D 6SC s  Oc20 f" D 6lvC   Oe20 f" D 6C   Om20 f" D 6 C   Oe20 f" D 6C   On20 f" D 6$C 6  Ot20 f" D 6)U' ut  OJ20 f" D 6$4w' t  OE20 f" D 6>I+ wx  OD20 f"  D 6dI{+ x  Oi20 f" !D 6$T+ x  Os20 f" "D 6+ x  Op20 f" #D 6 g+ x  Ol20 f" $D 6q+ x  Oa20 f" %D 6z + )x  Oc20 f" &D 6t,+ Px  Oe20 f" 'D 6@S+ x  Om20 f" (D 6+ x  Oe20 f" )D 6+ x  On20 f" *D 6+ x  Ot20 f" +D 6h; iX  OC20 f" ,D 6Ll X  Oo20 f" -D 60 X  On20 f" .D 6 X  Od20 f" /D 6 X  Oi20 f" 0D 6 X  O-20 f" 1D 6thW z  Ot20 f" 2D 6X|W   Oi20 f" 3D 6$ W   Oo20 f" 4D 6 W   On20 f"B 5D 3 & * B 6D 3  #  7D 6    O420 f" 8D 6,$    O420 f" 9D 6.  $  O820 f"cT  P  :D#  P B ;D 3  N P jN  0  D 6E   OA20 f" ?D 6O   OL20 f" @D 6PZ  0  OL20 f" AD 6d ; } i  OC20 f" BD 6o m }  OA20 f" CD 6z  }  OL20 f" DD 6\  }  OL20 f" ED 6܎  8  OO20 f" FD 6 ; M  Of20 f" GD 6 M _  Of20 f" HD 6ܮ a   Os20 f" ID 6\    Oe20 f" JD 6Į    Ot20 f"B KD 3 yO ~  LD 6ή x B  O820 f" MD 6ٮ 5 YB  O320 f" ND 6( [ B  O220 f" .T 0 M OD#  MB PD 3 3 JN z o< QD 0 %< RD 64 z < OM20 f" SD 6  < OO20 f" TD 6$  < OV20 f" UD 6  '< O 20 f" VD 6 ) ;< O 20 f" WD 6# ; M< O 20 f" XD 6  O a< O 20 f" YD 67 b t< O 20 f" ZD 6B v < O 20 f" [D 6M  < OE20 f" \D 6V  < OB20 f" ]D 6a  < OX20 f" ^D 6 l  %< O,20 f" _D 6v ' 9< O 20 f" `D 6` : L< O[20 f" aD 6 M x< OE20 f" bD 6L { < OD20 f" cD 6|  < OI20 f" dD 6<  < O 20 f" eD 6  < O+20 f" fD 6|  < O 20 f" gD 6  4< O420 f" hD 6 6 Z< O520 f" iD 6< ] o< O]20 f" jD 6 ~ OM20 f" kD 6|  OO20 f" lD 6  OV20 f" mD 6x " Ow20 f" nD 6 " Od20 f" oD 6( 4b" OD20 f" pD 6* gu" Oi20 f" qD 6h5 w" Os20 f" rD 6(@ " Op20 f" sD 6J " Ol20 f" tD 6hU " Oa20 f" uD 6_ " Oc20 f" vD 6j <" Oe20 f" wD 6(u ?t" Om20 f" xD 6 y" Oe20 f" yD 6h " On20 f" zD 6( " Ot20 f" {D 6  Or20 f" |D 6h  O/20 f" }D 6 F Om20 f" ~D 6 G OP20 f" D 6( G Oo20 f" D 6 G Os20 f" D 6h  G Ot20 f" D 6( AG Ob20 f" D 6 BbG Oy20 f" D 6 dvG Ot20 f" D 6 xG Oe20 f"B D 3  MB D 3 MB D 3 quMB D 3  G D 6 K O620 f" D 6 K O820 f" D 6* K O120 f" D 64 K  O120 f" D 6P? K) O820 f"cT , #  D#   B D 3 0U # ~N    D , m  D 6\J    OP20 f" D 6$U    OU20 f" D 6_    OS20 f" D 6h  =  OH20 f" D 6hr A S  O 20 f" D 6| T   OE20 f" D 6    OS20 f" D 6`    OI20 f" D 6 l   OP20 f" D 6    OU20 f" D 6X    OS20 f" D 6  (  OH20 f" D 6    OR20 f" D 6P    Oe20 f" D 6    Og20 f"B D 3 kW o  D 6  B  O520 f" D 6  B  O320 f"T  C P  D#  C P B D 3  P  N  C   D  C   D 6  C  OA20 f" D 6  C 0  OD20 f" D 6 4 C b  OD20 f" D 6p f C x  O 20 f" D 6 y C  OE20 f" D 6$  C  OA20 f" D 6/  C   OX20 f" D 6$: C   O,20 f" D 6pD C )  O 20 f" D 6N *C N  O#20 f" D 6Y QC u  O620 f" D 60d wC   O720 f" D 6n C   O620 f" D 6py C   O520 f" D 60  ) v  OA20 f" D 6  )  v  OD20 f" D 6p  ) J v  OD20 f" D 6 2- `z  Ow20 f" D 6 - z  OI20 f" D 60 - z  Om20 f" D 6  - Bz  Om20 f" D 6p G- kz  Oe20 f" D 6 n- z  Od20 f" D 6 - z  Oi20 f" D 6 - z  Oa20 f" D 6L - z  Ot20 f" D 6$ - z  Oe20 f" D 6  - z  OR20 f" D 6  - z  Oe20 f" D 6  - z  Og20 f"B D 3  B D 3  # B D 3 t x  D 6+    O420 f" D 66 = a  O320 f" D 6@ c   O220 f" D 6LJ   O320 f" D 6S 9 ]  O120 f" T  PM D#  PMB D 3  PLW N  D D  j D D 6]  D OT20 f" D 6Dg   D OE20 f" D 6q  K D OS20 f" D 6z M t D OT20 f" D 6` x D O 20 f" D 6  D OE20 f" D 6d  D OD20 f" D 6\   D OX20 f" D 6(  + D O,20 f" D 6 - ? D O 20 f" D 6P ? c D O#20 f" D 6 f D O420 f" D 6  D O220 f" D 6H - OI20 f" D 6  - Om20 f" D 6 F- Om20 f" D 6@ Ko- Oe20 f" D 6$ q- Od20 f" D 6 - Oi20 f" D 6 - Oa20 f" D 6" - Ot20 f" D 6, - Oe20 f" D 65   - OP20 f" D 6?  ? - Oo20 f" D 6I A a - Os20 f" D 6S d v - Ot20 f" D 6t] w  - Ob20 f" D 6Xg   - Oy20 f" D 6Pb O320 f" D 6$ dP O220 f" D 6 B Pf  O120 f" D 6 b P  O820 f"H D 0޽h ? U>=UU(___PPT10i.^`pMw#+D='  = @B +  0 Z(  ~  s *, `     s *h `l  * $ `@H  0޽h ? a(___PPT10i.b+D='  = @B +f 0 Tv(  T T  `d ~~1 ? P^K    p T  01 ?{   H T 0rllC ? X(=^80___PPT10.zPݒ 0  @(     ` ~~ ? T$K       T1 ?vQ   H  0rllC ? a(80___PPT10.L`gf 0 v(     `$[ ~~1 ? P^K  [   p   01 ?{   [ H  0rllC ? X(=^80___PPT10.zP. 0  8(  8 8  ` ~~ ? T$K     8  T1 ?vQ   H 8 0rllC ? a(80___PPT10.L`Kg 0  `L(  L L  ` E ~~ ? T$K     L  T1 ?vQ   H L 0rllC ? a(80___PPT10.L`g 0  @(     `J ~~ ? T$K       T1 ?vQ   H  0rllC ? a(80___PPT10.L`gf( 0 @ v(       `G ~~1 ? P^K    p    01 ?{   H   0rllC ? X(=^80___PPT10.zP.+ 0  0(  0 0  `Pfa~~ ? T$K  a   0  T1 ?vQ   aH 0 0rllC ? a(80___PPT10.L`g, 0  8(  8 8  T1 ?vQ   (  8  `( ~~ ? T$K  (   H 8 0rllC ? a(80___PPT10.L`p^gr  *!,mI W[0 y~X_0OSrce Ro_q [ #tSv0qT-zK |0mN P mS 0U F  :-[ +Zp ' 4z3L6_ & 6D`q,; BU3| jQZR2TX[0X Z ] "#` 1Oh+'0| hp    ,8@ Instruction Set ArchitectureDr. Muhamed Mudawar7 lecture hoursMuhamed Mudawar417Microsoft Office PowerPoint@oN@ И@p8sVG4g  L  y--$xx--'--$<<--'@BComic Sans MS-. 12 * Instruction Set Architecture."System8-@"Arial-. 2 FBCOE 308.-@"Arial-. '2 O2Computer Architecture.-@"Arial-. '2 Y.Prof. Muhamed Mudawar.-@"Arial-. 62 e'Computer Engineering Department.-@"Arial-. L2 m.King Fahd University of Petroleum and Minerals.-՜.+,0     On-screen ShowKFUPMb ?  JArialComic Sans MS WingdingsTimes New Roman Arial NarrowSymbol Courier NewLucida Sans TypewriterMicrosoft Sans SerifDefault DesignInstruction Set ArchitecturePresentation Outline#Instruction Set Architecture (ISA) InstructionsBasics of RISC Design Next . . .Overview of the MIPS ProcessorOverview of the MIPS RegistersMIPS General-Purpose RegistersMIPS Register ConventionsInstruction FormatsInstruction Categories Next . . .R-Type Format#Integer Add /Subtract InstructionsAddition/Subtraction ExampleLogical Bitwise OperationsLogical Bitwise InstructionsShift OperationsShift InstructionsBinary MultiplicationYour Turn . . ."Integer Multiplication & Division%Integer Multiply/Divide Instructions Next . . .I-Type FormatI-Type ALU Instructions"Examples: I-Type ALU Instructions32-bit Constants Next . . .J-Type Format Conditional Branch InstructionsSet on Less Than InstructionsMore on Branch InstructionsPseudo-Instructions#Jump, Branch, and SLT Instructions Next . . .Translating an IF StatementCompound Expression with ANDBetter Implementation for ANDCompound Expression with ORYour Turn . . . Next . . .Load and Store InstructionsLoad and Store WordExample on Load & Store!Load and Store Byte and HalfwordLoad and Store Instructions Next . . .Translating a WHILE Loop"Using Pointers to Traverse ArraysCopying a StringSumming an Integer ArrayAddressing ModesBranch / Jump Addressing ModesJump and Branch Limits Next . . .Alternative ArchitectureIA32 History#IA-32 Registers & Addressing ModesTypical IA-32 InstructionsIA-32 Instruction FormatsSummary of Design PrinciplesShl  Fonts Used Design Template Slide Titles? Custom Shows'_a 0Muhamed MudawarMuhamed Mudawar  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Root EntrydO)Current UserSummaryInformation(PowerPoint Document(b DocumentSummaryInformation8