PCSpim Introduction. Register contentProgramMemory contentMessage.

Slides:



Advertisements
Similar presentations
1 Lecture 3: MIPS Instruction Set Today’s topic:  More MIPS instructions  Procedure call/return Reminder: Assignment 1 is on the class web-page (due.
Advertisements

CDA 3100 Recitation Week 15. What does the function f1 do:.data A:.word 10,21,45,8,100,15,29,12,3,19 B:.word 2,5,33,5,20,1,53,52,5,5 C:.word 6,8,5,4,5,22,53,12,33,89.text.globl.
SPIM Tutorial CSE 410 Computer Systems. Introduction SPIM: MIPS simulator –Reads/executes assembly source programs Does not execute binaries Download.
5Z032 Processor Design SPIM, a MIPS simulator Henk Corporaal
1 Procedure Calls, Linking & Launching Applications Lecture 15 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
The University of Adelaide, School of Computer Science
SPIM and MIPS programming
Syscall in MIPS Xinhui Hu Yuan Wang.
MIPS Function Continued
MIPS Assembly Language Programming
Ch. 8 Functions.
Recitation Material of Engineering an Assembler June 11, 2013.
1 Computer Architecture MIPS Simulator and Assembly language.
.text fact: addiu $sp, $sp, -32 sw $ra, 20($sp) sw $fp, 16($sp) addiu $fp, $sp, 28 sw $a0, 0($fp) bgtz $a0, L2 li $v0, 1 b suffix L2: addi $a0, $a0,
Procedure call frame: Hold values passed to a procedure as arguments
Writing an Embedded Controller. It usually consists of two parts – Initialization – A main loop Experience: – The main loop usually has to deal with many.
ECE 0142 Recitation #5.
MIPS Coding. Exercise – the bubble sort 5/8/2015week04-3.ppt2.
MIPS Assembly Language I Computer Architecture CPSC 321 Andreas Klappenecker.
MIPS Assembler Programming
MIPS I/O and Interrupt. SPIM I/O and MIPS Interrupts The materials of this lecture can be found in A7-A8 (3 rd Edition) and B7-B8 (4 th Edition).
Constructive Computer Architecture Tutorial 5: Programming SMIPS: Single-Core Assembly Andy Wright TA October 10, 2014http://csg.csail.mit.edu/6.175T04-1.
Writing an Embedded Controller. It usually consists of two parts – Initialization – A main loop More challenging than HW3 because HW3 is stateless, the.
MIPS function continued. Recursive functions So far, we have seen how to write – A simple function – A simple function that have to use the stack to save.
MIPS I/O and Interrupt. .data val1:.float 0.6 val2:.float 0.8 msg_done:.asciiz "done\n".text.globl main main: li.s $f0, mfc1 $a0, $f0 jal calsqrt.
In Class Execise. .data A:.word 0,1,2,3,4,5,6,7,8,9.text.globl main main: la $a0,A li $a1,6 li $a2,5 jal onUpStream done: li $v0, 10# exit syscall onUpStream:
April 23, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 9: Assemblers, Linkers, and Loaders * Jeremy R. Johnson Mon. April 23,
Lecture # 1 SPIM & MIPS Programming. SPIM SPIM is a MIPS32 simulator that reads and executes assembly language program written for SPIM. Platform -Unix,
Lecture 4: MIPS Instruction Set
MicroComputer Engineering IntroLab1 page 1 Introduction Lab1  A crash course in assembler programming  Learn how a processor works!  Decode a coded.
Fall EE 333 Lillevik 333f06-l13 University of Portland School of Engineering Computer Organization Lecture 13 Controller implementations Register.
MIPS coding. Review Shifting – Shift Left Logical (sll) – Shift Right Logical (srl) – Moves all of the bits to the left/right and fills in gap with 0’s.
MIPS I/O and Interrupt.
Recitation Material of Quiz 1 June 11, Problem 1.
EEL5708/Bölöni Lec 3.1 Fall 2006 Sept 1, 2006 Lotzi Bölöni EEL 5708 High Performance Computer Architecture Lecture 3 Review: Instruction Sets.
Pseudo instructions. MIPS supports pseudo instructions. We have seen some like – li $t0, 4 which set $t0 to 4. – la $t0, A which puts the address of label.
Instruction Set Architecture of MIPS Processor Presentation B
Intro Assembly Computer Organization I 1 June 2010 © McQuain, Feng & Ribbens MIPS Hello World # Program: Hello, World!.data # data declaration.
Instructor: Prof. Hany H Ammar, LCSEE, WVU
MIPS Programming.
MIPS Assembly Language Programming
MIPS I/O and Interrupt.
MIPS Procedures.
Lecture 4: MIPS Instruction Set
Pseudo instructions.
32-bit MIPS ISA.
MIPS I/O and Interrupt.
MIPS I/O and Interrupt.
SPIM Syscalls.
MIPS Procedures.
MPIS Instructions Functionalities of instructions Instruction format
Solutions Chapter 2.
ECE232: Hardware Organization and Design
MIPS Functions.
Pseudo instructions.
Computer Organization and Design Assembly & Simulation
MIPS Functions.
Lecture 5: Procedure Calls
MIPS Procedures.
Review.
Data Hazard Example (stall).
MIPS function continued
Program and memory layout
MIPS I/O and Interrupt.
Writing an Embedded Controller
MIPS Assembly Language Programming
MIPS Arithmetic and Logic Instructions
MIPS Functions.
MIPS function continued
MIPS R3000 Subroutine Calls and Stack
Presentation transcript:

PCSpim Introduction

Register contentProgramMemory contentMessage

Register Content

PC = EPC = Cause = BadVAddr= Status = 3000ff10 HI = LO = General Registers R0 (r0) = R8 (t0) = R16 (s0) = R24 (t8) = R1 (at) = R9 (t1) = R17 (s1) = R25 (t9) = R2 (v0) = R10 (t2) = R18 (s2) = R26 (k0) = R3 (v1) = R11 (t3) = R19 (s3) = R27 (k1) = R4 (a0) = R12 (t4) = R20 (s4) = R28 (gp) = R5 (a1) = R13 (t5) = R21 (s5) = R29 (sp) = 7fffeffc R6 (a2) = R14 (t6) = R22 (s6) = R30 (s8) = R7 (a3) = R15 (t7) = R23 (s7) = R31 (ra) = FIR = FCSR = FCCR = FEXR = FENR = Double Floating Point Registers FP0 = FP8 = FP16 = FP24 = FP2 = FP10 = FP18 = FP26 = FP4 = FP12 = FP20 = FP28 = FP6 = FP14 = FP22 = FP30 = Single Floating Point Registers FP0 = FP8 = FP16 = FP24 = FP1 = FP9 = FP17 = FP25 = FP2 = FP10 = FP18 = FP26 = FP3 = FP11 = FP19 = FP27 = FP4 = FP12 = FP20 = FP28 = FP5 = FP13 = FP21 = FP29 = FP6 = FP14 = FP22 = FP30 = FP7 = FP15 = FP23 = FP31 =

Program

[0x ]0x8fa40000 lw $4, 0($29) ; 175: lw $a0 0($sp) # argc [0x ]0x27a50004 addiu $5, $29, 4 ; 176: addiu $a1 $sp 4 # argv [0x ]0x24a60004 addiu $6, $5, 4 ; 177: addiu $a2 $a1 4 # envp [0x c]0x sll $2, $4, 2 ; 178: sll $v0 $a0 2 [0x ]0x00c23021 addu $6, $6, $2 ; 179: addu $a2 $a2 $v0 [0x ]0x0c jal 0x [main] ; 180: jal main [0x ]0x nop ; 181: nop [0x c]0x a ori $2, $0, 10 ; 183: li $v0 10 [0x ]0x c syscall ; 184: syscall# syscall(exit) KERNEL [0x ]0x0001d821 addu $27, $0, $1 ; 82: move $k1 $at [0x ]0x3c lui $1, ; 84: sw $v0 s1 [0x c]0x3c lui $1, ; 85: sw $a0 s2 [0x ]0xac sw $4, 516($1) [0x ]0x401a6800 mfc0 $26, $13 ; 87: mfc0 $k0 $13 [0x ]0x001a2082 srl $4, $26, 2 ; 88: srl $a0 $k0 2 [0x c]0x f andi $4, $4, 31 ; 89: andi $a0 $a0 0x1f [0x800001a0]0x ori $2, $0, 4 ; 93: li $v0 4# print_str [0x800001a4]0x3c lui $4, [__m1_]; 94: la $a0 __m1_ [0x800001a8]0x c syscall ; 95: syscall [0x800001ac]0x ori $2, $0, 1 ; 97: li $v0 1# print_int [0x800001b0]0x001a2082 srl $4, $26, 2 ; 98: srl $a0 $k0 2 [0x800001b4]0x f andi $4, $4, 31 ; 99: andi $a0 $a0 0x1f [0x800001b8]0x c syscall ; 100: syscall [0x800001bc]0x ori $2, $0, 4 ; 102: li $v0 4# print_str [0x800001c0]0x c andi $4, $26, 60 ; 103: andi $a0 $k0 0x3c [0x800001c4]0x3c lui $1, ; 104: lw $a0 __excp($a0) [0x800001c8]0x addu $1, $1, $4... addressmachine code Assembly code comment

Memory

DATA [0x ]...[0x ]0x STACK [0x7fffeffc] 0x KERNEL DATA [0x ] 0x x x206e6f69 0x636f2000 [0x ] 0x x x e 0x726f6e67 [0x ] 0x000a6465 0x495b2020 0x e 0x [0x ] 0x d 0x4c545b20 0x20005d42 0x4c545b20 [0x ] 0x20005d42 0x4c545b20 0x20005d42 0x64415b20 [0x ] 0x x x20726f72 0x69206e69 [0x ] 0x2f74736e 0x x x205d6863 [0x ] 0x5b x x x6f address content