CEC 220 Digital Circuit Design Binary Codes

Slides:



Advertisements
Similar presentations
DAT2343 Summary of Standard Data Encoding © Alan T. Pinck / Algonquin College; 2003.
Advertisements

1 CSE1301 Computer Programming Lecture 29: Number Representation (Part 1)
ECE 331 – Digital System Design
2.3 Binary Codes for Decimal Numbers ReturnNext Code: A set of n-bit strings in which different bit strings represent different numbers or other things.
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
Quiz 1.1 Convert the following unsigned binary numbers to their decimal equivalent: Number2 Number
Number System and Codes
1 Binary Numbers Again Recall that N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to bits.
Floating Point Numbers.  Floating point numbers are real numbers.  In Java, this just means any numbers that aren’t integers (whole numbers)  For example…
Lecture 8 Floating point format
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
1.6 Signed Binary Numbers.
Binary Representation and Computer Arithmetic
Introduction to Computing Systems from bits & gates to C & beyond Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation.
© Janice Regan, CMPT 128, Jan CMPT 128: Introduction to Computing Science for Engineering Students Integer Data representation Addition and Multiplication.
Simple Data Type Representation and conversion of numbers
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Information Representation: Negative and Floating Point.
Computer Architecture
Binary Arithmetic & Data representation
Data Representation and Computer Arithmetic
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Lecture 1 Binary Representation Topics Terminology Base 10, Hex, binary Fractions Base-r to decimal Unsigned Integers Signed magnitude Two’s complement.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 20, 2004 Lecture Number: 23.
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Number Systems ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
BR 8/99 Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to 255.
1 Lecture 2  Complement  Floating Point Number  Character Encoding.
Integer & Floating Point Representations CDA 3101 Discussion Session 05.
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
ECE 301 – Digital Electronics Representation of Negative Numbers, Binary Arithmetic of Negative Numbers, and Binary Codes (Lecture #11) The slides included.
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Slide 1 of 14.
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Fri, Aug 28 CEC 220 Digital Circuit Design Slide 1 of 14.
DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck.
CEC 220 Digital Circuit Design
1 COMS 161 Introduction to Computing Title: Computing Basics Date: September 8, 2004 Lecture Number: 7.
Lecture 2 Number Representation, Overflow and Logic Topics Adders Math Behind Excess-3 Overflow Unsigned, signed-magnitude Two’s Complement Gray Code Boolean.
CEC 220 Digital Circuit Design Binary Codes Mon, Aug 31 CEC 220 Digital Circuit Design Slide 1 of 14.
ECE 3110: Introduction to Digital Systems Number Systems: signed numbers.
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
COMPUTER ARITHMETIC Binary Coded Decimal Presented By Chung Wai Chow.
Lecture 4: Digital Systems & Binary Numbers (4)
Unit I From Fundamentals of Logic Design by Roth and Kinney.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Floating Point Arithmetic – Part I
Floating Point Numbers
Department of Computer Science Georgia State University
Fundamentals of Computer Science
Computer Science 210 Computer Organization
Signed binary numbers & Binary Codes
Introduction To Computer Science
ECE 2110: Introduction to Digital Systems
Data Structures Mohammed Thajeel To the second year students
Topic 3d Representation of Real Numbers
Chapter 2 Bits, Data Types & Operations Integer Representation
BCD = Binary Coded Decimal
Computer Science 210 Computer Organization
COMS 161 Introduction to Computing
CS 101 – Sept. 4 Number representation Integer Unsigned √ Signed √
COMS 161 Introduction to Computing
ECE 331 – Digital System Design
COMS 161 Introduction to Computing
Topic 3d Representation of Real Numbers
Chapter 1 Introduction.
Presentation transcript:

CEC 220 Digital Circuit Design Binary Codes Wednesday, January 14 CEC 220 Digital Circuit Design

CEC 220 Digital Circuit Design Lecture Outline Binary Arithmetic Review Extending Numeric Precision Binary coded decimal Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Binary Arithmetic Review The following Binary pattern represents what signed number? Given that the representation is sign and magnitude? Given that the representation is 1’s complement? Given that the representation is 2’s complement? What is the difference between carry out and overflow? How do we convert 143.25 to base 6 ? 10110 10110 = - 6 10110 = - 9 10110 = - 10 Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Extending Precision How do we increase the number of bits used to represent (in 2’s comp) a given number? We don’t want to change the numeric value!! Simply sign extend the number i.e. replicate the sign bit again & again … Example: 0011 1010 becomes 00000011 = +3 (in four bits) = +3 (in eight bits) becomes 11111010 = -6 (in four bits) = -6 (in eight bits) Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Increasing Precision Range of Integers (2’s complement representation) An 8-bit unsigned integer? A 16-bit unsigned integer? A 32-bit unsigned integer? An 8-bit signed integer? A 16-bit signed integer? A 32-bit signed integer? 0 to (2n -1) = 0 to 25510 0 to (2n -1) = 0 to 65,53510 0 to (2n -1) = 0 to 4,294,967,29510 -(2n-1) to (2n-1 -1) = -12810 to 12710 -(2n-1) to (2n-1 -1) = -32,76810 to 32,76710 -(2n-1) to (2n-1 -1) = -2,147,483,64810 to 2,147,483,64710 Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Increasing Precision Representation of Floating Point Numbers Example of the IEEE 754 standard Single precision 32 bit floating point format For this example: Sign = 0, hence, a positive number Exponent = 124, hence, Fraction = 1.0100…02= 1+0x2-1+1x2-2+0x2-3+… = 1.2510 Hence, the number is +1.25/8 = 0.1562510 = 0.1562510 Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Binary Coded Decimal (BCD) Represent a decimal by encoding each individual digit in binary form How many bits do we need to represent each digit? Ten possible choices for each digit (i.e. 0 to 9) An example of using the binary coded decimal representation (BCD) Not a very efficient use of “bits” !!! 9 3 7 . 2 5 1001 0011 0111  0010 0101 Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Weighted Codes BCD is one example of a generalized “weighted” code: Weights: Binary digits: In the case of BCD the weights are: E.g.: 0110 = 8x0+4x1+2x1+1x0 = 6 BCD is referred to as a 8-4-2-1 weighted code The codes 1010, 1011, 1100, 1101, 1110, and 1111 are unused Decimal Digit 8-4-2-1 Code (BCD) 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Other Weighted Codes Example: Encode 4 via a 6-3-1-1 code; Hence, 4 = 0101 as a 6-3-1-1 code Also, 4 = 0110 as a 6-3-1-1 code Decimal Digit 6-3-1-1 Code 0000 1 0001 2 0011 3 0100 4 0101 5 0111 6 1000 7 1001 8 1011 9 1100 The 6-3-1-1 encoding is not unique !! Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Weighted Codes Other Weighted Codes Excess-3 Code: BDC + 3 Decimal Digit 8-4-2-1 Code (BCD) 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 Excess-3 Code 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 +3= Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Weighted Codes Other Weighted Codes 2-out-of-5 Code Two out of 5 bits are 1’s for every decimal digit Decimal Digit 2-out-of-5 Code 00011 1 00101 2 00110 3 01001 4 01010 5 01100 6 10001 7 10010 8 10100 9 11000 Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Weighted Codes Other Weighted Codes Grey Code Codes for successive decimal digits differ by exactly one bit Decimal Digit Gray Code 0000 1 0001 2 0011 3 0010 4 0110 5 1110 6 1010 7 1011 8 1001 9 1000 Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Various Codes Decimal Digit 8-4-2-1 Code (BCD) 6-3-1-1 Excess-3 2-out-of-5 Gray 0000 0011 00011 1 0001 0100 00101 2 0010 0101 00110 3 0110 01001 4 0111 01010 5 1000 01100 1110 6 1001 10001 1010 7 10010 1011 8 10100 9 1100 11000 Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes ASCII Codes Wednesday, January 14 CEC 220 Digital Circuit Design

Binary Codes Binary Codes: Examples What does 1110 0110 represent in a 5-2-2-1 weighted code? What does 1000 0110 represent in a BCD (i.e. 8-4-2-1) weighted code? Express 4 9 in excess-3 code 5+2+2+0=9 0+2+2+0=4 ANS: 9 4 8+0+0+0=8 0+4+2+0=6 ANS: 8 6 4 = 0100 + 0011 = 0111 9=1001+0011=1100 ANS: 0111 1100 Wednesday, January 14 CEC 220 Digital Circuit Design

CEC 220 Digital Circuit Design Next Lecture Introduction to Boolean Algebra Wednesday, January 14 CEC 220 Digital Circuit Design