CPS3340 Computer Architecture Fall Semester, 2013

Slides:



Advertisements
Similar presentations
Combinational Circuits
Advertisements

Intro to CS – Honors I Representing Numbers GEORGIOS PORTOKALIDIS
ELEC353 S. al Zahir UBC Sign-Magnitude Representation High order bit is sign: 0 = positive (or zero), 1 = negative Low order bits represent the magnitude:
Addition of two binary numbers = = = = 39.
ECE 331 – Digital System Design
Cpe 252: Computer Organization1 Lo’ai Tawalbeh Lecture #2 Standard combinational modules: decoders, encoders and Multiplexers 1/3/2005.
King Fahd University of Petroleum and Minerals
CS 151 Digital Systems Design Lecture 3 More Number Systems.
ECE C03 Lecture 61 Lecture 6 Arithmetic Logic Circuits Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
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)
Signed Numbers CS208. Signed Numbers Until now we've been concentrating on unsigned numbers. In real life we also need to be able represent signed numbers.
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
Prof. Hakim Weatherspoon CS 3410, Spring 2015 Computer Science Cornell University See: P&H Chapter 2.4, 3.2, B.2, B.5, B.6.
CS 105 Digital Logic Design
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
Number Representations and Computer Arithmetic. CS 21a 9/23/02 Odds and Ends Slide 2 © Luis F. G. Sarmenta and John Paul Vergara, Ateneo de Manila University.
1 CHAPTER 4: PART I ARITHMETIC FOR COMPUTERS. 2 The MIPS ALU We’ll be working with the MIPS instruction set architecture –similar to other architectures.
CS 1308 – Computer Literacy and the Internet. It’s Not Magic  The goal of the next series of lectures is to show you exactly how a computer works. 
Basic Arithmetic (adding and subtracting)
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /14/2013 Lecture 16: Floating Point Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
Topic: Arithmetic Circuits Course: Digital Systems Slide no. 1 Chapter # 5: Arithmetic Circuits.
07/19/2005 Arithmetic / Logic Unit – ALU Design Presentation F CSE : Introduction to Computer Architecture Slides by Gojko Babić.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
CPS120: Introduction to Computer Science Computer Math: Signed Numbers.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
CSE 241 Computer Organization Lecture # 9 Ch. 4 Computer Arithmetic Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
Basic Arithmetic (adding and subtracting)
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.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /10/2013 Lecture 5: Combinational Logic Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /19/2013 Lecture 7: 32-bit ALU, Fast Carry Lookahead Instructor: Ashraf Yaseen DEPARTMENT OF MATH &
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Logic and Computer Design.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /05/2013 Lecture 4: Basics of Logic Design Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER.
1 Arithmetic Logic Unit ALU. 2 The Bus Concept 3 CPU Building Blocks  Registers (IR, PC, ACC)  Control Unit (CU)  Arithmetic Logic Unit (ALU)
Arithmetic Logic Unit (ALU) Anna Kurek CS 147 Spring 2008.
Logic Design CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
CS 1308 – Computer Literacy and the Internet Building the CPU.
Outline Binary Addition 2’s complement Binary Subtraction Half Adder
Appendix C Basics of Digital Logic Part I. Florida A & M University - Department of Computer and Information Sciences Modern Computer Digital electronics.
Addition, Subtraction, Logic Operations and ALU Design
1 Fundamentals of Computer Science Combinational Circuits.
Integers’ Representation. Binary Addition. Two's Complement. Unsigned number representation Binary Addition, Subtraction. Overflow of unsigned numbers.
Number Representation and Arithmetic Circuits
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.
Lecture #23: Arithmetic Circuits-1 Arithmetic Circuits (Part I) Randy H. Katz University of California, Berkeley Fall 2005.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
MicroProcessors Lec. 4 Dr. Tamer Samy Gaafar. Course Web Page —
9/23/2004Comp 120 Fall September Chapter 4 – Arithmetic and its implementation Assignments 5,6 and 7 posted to the class web page.
EE204 L03-ALUHina Anwar Khan EE204 Computer Architecture Lecture 03- ALU.
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.
Arithmetic Circuits I. 2 Iterative Combinational Circuits Like a hierachy, except functional blocks per bit.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
Negative Number Sign-Magnitude: left-most bit as the sign bit –16 bits –Example: 4-bit numbers is given by is given by ’s complement:
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Computer Architecture & Operations I
Computer Architecture & Operations I
Computer Organization and ASSEMBLY LANGUAGE
MIPS ALU.
King Fahd University of Petroleum and Minerals
Numbers and Arithmetic
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
COMS 361 Computer Organization
CSC 220: Computer Organization Signed Number Representation
Presentation transcript:

CPS3340 Computer Architecture Fall Semester, 2013 Lecture 6: Binary Addition & Subtraction, 1-bit ALU Instructor: Ashraf Yaseen Department of Math & Computer Science Central State University, Wilberforce, OH 09/17/2013

Review Last Class This Class Next Class Integrated Circuits Decoder, Multiplexor PLA, ROM Don’t Care, Bus This Class Assignemnt2 Representation of Integer Addition & Subtraction 1-bit ALU Next Class Quiz2 32-bit ALU

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 26 April, 2017 Integer Addition §3.2 Addition and Subtraction Example: 7 + 6 00000000 00000000 00000000 00000111 + 00000000 00000000 00000000 00000110 00000000 00000000 00000000 00001101 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

Arithmetic Logic Unit Arithmetic Logic Unit (ALU) Heart of a CPU Operations Arithmetic operations Addition Subtraction Logical operations NOT AND OR

1-bit Logical Unit for AND and OR

1-bit adder

1-bit adder truth table can express the output functions Carry Out and Sum as logical equations, and these equations can in turn be implemented with logic gates

Simplifying 1-bit adder If a and b and CarryIn are true, then the three other terms are true as well can be simplified as Values when CarryOut is true

Logic of CarryOut Bit

Logic of Sum Bit

Overall 1-bit ALU

Summary Bit, Byte, Word Binary Representation of Integer Addition Subtraction Overflow 1-bit ALU

What I want you to do Review Appendix C and Class Slides Work on Assignment 2 Prepare for Quiz 2