230 1st half.pptx - BACKGROUND INTRO MIPS CSE/EEE 230...

This preview shows page 1 - 18 out of 249 pages.

BACKGROUND & INTRO MIPS CSE/EEE 230 Reading: Chapter 1.1-5, 2.1
Below Your Program 2 Application software C++ System software Operating system Files, I/O Hardware
Levels of Program Code High-level language C++ Assembly language MIPS Machine code 3
5 Classic Components of A Computer 4 CPU Computer Control Datapath Memory Devices Input Output
Von Neumann Model Created by John von Neumann in the 1940’s Main concept of the von Neumann machine is the common memory system Memory contents Data Instructions 5
Instruction Set Architecture (ISA) Programmer view of processor PC program counter Holds the address of next instruction IR Instruction register Holds the current instruction M Memory Holds both data and instructions 6
Fetch/Execute Cycle Fetch instruction IR = M[PC] PC = PC + increment Execute instruction in IR Basic ideas Memory holds instructions IR holds current instruction PC holds location of next instruction to fetch 7
Fetch/Execute Example 8 a = 3; Address 20 b = 5; Address 21 a = a - b; Address 22 Memory 23 PC (Program Counter) a = a –b; IR (Instruction Register)
Impact on Performance Algorithm Programming language, compiler, architecture Processor and memory system I/O system (including OS) 9
The MIPS Instruction Set Used as the example throughout the book Stanford MIPS commercialized by MIPS Technologies ( ) Large share of embedded core market Applications in consumer electronics, network/storage equipment, cameras, printers, … Typical of many modern ISAs See MIPS Reference Data Sheet Called “Green Sheet” In text On Canvas 10
MIPS Overview All instructions are 32 bits 32 general registers 32 bits each Some registers are used for special purposes Memory 32 bit address Byte addressable Data can be held in Registers Memory 11
Registers vs. Memory Registers Limited number Fast access MIPS 32 general purpose registers Each are 32 bits – 4 bytes Accessed by name/number Memory Much larger amount of storage Byte addressable Accessed by address 12
MIPS Reference data sheet 13
Registers in MIPS 14 Register 1 ($at) reserved for assembler, 26-27 for operating system Refer to the MIPS reference sheet Name Register number Usage $zero 0 the constant value 0 $v0-$v1 2-3 values for results and expression evaluation $a0-$a3 4-7 arguments $t0-$t7 8-15 temporaries $s0-$s7 16-23 saved $t8-$t9 24-25 more temporaries $gp 28 global pointer $sp 29 stack pointer $fp 30 frame pointer $ra 31 return address
Accessing registers Use name of register $zero $s1 $sp Use number of register $0 $17 $29 All register references must have leading $ All numbers are in decimal 15
Fetch/Execute Example with MIPS (Initial View) 16 Address 0x00400000 ori $s1, $0, 5 Address 0x00400004 sub $s0, $s0, $s1 Address 0x00400008 Memory 0x0040000C PC (Program Counter) sub $s0, $s0, $s1 IR (Instruction Register) ori $s0, $0, 3
Register instructions Sources are 2 registers Destination is a register Called R-format instructions Format <mnemonic> <dest>, <source1>, <source2> Examples add sub Starting with instructions 17

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture