Computer Architecture & Operations I

Slides:



Advertisements
Similar presentations
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Advertisements

COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
Lecture 5.
Topic: Arithmetic Circuits Course: Digital Systems Slide no. 1 Chapter # 5: Arithmetic Circuits.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
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.
Number Representation
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Chapter 4 Integer Data Representation. Unsigned Integers.
CPS3340 Computer Architecture Fall Semester, 2013
1 COMS 161 Introduction to Computing Title: Computing Basics Date: September 8, 2004 Lecture Number: 7.
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.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
1 Integer Representations V1.0 (22/10/2005). 2 Integer Representations  Unsigned integer  Signed integer  Sign and magnitude  Complements  One’s.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
973cs111_add_posneg.ppt Integers Whole numbers Do NOT contain decimal points (as in money) 43,689 is an integer 43, is NOT an integer (it is floating.
Lecture 4: Digital Systems & Binary Numbers (4)
Representing Positive and Negative Numbers
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Computer Representation of Information
Floating Point Representations
Department of Computer Science Georgia State University
Design of Digital Circuits Reading: Binary Numbers
David Kauchak CS 52 – Spring 2017
Computer Architecture & Operations I
Addition and Subtraction
ECE 2110: Introduction to Digital Systems
Lec 3: Data Representation
Negative Integers Unsigned binary representation can not be used to represent negative numbers. With paper and pencil arithmetic, a number is made negative.
CHAPTER 9 COMPUTER ARITHMETIC - ALU
Negative Binary Numbers
Integers’ Representation. Binary Addition. Two's Complement.
Number Representation
Computer Architecture & Operations I
Computer Architecture & Operations I
Computer Science 210 Computer Organization
Data Representation in Computer Systems
CSCI206 - Computer Organization & Programming
Computer Architecture & Operations I
Negative Binary Numbers
Computer Architecture & Operations I
Binary Addition & Subtraction
ECE 2110: Introduction to Digital Systems
Wakerly Section 2.4 and further
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 6
Computer Science 210 Computer Organization
The University of Adelaide, School of Computer Science
CSCI206 - Computer Organization & Programming
Data Representation in Computer Systems
Computer Architecture & Operations I
Subtraction The arithmetic we did so far was limited to unsigned (positive) integers. Today we’ll consider negative numbers and subtraction. The main problem.
CS/COE0447 Computer Organization & Assembly Language
ECE 3110: Introduction to Digital Systems
CS/COE0447 Computer Organization & Assembly Language
Decimal and binary representation systems
Number Systems Rayat Shikshan Sanstha’s
Number Systems Rayat Shikshan Sanstha’s
ECE 331 – Digital System Design
CSC 220: Computer Organization Signed Number Representation
Negative Bit Representation Outline
Lecture No.5.
COMS 361 Computer Organization
Fundamentals of Digital Logic and Number Systems
OBJECTIVES After reading this chapter, the reader should be able to :
Two’s Complement & Binary Arithmetic
Presentation transcript:

Computer Architecture & Operations I Instructor: Yaohang Li

Review Last Class This Class Next Class Integrated Circuits Decoder Multiplexor PLA ROM Don’t Care Bus This Class Representation of Integer Addition Subtraction Next Class Design of ALU Assignment 2

Bit, Byte, and Word 1 Bit – 0 or 1 1 Byte – 8 bits 1 Word – N bytes (in general) 4 bytes in a word (in our book)

Most Significant Bit and Least Significant Bit Most Significant Bit (High-Order Bit) The bit position having the greatest value Usually the left-most bit Least Significant Bit (Low-Order Bit) The bit position having the smallest value Usually the right-most bit

Binary Representation of Decimal Number Using a binary number to represent a decimal number Example What is the maximum number a byte can represent? Binary  1 Decimal  1×210 + 0×29 + 0×28 + 1×27 + 0×26 + 1×25 + 0×24 + 1×23 + 1×22 + 0×21 + 1×20 = 1197

Binary Representation of Integers Unsigned Integers 0 and positive integers only Signed Integers 0, negative, and positive integers Three ways Sign-Magnitude 1’s Complement 2’s Complement

Unsigned Integers Unsigned Integers Example Consider a word = 4 bytes Can represent numbers from 0 to 4294967295 Decimal: 0 to 232-1 Binary: 0 to 11111111111111111111111111111111 Example 671210 = 00000000 00000000 00011010 001110002

Signed Integer – Sign Magnitude Use the most significant bit of the word to represent the sign 0 – Positive 1 – Negative Rest of the number is encoded in magnitude part Example 671210 = 00000000 00000000 00011010 001110002 -671210 = 10000000 00000000 00011010 001110002 Two representations of 0 0 = 00000000 00000000 00000000 00000000 -0 = 10000000 00000000 00000000 00000000 Cumbersome in Arithmetic

1’s Complement 1’s Complement Negative number is stored as bit-wise complement of corresponding positive number Use the most significant bit of the word to represent the sign 0 – Positive 1 – Negative Example 671210 = 00000000 00000000 00011010 001110002 -671210 = 11111111 11111111 11100101 110001112 Still two representations of zero 0 = 00000000 00000000 00000000 00000000 -0 = 11111111 11111111 11111111 11111111

2’s Complement 2’s Complement Positive number represented in the same way as sign-magnitude and 1’s complement Negative number obtained by taking 1’s complement of positive number and adding 1 671210 = 00000000 00000000 00011010 001110002 1’s comp: -671210 = 11111111 11111111 11100101 110001112 2’s comp: -671210 = 11111111 11111111 11100101 110010002 One version of 0 Convenient in arithmetic

Morgan Kaufmann Publishers 17 April, 2018 Integer Addition Example: 7 + 6 00000000 00000000 00000000 00000111 + 00000000 00000000 00000000 00000110 00000000 00000000 00000000 00001101 §3.2 Addition and Subtraction Chapter 3 — Arithmetic for Computers

Integer Subtraction Subtraction is actually an addition Example: 7 – 6 = 7 + (-6) 2’s complement 00000000 00000000 00000000 00000111 - 11111111 11111111 11111111 11111010 00000000 00000000 00000000 00000001

Overflow Overflow if result out of range Adding +value and –value operands, no overflow Adding two +value operands Overflow if result sign is 1 Adding two –value operands Overflow if result sign is 0

Summary Bit, Byte, Word Binary Representation of Integer Addition Subtraction Overflow

What I want you to do Review Appendix B