SlideServe
Menu
Préférences
© SlideServe · v2026

Computer Architecture

reuben avatar
14 diapositives · 351 Views · Sep 01, 2014

Computer Architecture. MIPS Instruction Set Architecture ( Supporting Procedures ). 0 $zero constant 0. 16 $s0 permanent. (For variables in a high-level language program). 1 $at reserved for assembler. · · ·. 2 $v0 return values. 23 $s7. 3 $v1.

Computer Architecture - slide 1
01 / 14Computer Architecture
1 / 17

Télécharger la présentation

Computer Architecture
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Computer Architecture MIPS Instruction Set Architecture ( Supporting Procedures )

  2. 0 $zero constant 0 16 $s0 permanent (For variables in a high-level language program) 1 $at reserved for assembler ··· 2 $v0 return values 23 $s7 3 $v1 24 $t8 temporary 4 $a0 arguments 25 $t9 5 $a1 26 $k0 OS kernel (reserved) 6 $a2 27 $k1 7 $a3 28 $gpglobal pointer 8 $t0 temporary 29 $sp stack pointer · · · 30 $fp frame pointer 15 $t7 31 $ra return address MIPS Register Naming

  3. Calling Convention (Caller Save) Callee Caller • allocate stack frame • save (live) registers • set up arguments • save return address • and jump to the callee • restore saved registers • place return value • free stack frame • restore and jump to the • return address

  4. Calling Convention (Callee Save) Callee Caller • set up arguments • save return address • and jump to the callee • allocate stack frame • save registers(that may • be modified in the callee) • place return value • restore saved registers • free stack frame • restore and jump to the • return address

  5. MIPS Calling Convention (Hybrid) Callee Caller • allocate stack frame: • $sp ← $sp – frame size • save callee-saved registers • (that may be modified in the • callee) : $s0~$s7 • save (live) caller-saved registers: • $t0~$t9, $a0~$a3, $v0~$v1, $ra • set up arguments : first four in • $a0~$a3, rest on stack • execute jal instruction • restore caller-saved registers • place return value in $v0~$v1 • restore callee-saved registers • free stack frame : • $sp ← $sp + frame size • return by jr $ra

  6. MIPS Register Convention 0 $zero constant 0 16 $s0 permanent (callee saves) (For variables in a high-level language program) 1 $at reserved for assembler ··· 2 $v0 function return value 23 $s7 3 $v1 (caller saves) 24 $t8 temporary(caller saves) 4 $a0 arguments (caller saves) 25 $t9 5 $a1 26 $k0 OS kernel (reserved) 6 $a2 27 $k1 7 $a3 28 $gpglobal pointer (caller saves) 8 $t0 temporary (caller saves) 29 $sp stack pointer (preserved) · · · • $fp frame pointer ($s8 for cc) • (callee saves) 15 $t7 31 $ra return address(jal) (caller saves)

  7. Compiling a Leaf Procedure Assembly C int leaf_example ( int g, int h, int i, int j ) { int f ; f = ( g + h ) – ( i + j ); return f; } Actually Not needed

  8. Stack Allocation FIGURE 3.12 Illustration of the stack allocation (a)before, (b)during, and (c)after the procedure call

  9. Compiling a Non-Leaf Procedure C Assembly int nonleaf_example (int arg) { int result; result = arg + leaf_example(5,4,3,2); return result; }

  10. Compiling a Recursive Procedure C Assembly int fact ( int n ) { if ( n < 1 ) return (1) ; else return ( n * fact ( n – 1) ); }

  11. Compiling and Starting a Program

  12. Object File Example

  13. MIPS Memory Allocation

  14. Executable File Example