SCR 1013 : Digital Logic Module 2: NUMBER SYSTEM & CODES

Similar documents
Lecture (02) Operations on numbering systems

MACHINE LEVEL REPRESENTATION OF DATA

BINARY SYSTEM. Binary system is used in digital systems because it is:

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Chapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.

UNIT 7A Data Representation: Numbers and Text. Digital Data

Digital Fundamentals

Chapter 1. Digital Systems and Binary Numbers

Number representations

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

World Inside a Computer is Binary

Numbering systems. Dr Abu Arqoub

Lecture 2: Number Systems

CHW 261: Logic Design

Computer Organization

Number Systems. Dr. Tarek A. Tutunji Philadelphia University, Jordan

Digital Systems and Binary Numbers

CS 121 Digital Logic Design. Chapter 1. Teacher Assistant. Hadeel Al-Ateeq

Lecture (03) Binary Codes Registers and Logic Gates

Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

Logic Circuits I ECE 1411 Thursday 4:45pm-7:20pm. Nathan Pihlstrom.

Digital Systems and Binary Numbers

Korea University of Technology and Education

Binary Codes. Dr. Mudathir A. Fagiri

MC1601 Computer Organization

Chapter 2 Number Systems and Codes Dr. Xu

DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM

Fundamentals of Programming (C)

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Number System. Introduction. Decimal Numbers

CS & IT Conversions. Magnitude 10,000 1,

Review of Number Systems

DIGITAL SYSTEM DESIGN

Digital Fundamentals

CHAPTER 2 (b) : AND CODES

Binary. Hexadecimal BINARY CODED DECIMAL

CHAPTER 2 Number Systems

Chapter 1 Review of Number Systems

Digital Systems COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

2 Number Systems 2.1. Foundations of Computer Science Cengage Learning

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

15110 Principles of Computing, Carnegie Mellon University - CORTINA. Digital Data

Final Labs and Tutors

umber Systems bit nibble byte word binary decimal

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Logic and Computer Design Fundamentals. Chapter 1 Digital Computers and Information

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

CHAPTER TWO. Data Representation ( M.MORRIS MANO COMPUTER SYSTEM ARCHITECTURE THIRD EDITION ) IN THIS CHAPTER

Digital Systems and Binary Numbers

The type of all data used in a C++ program must be specified

Number Systems Base r

MYcsvtu Notes DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes

Data Representation and Binary Arithmetic. Lecture 2

Level ISA3: Information Representation

COMP Overview of Tutorial #2

SE311: Design of Digital Systems

Chapter (1) Eng. Mai Z. Alyazji

Chapter 4: Computer Codes. In this chapter you will learn about:

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

Electronic Data and Instructions

CMPE223/CMSE222 Digital Logic Design. Positional representation

Chapter 3 DATA REPRESENTATION

CMPS 10 Introduction to Computer Science Lecture Notes

Positional Number System

Chapter 2 Number System

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

Number System (Different Ways To Say How Many) Fall 2016

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Binary Systems and Codes

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

Slide Set 1. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

in this web service Cambridge University Press

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

Computer Sc. & IT. Digital Logic. Computer Sciencee & Information Technology. 20 Rank under AIR 100. Postal Correspondence

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Binary Values. CSE 410 Lecture 02

Digital codes. Resources and methods for learning about these subjects (list a few here, in preparation for your research):

T02 Tutorial Slides for Week 2

Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997

DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes

DATA REPRESENTATION. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift, Jaipur Region. Based on CBSE curriculum Class 11. Neha Tyagi, KV 5 Jaipur II Shift

Decimal & Binary Representation Systems. Decimal & Binary Representation Systems

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

Ms Sandhya Rani Dash UNIT 2: NUMBER SYSTEM AND CODES. 1.1 Introduction

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

1.1. Unit 1. Integer Representation

Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

Chap 1. Digital Computers and Information

Numeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:

EE 8351 Digital Logic Circuits Ms. J.Jayaudhaya, ASP/EEE

Digital Logic Lecture 4 Binary Codes

Integers. N = sum (b i * 2 i ) where b i = 0 or 1. This is called unsigned binary representation. i = 31. i = 0

Beyond Base 10: Non-decimal Based Number Systems

Thus needs to be a consistent method of representing negative numbers in binary computer arithmetic operations.

Digital Fundamentals

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Transcription:

SCR 1013 : Digital Logic Module 2: NUMBER SYSTEM & CODES

Module 2 Content Number system Decimal Number Binary Number Hexadecimal Numbers Octal Number Conversion between Number system Digital Codes (BCD, Parity, Gray, ASCII) Number representafons in Digital System ArithmeFc operafons in Digital System

Numbering System A number system is the set of symbols used to express quanffes as the basis for counfng, determining order, comparing amounts, performing calculafons, and represenfng value. Examples include the Arabic, Babylonian, Chinese, EgypFan, Greek, Mayan, and Roman number systems. Any posifve integer B (B > 1) can be chosen as the base or radix of a numbering system. If base is B, then B digits (0, 1, 2,, B 1) are used.

Decimal Number The decimal numbering system has 10 digits 0 through 9. The decimal numbering system has a base of 10 with each posifon weighted by a factor of 10 10 5 10 4 10 3 10 2 10 1 10 0. 10 1 10 2 10 3 10 4 10 5 Example: Express decimal 47 as a sum of the values of each digit. 47 10 = (4 x 10 1 ) + (7 x 10 0 ) = 40 + 7 = 47

Binary Number The binary numbering system has 2 digits 0 and 1. The binary numbering system has a base of 2 with each posifon weighted by a factor of 2. Example: 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1 0 1 1. 0 1 binary number 2 3 2 2 2 1 2 0 2 1 2 2 place values

Octal Number Uses base 8. Includes only the digits 0 through 7. Based on the binary system with a 3 bit boundary. The binary numbering system has a base of 8 with each posifon weighted by a factor of 8. Example: 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 4 5 3 6 0. 7 2 octal number 8 4 8 3 8 2 8 1 8 0 8 1 8 2 place values

Hexadecimal Number System Allows for convenient handling of long binary strings. Base 16 16 possible symbols 0 9 and A F (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F ) 16 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) 10 0, 1,, F, 10, 11, 12,, 1F, 20, 21, 9 C F 3. A 1 octal number 16 3 16 2 16 1 16 0 16 1 16 2 place values

Hex, Octal, Binary and Decimal Numbering System Hexadecimal Octal Binary Decimal 0 0 0000 0 1 1 0001 1 2 2 0010 2 3 3 0011 3 4 4 0100 4 5 5 0101 5 6 6 0110 6 7 7 0111 7 8 10 1000 8 9 11 1001 9 A 12 1010 10 B 13 1011 11 C 14 1100 12 D 15 1101 13 E 16 1110 14 F 17 1111 15

CODES IN DIGITAL SYSTEMS

What are codes? Code is a rule for converfng a piece of informafon into another form or representafon, not necessarily of the same type. One reason for coding is to enable communicafon in places where ordinary spoken or wriben language is difficult or impossible.

Binary Coded Decimal (BCD) BCD is a way to express each of the decimal digits with a binary code. There are only 10 code groups in the BCD system, one for every digit (0000 1001) Invalid codes are 1010, 1011, 1100, 1101, 1110 and 1111 Coded values for decimal digit: Decimal BCD Decimal BCD 0 0000 5 0101 1 0001 6 0110 2 0010 7 0111 3 0011 8 1000 4 0100 9 1001

Gray Codes Designed to prevent false output from electromechanical switches. Are widely used to facilitate error correcfon in digital communicafons such as digital terrestrial television and some cable TV systems. In modern digital communicafons, Gray codes play an important role in error correcfon. It is arranged so that every transifon from one value to the next value involves only one bit change. SomeFmes referred to as reflected binary, because the first eight values compare with those of the last 8 values, but in reverse order.

Parity Code Parity bit used for bit error detection Even parity total number of 1s even Odd parity total number of 1s odd Parity bit is append to the code at the leftmost position (MSB). Example: Code Number of 1s Even/Odd Even Parity Odd Parity 110010 3 Odd 1 110010 0 110010 101110 4 Even 0 101110 1 101110 101000 2 Even 0 101000 1 101000 110111 5 Odd 1 110111 0 110111

Error DetecFon by Parity Checking Assume that data = 0101 It uses even parity. Therefore the appended parity bit is 0. The data with parity bit: 0 0101 The data is transmitted. The data is received as 00001 odd no. of 1, not even!! Point A Data: 0 0101 (even parity) Point B Data: 0 0001 (even parity) but does not conform to even parity

American Standard Code for InformaFon Interchange (ASCII) It has 128 characters and symbols represented in 7-bit binary code Example : A = 1000001 2 a = 1100001 2 A parity bit is added so that the total number of bits is 8 a byte.

NUMBER REPRESENTATION IN DIGITAL SYSTEM Unsigned Number representation Signed Number representations

Integer RepresentaFon Numbers can be represented as a combinafon of a value, or magnitude and sign, plus or minus Unsigned integer Signed integer

Unsigned Integer RepresentaFon By unsigned integer, it is mean no negafve values. E.g. 0, 1, 2,..., 254, 255, 256, 257,... 65535, 65536, 65537,..., 2000000000, 2000000001,... A bit can store unsigned integers from 0 to 1. A byte of 8 bits can store unsigned integers from 0 to 255 = 2 8 1. In binary arithmefc, if the length of the number is restricted to 8 digits (0s and 1s), the largest value is 1111 1111 2 = 255, and the smallest is 0. A word of 16 bits can store unsigned integers from 0 to 65535 = 2 16 1. In binary arithmefc, if the length of the number is restricted to 16 digits (0s and 1s), the largest value is 1111 1111 1111 1111 2 = 65535, and the smallest is 0.

Signed Numbers Integers that do not have a sign indicafon are considered as posifve numbers and they are referred to as unsigned numbers. 01000, 11101 However, integers can be posifve and negafve. +01000, +11101, 10001, 0111001 Need for a code to represent and +. PosiFve and negafve integers use a code system to indicate the sign. Signed bit: 0 (+ve) or 1 ( ve) posifoned at MSB PosiFve numbers 0 01000, 0 11101 NegaFve numbers 1 10101, 1 0101001 This is referred as signed numbers.

Signed Numbers RepresentaFon Three representafon: Sign and magnitude (simple representafon) 1 s complement 2 s complement

ArithmeFc OperaFons Integer Numbers Unsigned Numbers Signed Numbers AddiFon SubtracFon

ArithmeFc OperaFon: AddiFon A B A + B 0 0 0 0 1 1 1 0 1 1 1 10 Example: 1 0 0 1 0 + 0 1 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 + 0 1 1 0 0 1 0 0 0 1 0

ArithmeFc OperaFon: SubtracFon In digital system, subtracfon is performed by using 2 s complement and addifon. Carry from the MSB (signed bit) is deleted. Example: 010011 001111 = 010011 + ( 001111) = 010011 + (110001) = 000100 1 1 1 0 1 0 0 1 1 + 1 1 0 0 0 1 1 0 0 0 1 0 0