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

Slides:



Advertisements
Similar presentations
King Fahd University of Petroleum and Minerals King Fahd University of Petroleum and Minerals Computer Engineering Department Computer Engineering Department.
Advertisements

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.
Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
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.
MIPS Assembly Language Programming
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.
Execution of an instruction
MIPS Assembly Language I Computer Architecture CPSC 321 Andreas Klappenecker.
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
Stack Stack Pointer A stack is a means of storing data that works on a ‘Last in first out’ (LIFO) basis. It reverses the order that data arrives and is.
Memory and Addressing How and Where Information is Stored.
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
Operand Addressing –No instruction for reg-to-reg transfer –Cannot do memory-memory transfers with single instruction –sw instruction violates (dest, source)
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 10: MIPS Simulator Today’s topic –SPIM Simulator Readings –Appendix B 1.
Computer Architecture Lecture 03 Fasih ur Rehman.
Carnegie Mellon 1 Machine-Level Programming I: Basics Lecture, Feb. 21, 2013 These slides are from website which accompanies the.
Dale & Lewis Chapter 5 Computing components
Computer Organization Rabie A. Ramadan Lecture 3.
MIPS Architecture Topics –What resources MIPS assembly manipulates –CPU (Central Processing Unit) –ALU (Arithmetic & Logical Unit), Registers –Memory –I/O.
Computer Organization Instructions Language of The Computer (MIPS) 2.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Intro Assembly Computer Organization I 1 June 2010 © McQuain, Feng & Ribbens MIPS Hello World # Program: Hello, World!.data # data declaration.
CS 312 Computer Architecture & Organization
Computers’ Basic Organization
Assembly language.
MIPS Assembly Language Programming
Computer Architecture Instruction Set Architecture
MIPS Instruction Set Advantages
IA32 Processors Evolutionary Design
Computer Science 210 Computer Organization
Computer Architecture Instruction Set Architecture
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
Processor Organization and Architecture
The LC-3 Instruction Set Architecture Data Movement instructions
MIPS Assembly.
Number Representations and Basic Processor Architecture
Instructions - Type and Format
Computer Science 210 Computer Organization
These are slides from Comp411
ECE232: Hardware Organization and Design
Instruction encoding The ISA defines Format = Encoding
MIPS Assembly.
Computer Instructions
Instruction encoding The ISA defines Format = Encoding
Instruction encoding The ISA defines Format = Encoding
CPU has 6 special locations called registers
Instruction Set Principles
COMS 361 Computer Organization
Assembly Programming using MIPS R3000 CPU
Instruction encoding The ISA defines Format = Encoding
MIPS e pipelining Tecniche di base.
Machine-Level Programming II: Basics Comp 21000: Introduction to Computer Organization & Systems Instructor: John Barr * Modified slides from the book.
Generalities for Assembly Language
Computer Architecture Assembly Language
Computer Operation 6/22/2019.
CS 286 Computer Architecture & Organization
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 (Microprocessor without Interlocked Pipeline Stages) CPU

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

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

Resources Memory Address: 32-bit Data: 32-bit Min. data unit: 8-bit Registers – 32 registers – Temporary data memory ALU – operators

Operations on Resources Memory Store Retrieve Registers – Store – Retrieve ALU – Arithmetic/logical operators

Operations on Resources Memory Storesw reg, D(reg) Retrievelw reg, D(reg) (indirect, indexed) Registers – Storeli reg, literal (immdiate) la reg, addr move reg1, reg2 (or reg1, reg2, $0) – Retrieve ALU – operators

Data Transfer X = A[1] (load word) Compute Effective Address (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

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

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

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

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

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)

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

.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

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