Chapter 1 Emad Felemban

Similar documents
Digital Systems and Binary Numbers

Number System. Introduction. Decimal Numbers

TOPICS. Other Number Systems. Other Number Systems 9/9/2017. Octal Hexadecimal Number conversion

Octal & Hexadecimal Number Systems. Digital Electronics

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

Introduction to Numbering Systems

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

MACHINE LEVEL REPRESENTATION OF DATA

CS & IT Conversions. Magnitude 10,000 1,

Chapter 1 Review of Number Systems

Lecture 2: Number Systems

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

COE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee

Objectives. Connecting with Computer Science 2

SE311: Design of Digital Systems

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

DIGITAL SYSTEM DESIGN

Level ISA3: Information Representation

CMPE223/CMSE222 Digital Logic Design. Positional representation

data within a computer system are stored in one of 2 physical states (hence the use of binary digits)

Computer Organization

Korea University of Technology and Education

COMP Overview of Tutorial #2

Switching Circuits and Logic Design Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Computer Arithmetic. Appendix A Fall 2003 Lec.03-58

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

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

Lecture (01) Introduction Number Systems and Conversion (1)

in this web service Cambridge University Press

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

The. Binary. Number System

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

Number representations

Unit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation

What Is It? Instruction Register Address Register Data Register

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Numbering systems. Dr Abu Arqoub

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude

Review of Number Systems

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

Fundamentals of Programming (C)

Lecture 1: Digital Systems and Number Systems

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

Chapter 2 Binary Values and Number Systems

CHAPTER 2 (b) : AND CODES

CHAPTER 2 Number Systems

Bits. Binary Digits. 0 or 1

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

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other

Electronic Data and Instructions

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts. Chapter Overview. Welcome to Assembly Language

CS 101: Computer Programming and Utilization

Chapter 1 Preliminaries

2 Number Systems 2.1. Foundations of Computer Science Cengage Learning

3.1. Unit 3. Binary Representation

CSC201, SECTION 002, Fall 2000: Homework Assignment #2

Chapter 2 Exercises and Answers

6. Binary and Hexadecimal

Numbers and Representations

Binary. Hexadecimal BINARY CODED DECIMAL

Digital Logic Lecture 2 Number Systems

Number Systems. Both numbers are positive

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

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

Electronics Engineering ECE / E & T

CHW 261: Logic Design

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems

Final Labs and Tutors

Information Science 1

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

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Digital Fundamentals

Octal and Hexadecimal Integers

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

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

Digital Systems and Binary Numbers

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.

Agenda EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 1: Introduction. Go over the syllabus 3/31/2010

Lecture (02) Operations on numbering systems

T02 Tutorial Slides for Week 2

EE 109 Unit 3. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

CMPS 10 Introduction to Computer Science Lecture Notes

EE 109 Unit 2. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

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

COPYRIGHTED MATERIAL. Number Systems. 1.1 Analogue Versus Digital

CS/EE1012 INTRODUCTION TO COMPUTER ENGINEERING SPRING 2013 HOMEWORK I. Solve all homework and exam problems as shown in class and sample solutions

EE 109 Unit 2. Binary Representation Systems

Digital Systems and Binary Numbers

NUMBER SYSTEMS AND CODES

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

COMP2121: Microprocessors and Interfacing. Number Systems

MC1601 Computer Organization

umber Systems bit nibble byte word binary decimal

Module 2: Computer Arithmetic

Python Numbers. Learning Outcomes 9/19/2012. CMSC 201 Fall 2012 Instructor: John Park Lecture Section 01 Discussion Sections 02-08, 16, 17

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

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

Transcription:

Chapter 1 Emad Felemban

Digital Computers and Digital Systems Binary Numbers Number Base Conversion Octal and Hexadecimal Numbers Complements Singed Binary Numbers Binary Codes Binary Storage and Registers Binary Logic

Digital vs. Analog Waveforms +5 V 5 1 0 1 T ime Digital: only assumes discrete values +5 V 5 T ime Analog: values vary over a broad range continuously

L 4 L 5 L1 L2 L3 L 6 L 7 Chip to drive digital display B3 B2 B1 B0 Val 0 0 0 0 0 0 0 0 1 1 0 0 1 0 2 0 0 1 1 3 0 1 0 0 4 0 1 0 1 5 0 1 1 0 6 0 1 1 1 7 1 0 0 0 8 1 0 0 1 9

The basic unit of storage in a computer is the bit (binary digit), which can have one of just two values: 0 or 1. This is easier to implement in hardware than a unit that can take on 10 different values. For instance, it can be represented by a transistor being off (0) or on (1). Alternatively, it can be a magnetic stripe that is magnetized with North in one direction (0) or the opposite (1). Binary also has a convenient and natural association with logical values of False (0) and True (1).

Binary bits are grouped together to allow them to represent more information: A nybble is a group of 4 bits, e.g. 1011 A byte is a group of 8 bits, e.g. 11010010 A word is a larger grouping: usually 32 bits. A halfword is half as many bits as a word, thus usually 16 bits. A doubleword is twice as many bits, usually 64 bits. However, computers have been designed with various word sizes, such as 36, 48, or 60 bits.

Clearly, the number of possible combinations of a group of N bits is 2 N = 2x2x2 x2 (N 2s). Thus: A nybble can form 2 4 =16 combinations A byte can form 2 8 =256 combinations A 32-bit word can form 2 32 =4,294,967,296 combinations

Decimal System

Binary System

Here are the first 16 binary numbers (using 4 bits), and their decimal equivalents. 0000 = 0 1000 = 8 0001 = 1 1001 = 9 0010 = 2 1010 = 10 0011 = 3 1011 = 11 0100 = 4 1100 = 12 0101 = 5 1101 = 13 0110 = 6 1110 = 14 0111 = 7 1111 = 15 2004, Robert K. Moniot

Because binary numbers are rather unwieldy, programmers prefer to use a more compact way to represent them. Historically, octal (base 8) and hexadecimal (base 16, or hex) have been used. Octal has the advantage that it uses only familiar digits, but it groups digits by threes, which is inconvenient for word sizes that are multiples of 4. So it is seldom used nowadays. Hexadecimal works nicely for bytes and for word sizes that are multiples of 4, but requires the introduction of 6 new digits. Conversion between binary and decimal is slow and is preferably avoided if there is no need. Octal and hex allow immediate conversion to and from binary. 2004, Robert K. Moniot

Hexadecimal works by grouping binary bits into groups of 4 (starting from the right). Each group (a nybble) is assigned a hex digit value. The digits are the same as for decimal up to 9, and then letters A through F are used for 10 through 15. 0000 = 0 1000 = 8 0001 = 1 1001 = 9 0010 = 2 1010 = A 0011 = 3 1011 = B 0100 = 4 1100 = C 0101 = 5 1101 = D Thus the 16-bit binary number 1011 0010 1010 1001 converted to hex is B2A9 0110 = 6 1110 = E 0111 = 7 1111 = F 2004, Robert K. Moniot

Binary to decimal conversion

Example 1 Convert the binary number 10011 to decimal. Solution Write out the bits and their weights. Multiply the bit by its corresponding weight and record the result. At the end, add the results to get the decimal number. Binary 1 0 0 1 1 Weights 16 8 4 2 1 ----------------------------------- -- 16 + 0 + 0 + 2 + 1 Decimal 19

Example 2 Convert the decimal number 35 to binary. Solution Write out the number at the right corner. Divide the number continuously by 2 and write the quotient and the remainder. The quotients move to the left, and the remainder is recorded under each quotient. Stop when the quotient is zero. 0 1 2 4 8 17 35 Dec. Binary 1 0 0 0 1 1

Decimal to binary conversion

Changing fractions to binary

Example 17 Transform the fraction 0.875 to binary Solution Write the fraction at the left corner. Multiply the number continuously by 2 and extract the integer part as the binary digit. Stop when the number is 0.0. 0.875 1.750 1.5 1.0 0.0 0. 1 1 1

Example 18 Transform the fraction 0.4 to a binary of 6 bits. Solution Write the fraction at the left cornet. Multiply the number continuously by 2 and extract the integer part as the binary digit. You can never get the exact binary representation. Stop when you have 6 bits. 0.4 0.8 1.6 1.2 0.4 0.8 1.6 0. 0 1 1 0 0 1

Because binary numbers are rather unwieldy, programmers prefer to use a more compact way to represent them. Historically, octal (base 8) and hexadecimal (base 16, or hex) have been used. Octal has the advantage that it uses only familiar digits, but it groups digits by threes, which is inconvenient for word sizes that are multiples of 4. So it is seldom used nowadays. Hexadecimal works nicely for bytes and for word sizes that are multiples of 4, but requires the introduction of 6 new digits. Conversion between binary and decimal is slow and is preferably avoided if there is no need. Octal and hex allow immediate conversion to and from binary. 2004, Robert K. Moniot

Hexadecimal works by grouping binary bits into groups of 4 (starting from the right). Each group (a nybble) is assigned a hex digit value. The digits are the same as for decimal up to 9, and then letters A through F are used for 10 through 15. 0000 = 0 1000 = 8 0001 = 1 1001 = 9 0010 = 2 1010 = A 0011 = 3 1011 = B 0100 = 4 1100 = C 0101 = 5 1101 = D Thus the 16-bit binary number 1011 0010 1010 1001 converted to hex is B2A9 0110 = 6 1110 = E 0111 = 7 1111 = F 2004, Robert K. Moniot

Diminished Radix Complement 9 s Complement of 546700 is 999999 546700 = 453299 9 s Complement of 012398 is 999999 012398 = 987601 1 s Complement of 1011000 is 0100111 1 s Complement of 0101101 is 1010010 Radix Complement 10 s Complement of 546700 is 453300 10 s Complement of 012398 is 987602 2 s Complement of 1011000 is 0101000 2 s Complement of 0101101 is 1010011

-9 10001001 11110110 11110111

Arithmetic Addition and Subtraction

Decimal Binary BCD 84-2-1 2421 23 245 11 99 100 512 1

1-7 1-8 1-15 1-18 1-19 1-23