Assembly Programming using MIPS R3000 CPU What is MIPS R3000 Processor? A 32-bit RISC CPU developed by MIPS Technologies Inc., R3000 CPU Chip Manufactured by IDT Used for high-performance desktops such as workstations Many venders manufacture the chip (NEC, IDT, Toshiba) R3000/001
Assembly Programming using MIPS R3000 CPU The process of assembly programming We start from here! SPIM Simulator does these for us R3000/002
CS 286 Computer Architecture & Organization Execution of a simple C/C++ statement by assembly instructions C/C++ statement Assembly instructions LW $S1, (address of B) A = B + C; LW $S2, (address of C) ADD $S3, $S2, $S1 Processor Memory SW $S3, (address of A) ALU (Arithmetic Logic Unit) B C A LW (Load Word) + B+C LW (Load Word) S1 S2 S3 B C SW (Store Word) Processor Registers R3000/002
Assembly Programming using MIPS R3000 CPU Example of assembly program for MIPS R3000 Comment field start: lw $s3, 0($s1) # Load s3 register add $t1, $s3, $s3 # Register t1 = s3 * 2 add $t1, $t1, $t1 # t1 = t1 *2 sw $t1, 0($s1) # Save t1 register Label field Assembly instruction field R3000/004
Assembly Programming using MIPS R3000 CPU Available registers in MIPS R3000 MIPS R3000 CPU has 32 registers We will use only some of the 32 registers Name Usage $zero $v0~$v1 $a0~$a3 $t0~$t7 $s0~$s7 $t8~$t9 $gp $sp $fp $ra Constant zero Value Argument Temporary Saved Extra Temporary Global Pointer Stack Pointer Frame Pointer Return Address R3000/005
Assembly Programming using MIPS R3000 CPU Major existing instructions for R3000 processor Memory access instructions (“load” and “store”) Integer arithmetic instructions (+, -, etc.) Logic operation instructions (AND, OR, XOR, and NOT) Branch instructions (a) Conditional branch instructions (BEQ, BNE, etc) (b) Unconditional branch instructions (“jump”) (c) Sub-routine call instructions Floating-point fraction arithmetic instruction Processor-control instructions Example: “halt”, “disable interrupts”, etc. R3000/006
Assembly Programming using MIPS R3000 CPU Basic assembly instructions of MIPS R3000 Examples These are the instructions for our project R3000/EXTRA-1
Assembly Programming using MIPS R3000 CPU Available registers in MIPS R3000 R3000/EXTRA-2
Assembly Programming using MIPS R3000 CPU The formats of R3000 assembly instructions We need to know only these information R3000/EXTRA-3