CS170 Computer Organization and Architecture I

Slides:



Advertisements
Similar presentations
MIPS Assembly Tutorial
Advertisements

Lecture 13: 10/8/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Goal: Write Programs in Assembly
Lecture 5: MIPS Instruction Set
1 ECE462/562 ISA and Datapath Review Ali Akoglu. 2 Instruction Set Architecture A very important abstraction –interface between hardware and low-level.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /15/2013 Lecture 11: MIPS-Conditional Instructions Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER.
1 ECE369 ECE369 Chapter 2. 2 ECE369 Instruction Set Architecture A very important abstraction –interface between hardware and low-level software –standardizes.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 5 MIPS ISA & Assembly Language Programming.
ELEN 468 Advanced Logic Design
Chapter 2 Instructions: Language of the Computer
Chapter 2 Instructions: Language of the Computer Part III.
1 Warning! Unlike the previous lessons, for today's lesson you will have to listen, think and even understand (for the exam, of course). Individuals with.
1 Lecture 2: MIPS Instruction Set Today’s topic:  MIPS instructions Reminder: sign up for the mailing list cs3810 Reminder: set up your CADE accounts.
The Processor 2 Andreas Klappenecker CPSC321 Computer Architecture.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
ECE 232 L5 Assembl.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 5 MIPS Assembly.
CS 300 – Lecture 6 Intro to Computer Architecture / Assembly Language Instructions.
Lecture 15: 10/24/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
11/02/2009CA&O Lecture 03 by Engr. Umbreen Sabir Computer Architecture & Organization Instructions: Language of Computer Engr. Umbreen Sabir Computer Engineering.
April 23, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 9: Assemblers, Linkers, and Loaders * Jeremy R. Johnson Mon. April 23,
Computer Organization and Architecture Instructions: Language of the Machine Hennessy Patterson 2/E chapter 3. Notes are available with photocopier 24.
Computer Architecture CSE 3322 Lecture 2 NO CLASS MON Sept 1 Course WEB SITE crystal.uta.edu/~jpatters.
IFT 201: Unit 1 Lecture 1.3: Processor Architecture-3
Computer Organization & Programming Chapter 6 Single Datapath CPU Architecture.
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.
MS108 Computer System I Lecture 3 ISA Prof. Xiaoyao Liang 2015/3/13 1.
Computer Organization CS224 Fall 2012 Lessons 7 and 8.
Computer Organization Rabie A. Ramadan Lecture 3.
EET 4250 Instruction Representation & Formats Acknowledgements: Some slides and lecture notes for this course adapted from Prof. Mary Jane Penn.
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.
Lecture 17: 10/31/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Computer Architecture Instruction Set Architecture
MIPS Instruction Set Advantages
CS2100 Computer Organisation
COMPUTER ARCHITECTURE & OPERATIONS I
Instruction Set Architecture
Morgan Kaufmann Publishers
MIPS Coding Continued.
Lecture 4: MIPS Instruction Set
ELEN 468 Advanced Logic Design
Computer Architecture & Operations I
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Processor Architecture: Introduction to RISC Datapath (MIPS and Nios II) CSCE 230.
Computer Architecture (CS 207 D) Instruction Set Architecture ISA
Computer Architecture & Operations I
The University of Adelaide, School of Computer Science
Instructions - Type and Format
Lecture 4: MIPS Instruction Set
CS170 Computer Organization and Architecture I
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
The University of Adelaide, School of Computer Science
Systems Architecture Lecture 5: MIPS Instruction Set
CSCI206 - Computer Organization & Programming
MIPS Instruction Encoding
Datapath & Control MIPS
The University of Adelaide, School of Computer Science
ECE232: Hardware Organization and Design
September 24 Test 1 review More programming
MIPS Instruction Encoding
The University of Adelaide, School of Computer Science
COMS 361 Computer Organization
Computer Architecture
3.
COMS 361 Computer Organization
COMS 361 Computer Organization
COMS 361 Computer Organization
MIPS Coding Continued.
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
Presentation transcript:

CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture 14: 10/22/2002 Lecture 14: 10/22/2002 CS170 Fall 2002

Outline Representing Instructions in the Computer Conditional and unconditional branches Should cover sections 3.4, part of 3.5 Lecture 14: 10/22/2002 CS170 Fall 2002

Instructions in the Computer Map register names into numbers $to to $t7 map to 8  15 (in decimal) $s0 to $s7 map to 16  23 (in decimal) Instruction add $t0, $s1, $s2 What is the machine language in decimal? 17 18 8 32 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits Each segment is a field First and last field (0, 32): imply add (lookup back cover of book for complete codes) Second field (17): first source operand ($s1) Third field (18): second source operand ($s2) Fourth field (8): destination operand ($t0) Fifth field (0): unused Layout of instruction is called instruction format All MIPS instructions are 32 bits long (simplicity favors regularity) Lecture 14: 10/22/2002 CS170 Fall 2002

MIPS Fields1/2 op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits op: operation code rs: first register source operand rt: second register source operand rd: register destination operand shamt: shift amount (will not use it within chapter 3) funct: Function. Selects specific variant of operation How many operations? How many functions within an operation? How about lw or sw instructions? (2 registers and an address) Lecture 14: 10/22/2002 CS170 Fall 2002

MIPS Fields2/2 Different kinds of instructions formats for different kinds of instructions Previous format is R-type (register-type) or R-format I-type used by Data transfer instructions op rs rt address 6 bits 5 bits 5 bits 16 bits rt changes to mean destination register Implication of 16 bit address field? Offset restricted to 215 =  32,768 bytes lw $t0, 32 ($s3) What is machine language in decimal? 35 19 8 32 6 bits 5 bits 5 bits 16 bits Lecture 14: 10/22/2002 CS170 Fall 2002

MIPS machine language and instruction formats COPYRIGHT 1998 MORGAN KAUFMANN PUBLISHERS, INC. ALL RIGHTS RESERVED Back cover of Textbook MIPS machine language and instruction formats Lecture 14: 10/22/2002 CS170 Fall 2002

MIPS operands and assembly language COPYRIGHT 1998 MORGAN KAUFMANN PUBLISHERS, INC. ALL RIGHTS RESERVED Back cover of Textbook MIPS operands and assembly language Starting on page A-49 Lecture 14: 10/22/2002 CS170 Fall 2002

From High-level to Machine Language A[300] = h + A[300]; Assume $t1 has the base of the array A, and $s2 corresponds to h Assembly lw $t0, 1200 ($t1) # $t0  A[300] add $t0, $s2, $t0 # $t0  h + A[300] sw $t0, 1200 ($t1) # A[300]  h + A[300] Machine code in decimal address op rs rt rd shamt funct 35 9 8 1200 0 18 8 8 0 32 43 9 8 1200 Lecture 14: 10/22/2002 CS170 Fall 2002

What we know so far Fig. 3.6 page 121 Lecture 14: 10/22/2002 COPYRIGHT 1998 MORGAN KAUFMANN PUBLISHERS, INC. ALL RIGHTS RESERVED Lecture 14: 10/22/2002 CS170 Fall 2002

Stored-Program Concept Two key principles Instructions are represented as numbers Programs can be stored in memory to be read or written just like numbers Stored-Program concept COPYRIGHT 1998 MORGAN KAUFMANN PUBLISHERS, INC. ALL RIGHTS RESERVED Lecture 14: 10/22/2002 CS170 Fall 2002

Decision Making: Branches Decision making: if statement, sometimes combined with goto and labels beq register1, register2, L1 (beq: Branch if equal) Go to the statement labeled L1 if the value in register1 equals the value in register2 bne register1, register2, L1 (bne: Branch if not equal) Go to the statement labeled L1 if the value in register1 does not equal the value in register2 beq and bne are termed Conditional branches What instruction format is beq and bne? Lecture 14: 10/22/2002 CS170 Fall 2002

Compiling an If statement If (i == j) go to L1; f = g + h; L1: f = f-i; f, g, h, i, and j correspond to five registers $s0 through $s4. beq $s3, $s4, L1 #go to L1 if i equals j add $s0, $s1, $s2 # f = g+h (skipped if i equals j) L1: sub $s0, $s0, $s3 # f = f –i (always executed) Instructions must have memory addresses Label L1 corresponds to address of sub instruction Lecture 14: 10/22/2002 CS170 Fall 2002

Compiling an if-then-else if (i == j) f = g + h; else f = g-h; Same variable/register mapping as previous example COPYRIGHT 1998 MORGAN KAUFMANN PUBLISHERS, INC. ALL RIGHTS RESERVED i == j? f = g+h f = g-h Else: Exit: Yes No bne $s3, $s4, Else # go to Else if i != j add $s0, $s1, $s2 # f = g + h (skipped if i != j) j Exit # go to Exit (unconditional branch) Else: sub $s0, $s1, $s2 # f = g-h (skipped if i equals j) Exit: Lecture 14: 10/22/2002 CS170 Fall 2002