Ch 3: Computer Arithmetic

Slides:



Advertisements
Similar presentations
B261 Systems Architecture
Advertisements

Morgan Kaufmann Publishers Arithmetic for Computers
Chapter 3 Arithmetic for Computers. Chapter 3 — Arithmetic for Computers — 2 Arithmetic for Computers Operations on integers Addition and subtraction.
CS/ECE 3330 Computer Architecture Chapter 3 Arithmetic.
Chapter 3 Arithmetic for Computers. Exam 1 CSCE
CSCE 212 Chapter 3: Arithmetic for Computers Instructor: Jason D. Bakos.
Arithmetic & Logic Unit Does the calculations Everything else in the computer is there to service this unit Handles integers May handle floating point.
Arithmetic CPSC 321 Computer Architecture Andreas Klappenecker.
Lecture 9 Sept 28 Chapter 3 Arithmetic for Computers.
1  2004 Morgan Kaufmann Publishers Chapter Three.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 6: Logic/Shift Instructions Partially adapted from Computer Organization and Design, 4.
1  1998 Morgan Kaufmann Publishers Chapter Four Arithmetic for Computers.
Lecture Objectives: 1)Explain the relationship between addition and subtraction with twos complement numbering systems 2)Explain the concept of numeric.
Lecture 12: Computer Arithmetic Today’s topic –Numerical representations –Addition / Subtraction –Multiplication / Division 1.
Arithmetic for Computers
1 CS/COE0447 Computer Organization & Assembly Language Chapter 3.
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.
Computing Systems Basic arithmetic for computers.
Computer Engineering AddSub page 1 Basic Building Blocks Multiplexer + Demultiplexer Adder.
CSF 2009 Arithmetic for Computers Chapter 3. Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing.
CS Data representation 1 Ch. 2.1 Data Representation Unsigned and Signed Integers – representation, addition, subtraction.
Chapter 3 Arithmetic for Computers (Integers). Florida A & M University - Department of Computer and Information Sciences Arithmetic for Computers Operations.
Chapter 3 Arithmetic for Computers. Chapter 3 — Arithmetic for Computers — 2 Arithmetic for Computers Operations on integers Addition and subtraction.
CHAPTER 3 Arithmetic For Computers 1/31/ Topics for discussion 1/31/ Number system: { radix/base, a set of distinct digits, operations} Radix.
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
순천향대학교 정보기술공학부 이 상 정 1 3. Arithmetic for Computers.
Lec 11Systems Architecture1 Systems Architecture Lecture 11: Arithmetic for Computers Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some or all.
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.
By Wannarat Computer System Design Lecture 3 Wannarat Suntiamorntut.
Exceptions and Interrupts “Unexpected” events requiring change in flow of control – Different ISAs use the terms differently Exception – Arises within.
Based on slides from D. Patterson and www-inst.eecs.berkeley.edu/~cs152/ COM 249 – Computer Organization and Assembly Language Chapter 3 Arithmetic For.
Arithmetic for Computers Chapter 3 1. Arithmetic for Computers  Operations on integers  Addition and subtraction  Multiplication and division  Dealing.
Computer System Design Lecture 3
Morgan Kaufmann Publishers Arithmetic for Computers
Computer Architecture & Operations I
ALU Architecture and ISA Extensions
Computer Architecture & Operations I
Computer Organization CS224
Handling Exceptions In MIPS, exceptions managed by a System Control Coprocessor (CP0) Save PC of offending (or interrupted) instruction In MIPS: Exception.
Morgan Kaufmann Publishers Arithmetic for Computers
Computer Architecture & Operations I
Morgan Kaufmann Publishers Arithmetic for Computers
Morgan Kaufmann Publishers
Morgan Kaufmann Publishers
Morgan Kaufmann Publishers Arithmetic for Computers
Computer Architecture & Operations I
Morgan Kaufmann Publishers
/ Computer Architecture and Design
Morgan Kaufmann Publishers
Procedures (Functions)
The processor: Exceptions and Interrupts
CS352H: Computer Systems Architecture
CSCE 212 Chapter 5 The Processor: Datapath and Control
The processor: Pipelining and Branching
Arithmetic Logical Unit
Topic 3a Two’s Complement Representation
The University of Adelaide, School of Computer Science
MIPS History MIPS is a computer family
CS/COE0447 Computer Organization & Assembly Language
CS/COE0447 Computer Organization & Assembly Language
MIPS History MIPS is a computer family
MIPS Microarchitecture Multicycle Processor
A 1-Bit Arithmetic Logic Unit
Basic Building Blocks Multiplexer Demultiplexer Adder +
Basic Building Blocks Multiplexer Demultiplexer Adder +
ECE 445 – Computer Organization
Morgan Kaufmann Publishers Arithmetic for Computers
MIPS History MIPS is a computer family
COMS 361 Computer Organization
Presentation transcript:

Ch 3: Computer Arithmetic Morgan Kaufmann Publishers September 9, 2018 Ch 3: Computer Arithmetic Instructor: Robert Utterback Lecture 27 Chapter 1 — Computer Abstractions and Technology

Arithmetic for Computers Morgan Kaufmann Publishers 9 September, 2018 Arithmetic for Computers §3.1 Introduction Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation and operations Chapter 3 — Arithmetic for Computers — 2 Chapter 3 — Arithmetic for Computers

Morgan Kaufmann Publishers 9 September, 2018 Integer Addition Example: 7 + 6 §3.2 Addition and Subtraction Overflow if result out of range Adding +ve and –ve operands, no overflow Adding two +ve operands Overflow if result sign is 1 Adding two –ve operands Overflow if result sign is 0 When do we know if we had overflow? Chapter 3 — Arithmetic for Computers — 3 Chapter 3 — Arithmetic for Computers

Morgan Kaufmann Publishers 9 September, 2018 Integer Subtraction Add negation of second operand Example: 7 – 6 = 7 + (–6) +7: 0000 0000 … 0000 0111 –6: 1111 1111 … 1111 1010 +1: 0000 0000 … 0000 0001 Overflow if result out of range Subtracting two +ve or two –ve operands, no overflow Subtracting +ve from –ve operand Overflow if result sign is 0 Subtracting –ve from +ve operand Overflow if result sign is 1 Chapter 3 — Arithmetic for Computers — 4 Chapter 3 — Arithmetic for Computers

Morgan Kaufmann Publishers 9 September, 2018 Dealing with Overflow Some languages (e.g., C) ignore overflow Use MIPS addu, addui, subu instructions Other languages (e.g., Ada, Fortran) require raising an exception Use MIPS add, addi, sub instructions On overflow, invoke exception handler Save PC in exception program counter (EPC) register Jump to predefined handler address mfc0 (move from coprocessor reg) instruction can retrieve EPC value, to return after corrective action By the way, depends on the language to utilize these…C does not! Not the only way to handle overflow… Chapter 3 — Arithmetic for Computers — 5 Chapter 3 — Arithmetic for Computers

Arithmetic for Multimedia Morgan Kaufmann Publishers 9 September, 2018 Arithmetic for Multimedia Saturating operations On overflow, result is largest representable value c.f. 2s-complement modulo arithmetic E.g., clipping in audio, saturation in video Chapter 3 — Arithmetic for Computers — 6 Chapter 3 — Arithmetic for Computers