Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Programming Model CS 333 Sam Houston State University Dr. Tim McGuire.

Slides:



Advertisements
Similar presentations
Machine cycle.
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.
1 Lecture 3: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation.
INSTRUCTION SET ARCHITECTURES
SPIM and MIPS programming
Instruction Set Architecture Classification According to the type of internal storage in a processor the basic types are Stack Accumulator General Purpose.
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /17/2013 Lecture 12: Procedures Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE CENTRAL.
1 Computer Architecture MIPS Simulator and Assembly language.
1 COMS 361 Computer Organization Title: Instructions Date: 9/28/2004 Lecture Number: 10.
Computer Organization and Architecture
Computer Organization. This module surveys the physical resources of a computer system. –Basic components CPUMemoryBus I/O devices –CPU structure Registers.
Instruction Set Architecture & Design
Intro to Computer Architecture
Computer Processing CSCE 110 J. Michael Moore.
S. Barua – CPSC 440 CHAPTER 2 INSTRUCTIONS: LANGUAGE OF THE COMPUTER Goals – To get familiar with.
Assembly Language for Intel-Based Computers Chapter 2: IA-32 Processor Architecture Kip Irvine.
ARM programmer’s model and assembler Embedded Systems Programming.
7/13/20151 Topic 3: Run-Time Environment Memory Model Activation Record Call Convention Storage Allocation Runtime Stack and Heap Garbage Collection.
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name of Unit : Introduction to Microprossor.
MIPS assembly. Computer What’s in a computer? Processor, memory, I/O devices (keyboard, mouse, LCD, video camera, speaker), disk, CD drive, …
Computer Organization Computer Organization & Assembly Language: Module 2.
MIPS coding. SPIM Some links can be found such as:
13/02/2009CA&O Lecture 04 by Engr. Umbreen Sabir Computer Architecture & Organization Instructions: Language of Computer Engr. Umbreen Sabir Computer Engineering.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Introduction: Exploiting Linux. Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend,
Operating Systems Lecture No. 2. Basic Elements  At a top level, a computer consists of a processor, memory and I/ O Components.  These components are.
CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface.
Execution of an instruction
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE Lecture 21 & 22 Processor Organization Register Organization Course Instructor: Engr. Aisha Danish.
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
What is a program? A sequence of steps
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.
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
Jump and Branch Instructions
Computer Organization Instructions Language of The Computer (MIPS) 2.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
BASIC COMPUTER ARCHITECTURE HOW COMPUTER SYSTEMS WORK.
Winter 2016CISC101 - Prof. McLeod1 Today Numeric representation (or “How does binary and hexadecimal work?”). How can a CPU understand instructions written.
Memory Access Instructions Load and Store Addressing Modes Memory Addressing. Base addressing mode. Load byte and store byte: lb, lbu, sb Address alignment.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
CS 312 Computer Architecture & Organization
Computer Organization and Architecture Lecture 1 : Introduction
Computers’ Basic Organization
Protection in Virtual Mode
A Closer Look at Instruction Set Architectures
Microprocessor and Assembly Language
Von Neumann model - Memory
Processor Organization and Architecture
Processor Organization and Architecture
ECEG-3202 Computer Architecture and Organization
Von Neumann model - Memory
ECEG-3202 Computer Architecture and Organization
Chapter 4: Representing instructions
Introduction to Microprocessor Programming
CPU Structure CPU must:
Basic components Instruction processing
Computer Operation 6/22/2019.
CS 286 Computer Architecture & Organization
Topic 2b ISA Support for High-Level Languages
Presentation transcript:

Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Programming Model CS 333 Sam Houston State University Dr. Tim McGuire

Copyright 2006 by Timothy J. McGuire, Ph.D. 2 A MIPS Programming Model This module presents a programming model for the MIPS processor. A programming model is an abstract view of a processor that is appropriate for programming but omits details that are not needed for that task. Topics:  Basic MIPS Programming model  Memory  Registers  Machine cycle  Control flow

Copyright 2006 by Timothy J. McGuire, Ph.D. 3 Memory Model  Modern computer systems nearly always use cache memory and virtual memory. But our abstract view of memory does not include them. Memory in the programming model is as follows:  DATA:  MIPS memory is an array of 2 32 bytes. Each byte has a 32-bit address. Each byte can hold an 8-bit pattern, one of the 256 possible 8-bit patterns. The addresses of MIPS main memory range from 0x to 0xFFFFFFFF.  However, user programs and data are restricted to the first 2 31 bytes. The last half of the address space is used for specialized purposes.

Copyright 2006 by Timothy J. McGuire, Ph.D. 4 Memory Layout  The parts of address space accessible to a user program are divided as follows:  Text Segment: This holds the machine language of the user program (the text).  Data Segment: This holds the data that the program operates on. Part of the data is static. This is data that is allocated by the assembler and whose size does not change as a program executes. Values in it do change; "static" means the size in bytes does not change during execution. On top of the static data is the dynamic data.  Stack Segment: At the top of user address space is the stack. With high level languages, local variables and parameters are pushed and popped on the stack as procedures are activated and deactivated.

Copyright 2006 by Timothy J. McGuire, Ph.D. 5 Registers  On the MIPS, a register holds 32 bits. There are many registers in the processor, but only some of them are visible in assembly language. The others are used by the processor in carrying out its operations.  The registers that are visible in assembly language are called general purpose registers and floating point registers. There are 32 general purpose registers. Each general purpose register holds a 32 bit pattern. In assembly language, these registers are named $0, $1, $2,..., $31. There are 16 floating point registers. These will be discussed later.  The general purpose register $0 is hard-wired to always contain the value 0x (all zero bits).

Copyright 2006 by Timothy J. McGuire, Ph.D. 6 Registers and the ALU  The arithmetic/logic unit (ALU) of a processor performs integer arithmetic and logical operations. One operand for the ALU is always contained in a register. The other operand may be in a register or may be part of the machine instruction itself. The result of the operation is put into a general purpose register.  Machine instructions that use the ALU specify four things:  The operation to perform.  The first operand (always in a register).  The second operand (often in a register).  The register that receives the result.  The picture shows a 32-bit addition operation. The operands are register $8 and register $9. The result in put in register $10. Here is how that instruction is written as assembly language: addu $10,$8,$9

Copyright 2006 by Timothy J. McGuire, Ph.D. 7 Register Use Conventions Register Number