MIPS Architecture Topics –What resources MIPS assembly manipulates –CPU (Central Processing Unit) –ALU (Arithmetic & Logical Unit), Registers –Memory –I/O.

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

Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
MIPS Assembly Language CPSC 321 Computer Architecture Andreas Klappenecker.
1 Procedure Calls, Linking & Launching Applications Lecture 15 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
10/9: Lecture Topics Starting a Program Exercise 3.2 from H+P Review of Assembly Language RISC vs. CISC.
SPARC Architecture & Assembly Language
ELEN 468 Advanced Logic Design
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.
Syscall in MIPS Xinhui Hu Yuan Wang.
Csci136 Computer Architecture II Lab#4. - Stack and Nested Procedures
MIPS Assembly Language Programming
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.
ECE 0142 Recitation #5.
Computer Organization. This module surveys the physical resources of a computer system. –Basic components CPUMemoryBus I/O devices –CPU structure Registers.
Chap.2: Instructions: Language of the computer Jen-Chang Liu, Spring 2006 Adapted from
Execution of an instruction
MIPS Assembly Language I Computer Architecture CPSC 321 Andreas Klappenecker.
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
RISC Concepts, MIPS ISA and the Mini–MIPS project
Computer Organization Computer Organization & Assembly Language: Module 2.
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
Memory and Addressing How and Where Information is Stored.
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
Registers and MAL Lecture 12. The MAL Architecture MAL is a load/store architecture. MAL supports only those addressing modes supported by the MIPS RISC.
Operand Addressing –No instruction for reg-to-reg transfer –Cannot do memory-memory transfers with single instruction –sw instruction violates (dest, source)
1. 2 Instructions: Words of the language understood by CPU Instruction set: CPU’s vocabulary Instruction Set Architecture (ISA): CPU’s vocabulary together.
Procedure Basics Computer Organization I 1 October 2009 © McQuain, Feng & Ribbens Procedure Support From previous study of high-level languages,
Execution of an instruction
Lecture 4: MIPS Instruction Set
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.
Computer Architecture CSE 3322 Lecture 2 NO CLASS MON Sept 1 Course WEB SITE crystal.uta.edu/~jpatters.
Lecture 10: MIPS Simulator Today’s topic –SPIM Simulator Readings –Appendix B 1.
Computer Architecture Lecture 03 Fasih ur Rehman.
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
Carnegie Mellon 1 Machine-Level Programming I: Basics Lecture, Feb. 21, 2013 These slides are from website which accompanies the.
Computer Organization Rabie A. Ramadan Lecture 3.
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
Lecture 2: Instruction Set Architecture part 1 (Introduction) Mehran Rezaei.
Computer Organization Instructions Language of The Computer (MIPS) 2.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Memory Access Instructions Load and Store Addressing Modes Memory Addressing. Base addressing mode. Load byte and store byte: lb, lbu, sb Address alignment.
Intro Assembly Computer Organization I 1 June 2010 © McQuain, Feng & Ribbens MIPS Hello World # Program: Hello, World!.data # data declaration.
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
MIPS Assembly Language Programming
Computer Architecture Instruction Set Architecture
IA32 Processors Evolutionary Design
Lecture 4: MIPS Instruction Set
ELEN 468 Advanced Logic Design
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Microcomputer Programming
Assembly Programming using MIPS R3000 CPU
Instructions - Type and Format
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
ECE232: Hardware Organization and Design
Instruction encoding The ISA defines Format = Encoding
MIPS Assembly.
Computer Instructions
Instruction encoding The ISA defines Format = Encoding
Instruction Set Principles
COMS 361 Computer Organization
Review Fig 4.15 page 320 / Fig page 322
Assembly Programming using MIPS R3000 CPU
MIPS e pipelining Tecniche di base.
CS 286 Computer Architecture & Organization
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
PROF. JOHN ABRAHAM UTRGV
Presentation transcript:

MIPS Architecture Topics –What resources MIPS assembly manipulates –CPU (Central Processing Unit) –ALU (Arithmetic & Logical Unit), Registers –Memory –I/O –How are resources being manipulated Data transfer Arithmetic Operations I/O

MIPS Architecture CPU

Data Transfer X = A[1] (load word) Compute (address of A + index offset in bytes) Transfer the effective address to Memory Address Register (MAR) Read memory into Memory Data Register (MDR) Transfer to CPU register A[1] = X (store word) Transfer register to MDR Computer effective address to MAR Write

Arithmetic Operation X =X+Y Transfer X, Y (in registers) to ALU (Arithmetic & Logic Unit) Add Transfer the sum to a register

Assembly Programmer’s View Programmer-Visible State –Program Counter (PC) Address of next instruction –Location Counter (LOC) –Register File Heavily used program data –Condition Codes Store status information about most recent arithmetic operation Used for conditional branching Memory Object Code Program Data OS Data Addresses Data Instructions Stack – Memory Byte addressable array (organized in words) Code, user data, (some) OS data Includes stack PC Registers CPU Condition Codes

Assembly Instruction label: instruction operand {,operand} #comments label – a place holder: address Instruction – operation to perform Operand – data or target of the operation Register Literal constant Memory address

Registers bit Registers –Zero: always 0, and cannot be modified –$t0 -- $t9: General purpose –$a0 -- $a3: General purpose (arguments) –$s0 -- $s7: General purpose –$v0, $v1: General purpose –$sp: stack pointer –$ra: return address

Data Transfer From the viewpoint of registers Moving Data lw Dest, Source: – Move 4-byte (“long”) word – Constant or from memory address – To Dest register Operand Types – Immediate: Constant integer data 0xff for hex constant Otherwise, decimal – Memory: 4 consecutive bytes of memory Various “address modes” – Register: One of 32 integer registers

Operand Addressing –No instruction for reg-to-reg transfer –Cannot do memory-memory transfers with single instruction –sw instruction violates (dest, source) spec of operands Imm Reg Mem Reg Mem Reg SourceDestination li $t1, 0x4 la $t1, A sw $t1,A($t2) lw $t1,A($t2) C Analog temp = 0x4; temp2 = &A; A[n] = temp; temp = A[n]; Addr

I/O Instructions ServiceCall code ($v0) Arguments (input)Results print integer 1$a0 = integersigned decimal integer printed in console window print string4$a0 = address of stringstring printed in console window Read integer 5(none)$v0 holds integer that was entered Read string8$a0=address to store $a1= length limit characters are stored exit10(none)Ends the program – tml

.data prompt:.asciiz“Enter an integer to square:\n“ # message area.text main:# printf(“Enter an integer to square: \n”); la $a0, prompt # get the address of the message to $a0 li $v0, 4 # read to display the message syscall # scanf(“%d”, x); li $v0, 5 # read an integer into $v0 syscall mul$a0, $v0, $v0 # squared input value, save in $a0 # printf(“%4d”, (x*x)); li $v0, 1 # print the squared value syscall printf(“Enter an integer to square: \n”); scanf(“%d”, x); printf(“%4d”, (x*x)); Square an input Number

Directives (Establish initial data structure).ascii (store string in memory with no null-termination).asciiz (store string in memory with null termination).byte b1,..,bn.word w1,..,wn.word w:n (store w into n successive words).space n.datadata segment.textassembly instructions Directives

MIPS instructions r.htmlhttp:// r.html MIPS Reading MARS MIPS simulator Resources

Operand Addressing –No instruction for reg-to-reg transfer –Cannot do memory-memory transfers with single instruction –sw instruction violates (dest, source) spec of operands Imm Reg Mem Reg Mem Reg SourceDestination li $t1, 0x4 la $t1, A sw $t1,A($t2) lw $t1,A($t2) C Analog temp = 0x4; temp2 = &A; A[n] = temp; temp = A[n]; Addr

Addressing Modes Indirect(R) Mem[Reg[R]] – Register R specifies memory address lw $t1, ($t2) IndexedD(R) Mem[Reg[R]+D] – Register R specifies start of memory block – Constant displacement D specifies offset lw $t1, 8($t2)

.data array:.word0x37, 0x55, 0xF.text la $s0, array la$s1, array+4 la$s2, 8($s0) li$a0, 4 lw$t0, 0($s0) lw$t3, array($a0) lw$t1, 8($s0) lb$t2, ($s0) Example