Branch Addressing op rs rt address 4 1718 address beq $s1, $s2, Label if ($s1 = =$s2) go to Label 6 bits 5 bits 5 bits 16 bits effective 32 bit address.

Slides:



Advertisements
Similar presentations
Instruction Sets: Characteristics and Functions Addressing Modes
Advertisements

CPS3340 COMPUTER ARCHITECTURE Fall Semester, /15/2013 Lecture 11: MIPS-Conditional Instructions Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER.
10/9: Lecture Topics Starting a Program Exercise 3.2 from H+P Review of Assembly Language RISC vs. CISC.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 5 MIPS ISA & Assembly Language Programming.
MIPS Architecture CPSC 321 Computer Architecture Andreas Klappenecker.
Instruction Representation II (1) Fall 2007 Lecture 10: Instruction Representation II.
Our ultimate goal: building the datapath
Computer Architecture CPSC 321 E. J. Kim. Overview Logical Instructions Shifts.
Signed Numbers Up till now we've been concentrating on unsigned numbers. In real life we have to represent signed numbers ( like: -12, -45, 78). The difference.
1 Chapter 4: Arithmetic Where we've been: –Performance (seconds, cycles, instructions) –Abstractions: Instruction Set Architecture Assembly Language and.
Instruction Representation II (1) Fall 2005 Lecture 10: Instruction Representation II.
1  1998 Morgan Kaufmann Publishers Chapter Four Arithmetic for Computers.
Chapter 3 Arithmetic for Computers. Arithmetic Where we've been: Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's.
CS 300 – Lecture 6 Intro to Computer Architecture / Assembly Language Instructions.
Binary Representation. Binary Representation for Numbers Assume 4-bit numbers 5 as an integer  as an integer  How? 5.0 as a real number  How?
1  2004 Morgan Kaufmann Publishers Instructions: bne $t4,$t5,Label Next instruction is at Label if $t4≠$t5 beq $t4,$t5,Label Next instruction is at Label.
Lecture Objectives: 1)Define the terms least significant bit and most significant bit. 2)Explain how unsigned integer numbers are represented in memory.
Calculating Two’s Complement. The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of.
1  1998 Morgan Kaufmann Publishers Arithmetic Where we've been: –Performance (seconds, cycles, instructions) –Abstractions: Instruction Set Architecture.
Memory and Addressing How and Where Information is Stored.
1 (Based on text: David A. Patterson & John L. Hennessy, Computer Organization and Design: The Hardware/Software Interface, 3 rd Ed., Morgan Kaufmann,
Lecture 8. MIPS Instructions #3 – Branch Instructions #1 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education.
1. 2 Instructions: Words of the language understood by CPU Instruction set: CPU’s vocabulary Instruction Set Architecture (ISA): CPU’s vocabulary together.
Binary Adder DesignSpring Binary Adders. Binary Adder DesignSpring n-bit Addition –Ripple Carry Adder –Conditional Sum Adder –(Carry Lookahead.
Computer Architecture CSE 3322 Lecture 4 crystal.uta.edu/~jpatters/cse3322 Assignments due 9/15: 3.7, 3.9, 3.11.
Small constants are used quite frequently (50% of operands) e.g., A = A + 5; B = B + 1; C = C - 18; Solutions? Why not? put 'typical constants' in memory.
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
An Example Architecture. A Paper Computer - Woody Woody's characteristics Word size – 8 bits One word.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
1 ELEN 033 Lecture 4 Chapter 4 of Text (COD2E) Chapters 3 and 4 of Goodman and Miller book.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 COMS 161 Introduction to Computing Title: Computing Basics Date: September 8, 2004 Lecture Number: 7.
Representing Negative Numbers Noah Mendelsohn Tufts University Web: COMP 40: Machine.
In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative The same is true for binary numbers a computer.
1 Arithmetic Where we've been: –Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: –Implementing the Architecture.
Computer Organization 1 Data Representation Negative Integers.
9/23/2004Comp 120 Fall September Chapter 4 – Arithmetic and its implementation Assignments 5,6 and 7 posted to the class web page.
May 2, 2001System Architecture I1 Systems Architecture I (CS ) Lecture 11: Arithmetic for Computers * Jeremy R. Johnson May 2, 2001 *This lecture.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
1 CPTR 220 Computer Organization Computer Architecture Assembly Programming.
CS Computer Organization Numbers and Instructions Dr. Stephen P. Carl.
Lecture 17: 10/31/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
MIPS Assembly Language Programming
Access the Instruction from Memory
Based on slides from D. Patterson and www-inst.eecs.berkeley.edu/~cs152/ COM 249 – Computer Organization and Assembly Language Chapter 3 Arithmetic For.
Computer Architecture & Operations I
CSCI206 - Computer Organization & Programming
CS161 – Design and Architecture of Computer Systems
Morgan Kaufmann Publishers
COMP541 Datapaths I Montek Singh Mar 28, 2012.
MIPS Coding Continued.
MIPS Instructions.
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,
Computer Architecture & Operations I
CSCI206 - Computer Organization & Programming
Arithmetic Where we've been:
Addressing in Jumps jump j Label go to Label op address 2 address
Arithmetic Logical Unit
MIPS Instruction Encoding
MIPS Instruction Encoding
The University of Adelaide, School of Computer Science
A 1-Bit Arithmetic Logic Unit
COMP541 Datapaths I Montek Singh Mar 18, 2010.
The branch instruction
Review Fig 4.15 page 320 / Fig page 322
MIPS Coding Continued.
CS334: MIPS language _Mars simulator Lab 2_1
Lecture No.5.
Presentation transcript:

Branch Addressing op rs rt address address beq $s1, $s2, Label if ($s1 = =$s2) go to Label 6 bits 5 bits 5 bits 16 bits effective 32 bit address = ( PC + 4 ) + ( address * 4 ) Next Instruction address is the relative number of instructions This is PC-relative addressing address * 4 = address : 00

Addressing in Jumps op address 2address jump j Label go to Label 6 bits 26 bits The complete 32 bit address is : address 00 4 bits 26 bits 2 bits Upper 4 bits of the Program Counter, PC jump uses word addresses This is Pseudodirect Addressing. Note: 256 MB word boundaries – 64M Instructions address * 4 = address:00

Where we've been: –Performance (seconds, cycles, instructions) –Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: –Implementing the Architecture

Sign Magnitude : One's Two's Complement Complement 000 = = = = = = = = = = = = = = = = = = = = = = = = -1 Issues: balance, number of zeros, ease of operations Which one is best? Why? Possible Representations of Negative Numbers

Representing Numbers in Binary Consider n-1 bits n-1, n-2..., 3, 2, 1. ( bit n will be sign bit)

Representing Numbers in Binary Consider n-1 bits n-1, n-2..., 3, 2, 1. ( bit n will be sign bit) For positive numbers For negative numbers, use Two’s Complement, defined as

Representing Numbers in Binary For negative numbers, use Two’s Complement, defined as Two's Complement 000 = = = +2Binary 011 = = -48 – 4= = -38 – 3= = -28 – 2= = -18 – 1= 7111

Representing Numbers in Binary Consider n-1 bits n-1, n-2..., 3, 2, 1. ( bit n will be sign bit) For negative numbers, use Two’s Complement

Representing Numbers in Binary Consider n-1 bits n-1, n-2..., 3, 2, 1. ( bit n will be sign bit) For negative numbers, use Two’s Complement

Representing Numbers in Binary Consider n-1 bits n-1, n-2..., 3, 2, 1. ( bit n will be sign bit) For negative numbers, use Two’s Complement

Representing Numbers in Binary Consider n-1 bits n-1, n-2..., 3, 2, 1. ( bit n will be sign bit) For negative numbers, use Two’s Complement

Representing Numbers in Binary Consider n-1 bits n-1, n-2..., 3, 2, 1. ( bit n will be sign bit) For negative numbers, use Two’s Complement Two’s Complement can be formed by Complementing each bit and adding 1.

Representing Numbers in Binary Consider n-1 bits n-1, n-2..., 3, 2, 1. ( bit n will be sign bit) For negative numbers, use Two’s Complement What is the Two’s Complement of a Negative Number?

Representing Numbers in Binary Consider n-1 bits n-1, n-2..., 3, 2, 1. ( bit n will be sign bit) For negative numbers, use Two’s Complement What is the Two’s Complement of a Negative Number? 2 n – 2 n – c = 2 n – 2 n + c = c Since

Two’s Complement Addition For x > 0 and y < 0

Two’s Complement Addition For x > 0 and y < 0

Two’s Complement Addition For x > 0 and y < 0

Two’s Complement Addition For x > 0 and y < 0 For x < 0 and y < 0 Normal addition works!

For n = 6 : weights : 32, 16, 8, 4, 2, < numbers < = complement

For n = 6 : weights : 32, 16, 8, 4, 2, < numbers < = complement -25 =

For n = 6 : weights : 32, 16, 8, 4, 2, < numbers < = complement -25 = = = 64 – 25 = 39 6

For n = 6 : weights : 32, 16, 8, 4, 2, < numbers < = complement -25 = = = 64 – 25 = = complement -15 =

For n = 6 : weights : 32, 16, 8, 4, 2, < numbers < = complement -25 = = = 64 – 25 = = complement -15 = = 64 – 15 = 49 6

For n = 6 : weights 32, 16, 8, 4, 2, < numbers < = complement -25 = = = 64 – 25 = = complement -15 = = 64 – 15 =

For n = 6 : weights 32, 16, 8, 4, 2, < numbers < = complement -25 = = = 64 – 25 = = complement -15 = = 64 – 15 =

For n = 6 : weights 32, 16, 8, 4, 2, < numbers < = complement -25 = = = 64 – 25 = = complement -15 = = 64 – 15 =

For n = 6 : weights 32, 16, 8, 4, 2, < numbers < = complement -25 = = = 64 – 25 = = complement -15 = = 64 – 15 = (-15)

For n = 6 : weights 32, 16, 8, 4, 2, < numbers < = complement -25 = = = 64 – 25 = = complement -15 = = 64 – 15 = (-15) (-15)+(-14)

For n = 6 : weights 32, 16, 8, 4, 2, < numbers < = complement -25 = = = 64 – 25 = = complement -15 = = 64 – 15 = (-15) (-15)+(-14)

For n = 6 : weights 32, 16, 8, 4, 2, < numbers < = complement -25 = = = 64 – 25 = = complement -15 = = 64 – 15 = (-15) (-15)+(-14) (-25)+(-15) ???