Morgan Kaufmann Publishers

Slides:



Advertisements
Similar presentations
KFUPM COE 202: Digital Logic Design Number Systems Part 3 Courtesy of Dr. Ahmad Almulhem.
Advertisements

Computer Codes Rohit Khokher. Computer Codes Data types NumericNonnumeric IntegerRealAlphabet A, B, C, …,Z a, b, c,…,z Digits 0,…,9 Special Characters.
ECE 331 – Digital System Design
Digital Fundamentals Floyd Chapter 2 Tenth Edition
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.
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
Overview Digital Systems and Computer Systems Number Systems [binary, octal and hexadecimal] Arithmetic Operations Base Conversion Decimal Codes [BCD (binary.
EECC341 - Shaaban #1 Lec # 3 Winter Binary Multiplication Multiplication is achieved by adding a list of shifted multiplicands according.
Digital Systems Number Systems and Codes Wen-Hung Liao, Ph.D.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
CS2100 Computer Organisation
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
CS1104: Computer Organisation comp. nus. edu
MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR 1 Overflow Signed binary is in fixed range -2 n-1  2 n-1 If the answer for addition/subtraction more than the.
Number System and Codes
Number Systems and Codes
ASCII & Gray Codes.
9/15/09 - L3 CodesCopyright Joanne DeGroat, ECE, OSU1 Codes.
1.6 Signed Binary Numbers.
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Lecture 6 Topics Character codes Error Detection and Correction
Digital Systems and Logic Design
Binary Arithmetic & Data representation
Ahmad Almulhem, KFUPM 2010 COE 202: Digital Logic Design Number Systems Part 4 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
The Digital Codes.
Digital Logic Lecture 4 Binary Codes The Hashemite University Computer Engineering Department.
BINARY CODE – Digital Circuit 1 Choopan Rattanapoka.
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
Based on slides by:Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. ECE/CS 352: Digital System Fundamentals Lecture 2 – Binary Codes.
Yuh-Jzer JoungDigital Systems1 Number Systems decimal number : 7397=7× × × ×10 0 a 4 a 3 a 2 a 1 a 0. a -1 a -2 = a 4 ×10 4 +a 3 ×10.
CS151 Introduction to Digital Design
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Number Systems and Codes. CS2100 Number Systems and Codes 2 NUMBER SYSTEMS & CODES Information Representations Number Systems Base Conversion Negative.
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Summer 2012ETE Digital Electronics1 Binary Arithmetic of Signed Binary Numbers.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
1. Number Systems Chapt. 2 Location in course textbook.
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
Digital Circuits Text Book –M. M. Mano, "Digital Design," 3rd Ed., Prentice Hall Inc., Reference –class notes Grade –quizzes:15% –mid-term:27.5%
Tutorial: ITI1100 Dewan Tanvir Ahmed SITE, UofO
ECE 301 – Digital Electronics Representation of Negative Numbers, Binary Arithmetic of Negative Numbers, and Binary Codes (Lecture #11) The slides included.
Ahmad Almulhem, KFUPM 2009 COE 202: Digital Logic Design Number Systems Part 4 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Signed Binary Numbers Arithmetic Subtraction – In 2’s-complement form: Example: 1.Take the 2’s complement of the subtrahend (including the sign bit) and.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  The necessity and advantages of coding  The variety of coding systems You will learn: 2.
MECH1500 Chapter 3.
DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck.
WEEK #11 FUNCTIONS OF COMBINATIONAL LOGIC (PART 4)
1 Digital Design Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.
Module –I Codes: Weighted and non-weighted codes
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
Overview 1-1 Information Representation
ECE DIGITAL LOGIC LECTURE 4: BINARY CODES Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/26/2016.
Digital Logic & Design Adil Waheed Lecture 03. Range of Binary Numbers Processors can handle 64-bit unsigned binary values. Maximum unsigned decimal number.
Digital Systems: Number Systems and Codes Wen-Hung Liao, Ph.D.
Dr. Nermin Hamza. Agenda Signed Numbers Properties of Switching Algebra.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
COMPUTER ORGANIZATION 4 TH LECTURE. ASCII Code  ASCII ( American Standard Code for Information Interchange).  Input and output devices that communicate.
CS2100 Computer Organisation
Number systems and codes
Introduction to Chapter 2
Digital Systems: Number Systems and Codes
Dr. Clincy Professor of CS
ECB2212-Digital Electronics Codes
Learning Intention I will learn how computers store text.
ECE 331 – Digital System Design
Presentation transcript:

Morgan Kaufmann Publishers 23 April, 2017 Codes Chapter 4 — The Processor

Outline Binary Coded Decimal (BCD) Gray Code Binary-to-Gray Conversion Gray-to-Binary Conversion Other Decimal Codes Self-Complementing Codes Alphanumeric Codes Error Detection Codes

Outline Binary Coded Decimal (BCD) Gray Code Binary-to-Gray Conversion Gray-to-Binary Conversion Other Decimal Codes Self-Complementing Codes Alphanumeric Codes Error Detection Codes

Binary Coded Decimal (BCD) Decimal numbers are more natural to humans. Binary numbers are natural to computers. Quite expensive to convert between the two. If little calculation is involved, we can use some coding schemes for decimal numbers. One such scheme is BCD, also known as the 8421 code. Represent each decimal digit as a 4-bit binary code.

Binary Coded Decimal (BCD) Some codes are unused, eg: (1010)BCD, (1011) BCD, …, (1111) BCD. These codes are considered as errors. Easy to convert, but arithmetic operations are more complicated. Suitable for interfaces such as keypad inputs and digital readouts.

Binary Coded Decimal (BCD) Examples: (234)10 = (0010 0011 0100)BCD (7093)10 = (0111 0000 1001 0011)BCD (1000 0110)BCD = (86)10 (1001 0100 0111 0010)BCD = (9472)10 Notes: BCD is not equivalent to binary. Example: (234)10 = (11101010)2

Outline Binary Coded Decimal (BCD) Gray Code Binary-to-Gray Conversion Gray-to-Binary Conversion Other Decimal Codes Self-Complementing Codes Alphanumeric Codes Error Detection Codes

Gray Code Unweighted (not an arithmetic code). Only a single bit change from one code number to the next. Good for error detection. Q. How to generate 5-bit standard Gray code? Q. How to generate n-bit standard Gray code?

Gray Code 0000 0001 0100 0101 0111 0110 0010 0011 0001 0000 1100 1101 1111 1110 1010 1011 1001 1000 0001 0000 0011 0010 0110 0111 0101 0100 0010 0011 0001 0000 Generating 4-bit standard Gray code.

Gray Code sensors mis-aligned sensors Gray coded: 111  101 0 0 1 0 0 0 0 1 0 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 sensors 1 0 1 1 1 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 1 1 1 0 mis-aligned sensors Gray coded: 111  101 Binary coded: 111  110  000 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 0 mis-aligned sensors

Binary-to-Gray Code Conversion Retain most significant bit. From left to right, add each adjacent pair of binary code bits to get the next Gray code bit, discarding carries. Example: Convert binary number 10110 to Gray code. (10110)2 = (11101)Gray

Gray-to-Binary Conversion Retain most significant bit. From left to right, add each binary code bit generated to the Gray code bit in the next position, discarding carries. Example: Convert Gray code 11011 to binary. (11011)Gray = (10010)2

Outline Binary Coded Decimal (BCD) Gray Code Binary-to-Gray Conversion Gray-to-Binary Conversion Other Decimal Codes Self-Complementing Codes Alphanumeric Codes Error Detection Codes

Other Decimal Codes Self-complementing codes: excess-3, 84-2-1, 2*421 codes. Error-detecting code: biquinary code (bi=two, quinary=five).

Outline Binary Coded Decimal (BCD) Gray Code Binary-to-Gray Conversion Gray-to-Binary Conversion Other Decimal Codes Self-Complementing Codes Alphanumeric Codes Error Detection Codes

Self-Complementing Codes Examples: excess-3, 84-2-1, 2*421 codes. The codes that represent the pair of complementary digits are complementary of each other. Excess-3 code 0: 0011 1: 0100 2: 0101 3: 0110 4: 0111 5: 1000 6: 1001 7: 1010 8: 1011 9: 1100 241: 0101 0111 0100 758: 1010 1000 1011

Outline Binary Coded Decimal (BCD) Gray Code Binary-to-Gray Conversion Gray-to-Binary Conversion Other Decimal Codes Self-Complementing Codes Alphanumeric Codes Error Detection Codes

Alphanumeric Codes Apart from numbers, computers also handle textual data. Character set frequently used includes: alphabets: ‘A’ .. ‘Z’, and ‘a’ .. ‘z’ digits: ‘0’ .. ‘9’ special symbols: ‘$’, ‘.’, ‘,’, ‘@’, ‘*’, … non-printable: SOH, NULL, BELL, … Usually, these characters can be represented using 7 or 8 bits.

Alphanumeric Codes Two widely used standards: ASCII (American Standard Code for Information Interchange) EBCDIC (Extended BCD Interchange Code) ASCII: 7-bit, plus a parity bit for error detection (odd/even parity). EBCDIC: 8-bit code.

Alphanumeric Codes ASCII table:

Outline Binary Coded Decimal (BCD) Gray Code Binary-to-Gray Conversion Gray-to-Binary Conversion Other Decimal Codes Self-Complementing Codes Alphanumeric Codes Error Detection Codes

Error Detection Codes Errors can occur data transmission. They should be detected, so that re-transmission can be requested. With binary numbers, usually single-bit errors occur. Example: 0010 erroneously transmitted as 0011, or 0000, or 0110, or 1010. Biquinary code uses 3 additional bits for error-detection. For single-error detection, one additional bit is needed.

Error Detection Codes Parity bit. Even parity: additional bit supplied to make total number of ‘1’s even. Odd parity: additional bit supplied to make total number of ‘1’s odd. Example: Odd parity. Parity bits

Error Detection Codes Parity bit can detect odd number of errors but not even number of errors. Example: For odd parity numbers, 10011  10001 (detected) 10011  10101 (non detected) Parity bits can also be applied to a block of data: Column-wise parity Row-wise parity

Error Detection Codes Sometimes, it is not enough to do error detection. We may want to do error correction. Error correction is expensive. In practice, we may use only single-bit error correction. Popular technique: Hamming Code (not covered).