MIPS Machine Assembly Language 2-7-2003. Opening Discussion zWhat did we talk about last class? zHave you seen anything interesting in the news? zDo you.

Slides:



Advertisements
Similar presentations
CENG 311 Decisions in C/Assembly Language
Advertisements

Goal: Write Programs in Assembly
4.
Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
Lecture 5: MIPS Instruction Set
MIPS assembly. Review  Lat lecture, we learnt  addi,  and, andi, or, ori, xor, xori, nor,  beq, j, bne  An array is stored sequentially in the memory.
Lecture 20: 11/12/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /15/2013 Lecture 11: MIPS-Conditional Instructions Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER.
Comp Sci Control structures 1 Ch. 5 Control Structures.
Chapter 2 — Instructions: Language of the Computer — 1 Branching Far Away If branch target is too far to encode with 16-bit offset, assembler rewrites.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 5: Data Transfer Instructions / Control Flow Instructions Partially adapted from Computer.
Computer Architecture CSCE 350
IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
Apr. 12, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 6: Branching and Procedures in MIPS* Jeremy R. Johnson Wed. Apr. 12, 2000.
Lecture 8: MIPS Instruction Set
The Little man computer
CS 61C L09 Introduction to MIPS: Data Transfer & Decisions I (1) Garcia, Fall 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS 536 Spring Code generation I Lecture 20.
ECE 232 L5 Assembl.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 5 MIPS Assembly.
Data Transfer & Decisions I (1) Fall 2005 Lecture 3: MIPS Assembly language Decisions I.
CS61C L09 Introduction to MIPS : Data Transfer and Decisions (1) Garcia, Spring 2007 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
MIPS Instruction Set Advantages
Lecture 8. MIPS Instructions #3 – Branch Instructions #1 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education.
Lecture 15: 10/24/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
MIPS coding. slt, slti slt $t3, $t1, $t2 – set $t3 to be 1 if $t1 < $t2 ; else clear $t3 to be 0. – “Set Less Than.” slti $t3, $t1, 100 – set $t3 to be.
1 Branches and Procedure Calls Lecture 14 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
11/02/2009CA&O Lecture 03 by Engr. Umbreen Sabir Computer Architecture & Organization Instructions: Language of Computer Engr. Umbreen Sabir Computer Engineering.
Chapter 10 The Assembly Process. What Assemblers Do Translates assembly language into machine code. Assigns addresses to all symbolic labels (variables.
Do-while and for Loops Opening Discussion zWhat did we talk about last class? zAt the end of last class I asked you to write a loop that would.
Keywords and Functions That is Different Copyright © by Curt Hill.
17 - Jumps & Branches. The PC PC marks next location in Fetch, Decode, Execute cycle.
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.
Java Basics Opening Discussion zWhat did we talk about last class? zWhat are the basic constructs in the programming languages you are familiar.
Chapter 2 Decision-Making Instructions (Instructions: Language of the Computer Part V)
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
9/29: Lecture Topics Conditional branch instructions
Computer Organization CS224 Fall 2012 Lessons 7 and 8.
MIPS coding. slt, slti slt $t3, $t1, $t2 – set $t3 to be 1 if $t1 < $t2 ; else clear $t3 to be 0. – “Set Less Than.” slti $t3, $t1, 100 – set $t3 to be.
Conditionals Opening Discussion zWhat did we talk about last class? zDo you have any questions about the assignment? zPass by value limitations.
More Inheritance and More Java Stuff Opening Discussion zWhat did we talk about last class? zHave you read the description of assignment #2?
Computer Organization Instructions Language of The Computer (MIPS) 2.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 11 Conditional Operations.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Computer Architecture & Operations I
The Little man computer
MIPS Assembly Language Programming
CSCI206 - Computer Organization & Programming
MIPS Instruction Set Advantages
Computer Architecture & Operations I
Decision Making.
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Conditional Branches What distinguishes a computer from a simple calculator is its ability to make decisions Decisions are made using the if statement,
Assembly Programming using MIPS R3000 CPU
Instructions for Making Decisions
The University of Adelaide, School of Computer Science
Pick up the handout on your way in!!
CSCI206 - Computer Organization & Programming
Assembler Directives Example program: .data # DATA segment city: .asciiz “Seattle” .align 2 num: .word 2210, 2341, 26, 0x022ec,
MIPS coding.
The University of Adelaide, School of Computer Science
3.
COMS 361 Computer Organization
Systems Architecture I
Assembly Programming using MIPS R3000 CPU
MIPS assembly.
Computer Architecture
CSE 410, Spring 2008 Computer Systems
9/27: Lecture Topics Memory Data transfer instructions
MIPS instructions.
Conditional Branching (beq)
Presentation transcript:

MIPS Machine Assembly Language

Opening Discussion zWhat did we talk about last class? zHave you seen anything interesting in the news? zDo you have any questions about the graded quizzes?

Powers of 2 Loop zLast class I asked you to write assembly for a loop that basically calculates powers of two. LoopTop: add $s1, $s1, $s1 sub $t0, $t0, 1 beq $t0, $zero, LoopTop

Jump Statements zIn addition to the conditional branch statements beq and bne, there are non- conditional jumps. zj label # always jumps to the given label. zjr register # always jumps to the address for that register. zThese are helpful when the flow can’t just be linear.

Basic Blocks zThis is a term that you see any time you are talking about program analysis with any language. These are blocks of code that always execute sequentially from top to bottom. zThey have no entry points in the middle and any branches or jumps are at the end.

Building Conditionals zMIPS compilers build all of their conditions out of beq, bne, and slt with the help of the fixed register $zero. zObviously we can check for equality, in equality, and less than. Greater than just causes us to reverse the order of the arguments from less than. zWho can we get something like less than or equal to?

Different Control Structures in MIPS Assembly zLet’s take a look at how we build each of the different control structures we would use in C/C++ in MIPS assembly. zif/else zdo/while zwhile

Introduction to SPIM zNow let’s take a quick look at the xspim program and try to write and run the Fibonacci numbers program.

Minute Essay zWrite assembly language to do the following C++ code. You can assume that some registers are attached to variables. zDon’t leave without turning in assignment #2. int a=0; for(int j=6; j>0; j++) { a+=j; }