PROF. JOHN ABRAHAM UTRGV

Slides:



Advertisements
Similar presentations
Catch up on previous topics Summary and putting together first four classes.
Advertisements

Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
P3- Represent how data flows around a computer system
MIPS Assembly Language CPSC 321 Computer Architecture Andreas Klappenecker.
5Z032 Processor Design SPIM, a MIPS simulator Henk Corporaal
Chapter 2 Machine Language.
SPIM and MIPS programming
Fall EE 333 Lillevik 333f06-l4 University of Portland School of Engineering Computer Organization Lecture 4 Assembly language programming ALU and.
CSE 340 Computer Architecture Spring 2014 MIPS ISA Review
Syscall in MIPS Xinhui Hu Yuan Wang.
MIPS Function Continued
MIPS Assembly Language Programming
Assembly Language Working with the CPU.
ECE 0142 Recitation #5.
RISC Concepts, MIPS ISA and the Mini–MIPS project
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
1 COMP541 Completing the MIPS Datapath Montek Singh Mar 27, 2007.
Lecture 5: Procedures. Function call book-keeping in C main() { int i,j,k,m;... i = mult(j,k);... m = mult(i,i);... } /* really dumb mult function */
Memory and Addressing How and Where Information is Stored.
Procedure Basics Computer Organization I 1 October 2009 © McQuain, Feng & Ribbens Procedure Support From previous study of high-level languages,
R3000/001 Assembly Programming using MIPS R3000 CPU R3000 CPU Chip Manufactured by IDT What is MIPS R3000 Processor? A 32-bit RISC CPU developed by MIPS.
Ch2b- 2 EE/CS/CPE Computer Organization  Seattle Pacific University Thanks for all the Memory! When 32 registers just won’t do. Many times (almost.
Lecture 10: MIPS Simulator Today’s topic –SPIM Simulator Readings –Appendix B 1.
Lecture 161 Lets examine a SPIM program in detail. io.asm This program is a simple routine which demonstrates input/output using assembly code. SPIM.
Computer Organization Rabie A. Ramadan Lecture 3.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
MIPS Architecture Topics –What resources MIPS assembly manipulates –CPU (Central Processing Unit) –ALU (Arithmetic & Logical Unit), Registers –Memory –I/O.
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
Lecture 2: Instruction Set Architecture part 1 (Introduction) Mehran Rezaei.
MIPS Processor.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Instruction Set Architectures Continued. Expanding Opcodes & Instructions.
MIPS Architecture Topics –What resources MIPS assembly manipulates –CPU (Central Processing Unit) –ALU (Arithmetic & Logical Unit), Registers –Memory –I/O.
CS 312 Computer Architecture & Organization
System Calls & Arithmetic
MIPS Instruction Set Advantages
Example Addiu $t1 $r0 3 Addiu $t1 $t1 5 Addiu $t1 $t1 7.
MIPS I/O and Interrupt.
MIPS Coding Continued.
Lecture 4: MIPS Instruction Set
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
MIPS I/O and Interrupt.
Assembly Programming using MIPS R3000 CPU
MIPS I/O and Interrupt.
Instructions - Type and Format
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
CSCE Fall 2013 Prof. Jennifer L. Welch.
MIPS Processor.
ECE232: Hardware Organization and Design
Instruction encoding The ISA defines Format = Encoding
MIPS coding.
Review.
MIPS Assembly.
Компьютерийн зохион байгуулалт, ассемблер CS201
CS334: Memory _ Mars simulator Lab 4(part2-2)
CSCE Fall 2012 Prof. Jennifer L. Welch.
3.
Instruction encoding The ISA defines Format = Encoding
Instruction encoding The ISA defines Format = Encoding
MIPS I/O and Interrupt.
COMS 361 Computer Organization
Assembly Programming using MIPS R3000 CPU
Instruction encoding The ISA defines Format = Encoding
MIPS Coding Continued.
CPU Structure CPU must:
MIPS Assembly Language Programming Computer Architecture
CS334: MIPS language _Mars simulator Lab 2_1
CS 286 Computer Architecture & Organization
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
MIPS Processor.
Presentation transcript:

PROF. JOHN ABRAHAM UTRGV MIPS - RISC PROF. JOHN ABRAHAM UTRGV Prof. John Abraham UTRGV

Prof. John Abraham UTRGV MARS SIMULATOR FIRST MAKE SURE YOU HAVE JAVA JDK, IF NOT DOWNLOAD AND INSTALL DOWNLOAD MARS MIPS SIMULATOR FROM MISSOURI STATE UNIVERSITY http://courses.missouristate.edu/kenvollmar/mars/ Prof. John Abraham UTRGV

Prof. John Abraham UTRGV MIPS CODE C=A+B .data #data used in this program A: .word 40 # set aside RAM memory for A and place 40 in it B: .word 30 # set aside RAM memory for B and place 30 in it C: .word 0 # set aside RAM memory for C and place 0 in it .text #code for this program lw $t0, A #load A from memory into a CPU register t0 lw $t1, B #load AB from memory into a CPU register t1 add $t2, $t0, $t1 #add a and b sw $t2,C # Store the result from the CPU register to memory #display results a0-a3 and v0,v2 used with functions li $v0, 1 #1 to display following integer(4 to display text) move $a0, $t2 syscall Prof. John Abraham UTRGV

Prof. John Abraham UTRGV

Prof. John Abraham UTRGV

Prof. John Abraham UTRGV How to use SYSCALL system services Step 1. Load the service number in register $v0. Step 2. Load argument values, if any, in $a0, $a1, $a2, or $f12 as specified. Step 3. Issue the SYSCALL instruction. Step 4. Retrieve return values, if any, from result registers as specified. Prof. John Abraham UTRGV

Expanded program receiving input and sending output. Slide 1 .data outText: .asciiz "MIPS for C=A+B.\n Total stored in C is: " A: .word 0 B: .word 0 C: .word 0 prompt1: .asciiz "Enter the number to store in A: " prompt2: .asciiz "\Enter the number to store in B: “ Prof. John Abraham UTRGV

Prof. John Abraham UTRGV Slide 2 .text   li $v0,4 #get ready to display the message la $a0,prompt1 syscall #displays the first prompt #read the first number and save it in A li $v0,5 #5 to read integer syscall sw $v0, A lw $t1,A #also put it in t1 for calculation Prof. John Abraham UTRGV

Prof. John Abraham UTRGV Slide 3 li $v0,4 #get ready to display the message 4 to display text la $a0,prompt2 syscall #displays the second prompt #read the second number and save it in B li $v0,5 #5 to read integer syscall sw $v0, B #put input into memory location B and in register t2 lw $t2, B #by the way faster to move between registers. This is to show you how to bring from ram add $t3,$t2,$t1 sw $t3, C #store contents of t3 in C Prof. John Abraham UTRGV

Prof. John Abraham UTRGV Slide 4 #display results li $v0,4 la $a0, outText syscall li $v0,1 move $a0,$t3 Prof. John Abraham UTRGV

Prof. John Abraham UTRGV MIPS ISA MIPS WORD IS 32 BITS, so registers can hold 4 bytes. 0 to 31 registers, PC (incremented by 4), HI and LO Ex Rformat instruction: add $t0,$s1, $s2 (computation) Ex I format instruction: lw $t0, B (load store branch) memory can be given as register and offset like 24($s2) Ex J format unconditional jump Some registers are special like r0 holds only 0, can’t be changed Instructional formats: R format, I format and j format Prof. John Abraham UTRGV