Addition : 101 +111 _________________ Binary Numbers (contd)

Slides:



Advertisements
Similar presentations
EET 1131 Unit 7 Arithmetic Operations and Circuits
Advertisements

Number Bases Informatics INFO I101 February 9, 2004 John C. Paolillo, Instructor.
CMSC 150 DATA REPRESENTATION CS 150: Mon 30 Jan 2012.
Number Representation and Logic Design CS 3220 Fall 2014 Hadi Esmaeilzadeh Georgia Institute of Technology Some slides adopted from.
EE1A2 Microprocessor Systems & Digital Logic Part I Digital Electronic System Design Dr. T. Collins.
COMP3221: Microprocessors and Embedded Systems--Lecture 1 1 COMP3221: Microprocessors and Embedded Systems Lecture 3: Number Systems (I)
Administrivia Assignments Labs Questions?? Class questions – –Goes to dpd and the TA’s Hand in lab assignments.
Binary Representation
Administrivia New students? No class Thursday 9/27 Lab Problem Set Favorite browser and why Favorite search engine and why Questions??
Review Two’s complement
CS 61C L02 Number Representation (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C.
Chapter 10-Arithmetic-logic units
Review: Our Friend the Logic Puzzle
CISC1400: Binary Numbers & Computer Fall 2011, Dr. Zhang 1.
Mantıksal Tasarım – BBM231 M. Önder Efe
 Arithmetic circuit  Addition  Subtraction  Division  Multiplication.
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
Binary Numbers. Why Binary? Maximal distinction among values  minimal corruption from noise Imagine taking the same physical attribute of a circuit,
Based on: Companion to Data Communications: From Basics to Broadband, Third Edition by William J. Beyda © 2000 Prentice Hall, Inc. All Rights Reserved.
1 CS 502: Computing Methods for Digital Libraries Lecture 4 Text.
Binary Numbers.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 3.
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Today’s Topics How information.
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers citation and following credit line is included:
Logic and Digital System Design - CS 303
ELE22MIC Lecture 3 Paul Main’s Office Location has moved to Pysical Sciences 2 Room 107 Will be available for 2 hours consultation 10am - 12am after Tuesday.
CS1Q Computer Systems Lecture 9 Simon Gay. Lecture 9CS1Q Computer Systems - Simon Gay2 Addition We want to be able to do arithmetic on computers and therefore.
Binary Arithmetic & Data representation
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
Digital Arithmetic and Arithmetic Circuits
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Binary Numbers. Why Binary? Maximal distinction among values  minimal corruption from noise Imagine taking the same physical attribute of a circuit,
Lecture 9 Topics: –Combinational circuits Basic concepts Examples of typical combinational circuits –Half-adder –Full-adder –Ripple-Carry adder –Decoder.
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.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Data Representation Conversion 24/04/2017.
Half Adder & Full Adder Patrick Marshall. Intro Adding binary digits Half adder Full adder Parallel adder (ripple carry) Arithmetic overflow.
IT253: Computer Organization
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
Number Systems Denary Base 10 Binary Base 2 Hexadecimal Base 16
Outline Binary Addition 2’s complement Binary Subtraction Half Adder
Arithmetic-logic units1 An arithmetic-logic unit, or ALU, performs many different arithmetic and logic operations. The ALU is the “heart” of a processor—you.
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits
Unit - 3 NUMBER SYSTEM AND CODES
Addition and multiplication Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
BINARY SYSTEMS ENGR. KASHIF SHAHZAD 1. BINARY NUMBERS 1/2 Internally, information in digital systems is of binary form groups of bits (i.e. binary numbers)
09/06/ Data Representation ASCII, Binary Denary Conversion, Integer & Boolean data types.
Explain Half Adder and Full Adder with Truth Table.
Addition and multiplication1 Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
Binary Representation in Text
Binary Representation in Text
3 – Boolean Logic and Logic Gates 4 – Binary Numbers
Chapter 3 - Binary Numbering System
Combinational Circuits
2's Complement Arithmetic
University of Gujrat Department of Computer Science
Summary Half-Adder Basic rules of binary addition are performed by a half adder, which has two binary inputs (A and B) and two binary outputs (Carry out.
Number Systems Decimal (base 10) { }
Data Representation Conversion 05/12/2018.
Basic Communication Concepts
CS/COE0447 Computer Organization & Assembly Language
CS/COE0447 Computer Organization & Assembly Language
Binary Numbers.
COMS 361 Computer Organization
Logic Circuits I Lecture 3.
Addition and multiplication
ECE 352 Digital System Fundamentals
CMSC250 Fall 2018 Circuits 1 1.
Combinational Circuits
Presentation transcript:

Addition : _________________ Binary Numbers (contd)

Addition – Our “basic” addition table is really easy now: = = = = 10 What about ? = 11 Binary Numbers (contd)

Addition – just like usual: _______________ = = = = = 11 Binary Numbers (contd)

Addition – just like usual: _______________ 0 Binary Numbers (contd) = = = = = 11

Addition – just like usual: _______________0 Binary Numbers (contd) = = = = = 11

Addition – just like usual: _______________ 1100 Binary Numbers (contd) = = = = = 11

Can also do: Subtraction, Multiplication, etc Negative Numbers Fractions Great, but where do Logic Circuits fit in? Binary Numbers (contd)

And you thought we were done with truth tables X Y Z Problem: Output can be 2 bits sometimes Binary Numbers (contd) For Addition on small numbers, can make a truth table:

Addition Truth Table with Multiple Outputs: X Y AB Binary Numbers (contd)

But we know how to deal with multiple outputs: Now we can convert into 2 circuits! X Y A X Y B Binary Numbers (contd)

X Y B OR B AND X Y X Y A X Y X Y A Binary Numbers (contd)

X Y B OR B AND X Y X Y This is often called the eXclusive OR (XOR) circuit We say that B is the exclusive OR of X and Y. We write B = X Y. Binary Numbers (contd)

Bob will go to the party if Ed goes OR Dan goes. Dan will go if Xena does NOT go AND Yanni goes. Ed will go if Xena goes AND Yanni does NOT go. Turns out this is addition without the carry Bob goes if the XOR of Xena and Yanni go. A Logic Puzzle

We can represent information by bits. (So we interpret bits to mean things like numbers.) Then we re-interpret those bits as Logical True/False values and construct truth tables for operations on information (e.g. addition) Finally we use Universal Method to construct circuits for these operations A Simple Breakthrough

Intermission Questions?? How do we actually build a circuit for addition?

X1X2Y1Y2Z1Z2C X1 X2 Y1 Y2 ========= C Z1 Z2 C is the carry bit Addition

X1X2Y1Y2Z1Z2C X1 X2 Y1 Y2 ========= C Z1 Z2 C is the carry bit Could have 3 circuits (for Z1, Z2, C) 16 inputs each 2 w/ 8 ANDs, 1 OR 1 w/ 6 ANDs, 1 OR 18+7 = 25 gates Addition

X1 X2 Y1 Y2 ========= C Z1 Z2 Rewrite as X2X1 Y2Y1 ====C2 C2 Z2 ======== C Z1 Simplifying the Addition Circuit

X2 Y2 ==== C2 Z2 X1 Y1 C2 ==== C Z1 2 circuits (C2, Z2) 4 gates X1Y1C2CZ circuits (C, Z1) 10 gates Addition

Z2 C2 X1 Y1 Circuit For Z1 and carry Circuit For Z2 and carry Z1 Carry X2 Y2 Addition Can be cascaded for adding longer numbers We can use 2 building blocks to add numbers of any length.

Adding Binary Numbers of Any Length Actually we need only 1 building block lowest-bit circuit also has 3 inputs, but carry in is always 0 ith bit of X ith bit of Y carry bit in ith bit of Z carry bit out Abstraction in action -- This is a piece of a carry-ripple adder

Adding Binary Numbers of Any Length Write the numbers as –X4 X3 X2 X1 X0 –Y4 Y3 Y2 Y1 Y0 Represent the sum as –C Z4 Z3 Z2 Z1 Z0

Adding Binary Numbers of Any Length Write the numbers as –X4 X3 X2 X1 X0 –Y4 Y3 Y2 Y1 Y0 Represent the sum as –C Z4 Z3 Z2 Z1 Z0 Start with X0, Y0, 0 in, Z0 and C0 out Then X1,Y1,C0 in and Z1 and C1 out. And so on

Adding Binary Numbers of Any Length At the ith stage ith bit of X ith bit of Y carry bit in ith bit of Z carry bit out Abstraction in action -- This is a piece of a carry-ripple adder Addition Circuit

Adding Binary Numbers of Any Length At each stage, take 2 addends and a bit telling whether there is a carry in, and produce a sum bit and a bit telling if there is a carry out We can build a ‘black box’ to do this (abstraction) addend carry bit in Sum bit carry bit out

Carry-Ripple Adder Z0 C0 Black Box Circuit X0 Y0 Z1 C1 Black Box Circuit X1 Y1 Z2 C2 Black Box Circuit X2 Y2 X2 X1 X0 Y2 Y1 Y0 ============ C2 Z2 Z1 Z0 0 Fixed at 0

What’s inside the box? Zi Cout Black Box Circuit Xi Yi Cin

What’s inside the box? Zi Cout Universal Circuit Xi Yi Cin Abstraction in Action: Use Truth Tables and the Universal Method

Carry ripple adders Useful for some applications Too slow for other –Delay while waiting for the carry to ripple One solution – add larger blocks –Details in the homework assignment

Arithmetic Logical Unit (ALU) This is the part of the CPU that does arithmetic, logical and comparison operations We’ve built a piece of the ALU Using abstraction, we could build the other parts –Multiplication/subtraction/division –Comparison Then we would write a language to let the user talk to the ALU (programming)

Pause Questions?? Back to representing information

Representing information How do we represent characters? –How many characters might we want to represent? –What characters might we want to represent?

Representing information How do we represent characters? –How many characters might we want to represent? –What characters might we want to represent? A-Z 26 A-Z and a-z 52 All the keys on my keyboard 104 Maybe use a power of 2? 128 Maybe use an even power of 2? 256 Maybe an even bigger power of 2?65536

Representing characters ASCII is the American Standard Code for Information Interchange. It is a 7-bit code. Many 8-bit codes contain ASCII as the lower half of their range of values The ASCII standard was published by the United States of America Standards Institute (USASI) in 1968 There are other character coding standards: EBCDIC, and more recently Unicode

Unicode Universal Character Set (UCS) contains all characters of all other character set standards. It also guarantees round-trip compatibility, i.e., conversion tables can be built such that no information is lost when a string is converted from any other encoding to UCS and back. UCS contains the characters required to represent almost all known languages. In addition to the many languages which use extensions of the Latin script, this also includes the following scripts and languages: Greek, Cyrillic, Hebrew, Arabic, Armenian, Gregorian, Japanese, Chinese, Hiragana, Katakana, Korean, Hangul, Devangari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayam, Thai, Lao, Bopomofo, and a number of others. Work is going on to include further scripts like Tibetian, Khmer, Runic, Ethiopian, Hieroglyphics, various Indo-European languages, and many others. It uses 31 bits (32768 possible characters)

What do we do in practice? Problems –Bits represent too little information – too many are needed –Decimal numbers don’t translate well into hardware So … –Group into blocks of 4 and 8 bits 8 bits = 256 characters, holds ASCII 8 bits make 1 byte – things are organized into bytes 4 bits make 1 nibble Hexadecimal numbers use 1 nibble per slot or ‘hex digit’ –Digits go from 0-9 and then A-F, for 16 possible values

ABCDEF89ABCDEF Shorthand: Hexadecimal DecHexBinary

Hexadecimal We can add hex numbers –1+1=2, 2+2=4, 4+4=8, 4+8=C, 2+8=A, … We can combine 2 hexadecimal numbers to make a byte (2C) Hex is easier to read than binary –Decimal 22 is 16 in hex (1* *16 0 ) rather than in binary In ASCII –Hex 41 through 5A represent A to Z –Hex 61 through 7A represent a to z

Summary Logic gates and the Universal Method Binary representation of numbers and arithmetic Universal method can lead to very big circuits Solve by reducing to smaller circuits Demonstrated with cascading smaller circuits –Carry-ripple adder Represented characters –Hexadecimal –Bytes, nibbles

Now that we can represent it, how do we store it?? Next Time: Memory