Docsity

Computer Organization: Stored Programs I and II, Lecture notes of Architecture

Partial preview of the text

Download Computer Organization: Stored Programs I and II and more Lecture notes Architecture in PDF only on Docsity!

CS 2630

Computer Organization

Meeting 6: Stored programs

Brandon Myers

University of Iowa

Peer instruction What value is stored in $t0 when the program finishes? (numeric response)

Where we are going

Instruction

memory

Execution

engine

Data

memory

Learn what gets stored in here

Storing an instruction as bits

  • each MIPS instructions is 32 bits, stored in “instruction memory” 8e 13 00 00 8e 14 00 04 02 74 90 20 ae 12 00 08 22 10 00 04 22 31 ff ff 1e 20 ff f

000C

lw $s3, 0($s0) lw $s4, 4($s0) add $s2, $s3, $s sw $s2, 8($s0) addi $s0, $s0, 4 addi $s1, $s1, - 1 bgtz $s1, loop

address contents^ meaning

R-type opcode = 0 for R-type and funct is this

R-type Example: opcode = 0 for R-type and funct is this 3 steps to translate from human code to machine code

R-type Example:

0x00 8 9 13 0 0x

step 2: write as a 32-bit binary number 000000 01000 01001 01101 00000 100000

R-type Example:

0x00 8 9 13 0 0x

step 3: typically write the code as hex, so translate to hexadecimal by turning each 4 bits into a digit 0000 00 01000 0 1001 0110 1 00000 10 0000 0x

Peer instruction Give the 32-bit representation of this instruction a) 0x b) 0x014B c) 0x d) 0x e) 0x

  • QUESTIONS FOR NEXT TIME
    • what if too big for 16 bits?
    • will the funct ever be bigger than 6 bits?

CS 2630

Computer Organization

Meeting 7: Stored programs II: program execution,

immediates, addresses

Brandon Myers

University of Iowa

Where we are going Instruction set architecture (e.g., MIPS) Compiler Memory system Processor I/O system Datapath & Control Digital logic translating source code (C or Java) Programs to assembly language And linking your code to Library code How the software talks To the hardware How a processor runs MIPS Programs! How switches (1 or 0) can be used to build Interesting functions: from integer arithmetic to programmable computers

Register names - > numbers

Register Number Conventional Name Usage

$0 $zero hard-wired to 0

$1 $at reserved for assembler

$2 - $3 $v0, $v

return values from

functions

$4 - $7 $a0 - $a3 arguments

$8 - $15 $t0 - $t7 temporary registers

$16 - $23 $s0 - $s7 saved registers

$24 - $25 $t8 - $t9 temporary registers

$26 - $27 $k0 - $k1 reserved for OS

$28 $gp global pointer

$29 $sp stack Pointer

$30 $fp frame Pointer

$31 $ra return Address

this table in the MIPS reference sheet says, e.g., that register $t8 is represented by 5-bit number 24

More instructions opcode opcode funct