1 Digital Design: Number Systems Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals of Logic.

Slides:



Advertisements
Similar presentations
COE 202: Digital Logic Design Signed Numbers
Advertisements

Chapter 1 Digital Systems and Numbers System
ECE 331 – Digital System Design
Wakerly Section 2.4 and further Addition and Subtraction of Nondecimal Numbers.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Assembly Language and Computer Architecture Using C++ and Java
Sistemas Digitais I LESI - 2º ano Lesson 2 - Number Systems U NIVERSIDADE DO M INHO E SCOLA DE E NGENHARIA Prof. João Miguel Fernandes
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
ECE 331 – Digital System Design
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
ECE 301 – Digital Electronics Number Systems and Conversion, Binary Arithmetic, and Representation of Negative Numbers (Lecture #10) The slides included.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Number System and Codes
Data Representation – Chapter 3 Sections 3-2, 3-3, 3-4.
Number Systems Lecture 02.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
NEGATIVE BINARY NUMBER – Digital Circuit 1 Choopan Rattanapoka.
1.6 Signed Binary Numbers.
Binary Representation - Shortcuts n Negation x + x = 1111…1111 two = -1 (in 2’s complement) Therefore, -x = x + 1 n Sign Extension o Positive numbers :
Digital Systems and Binary Numbers
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Digital Design: Principles and Practices Chapter 2 Number Systems and Codes.
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers citation and following credit line is included:
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
ECE 3110: Introduction to Digital Systems Review #1 (Chapter 1,2)
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 2 Number.
Chapter 2 Number Systems + Codes. Overview Objective: To use positional number systems To convert decimals to binary integers To convert binary integers.
Complement Numbers. Outline  Negative Numbers Representation  Sign-and-magnitude  1s Complement  2s Complement  Comparison of Sign-and-Magnitude.
Number Systems. Why binary numbers? Digital systems process information in binary form. That is using 0s and 1s (LOW and HIGH, 0v and 5v). Digital designer.
Calculating Two’s Complement. The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of.
46 Number Systems Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs Display: Seven segment displays Inputs: Switches.
Number systems & Binary codes MODULE 1 Digital Logic Design Ch1-2 Outline of Chapter 1  1.1 Digital Systems  1.2 Binary Numbers  1.3 Number-base Conversions.
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Computer Number Systems. d n-1 d n-2 d n d 2-m d 1-m d -m Conventional Radix Number r is the radixd i is a digit d i Є {0, 1, ….., r – 1 } -m ≤
ECE 331 – Digital System Design
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Dr. Ahmed Telba EE208: Logic Design Lecture# 1 Introduction & Number Systems.
Number systems, Operations, and Codes
Positional Number Systems
ECE2030 Introduction to Computer Engineering Lecture 2: Number System Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Tech.
1 IT 231, CMPE 331 Digital Logic Design Week 2 Number systems and arithmetic.
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
Operations on Bits Arithmetic Operations Logic Operations
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
Number Systems and Logic Prepared by Dr P Marais (Modified by D Burford)
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
AEEE2031 Data Representation and Numbering Systems.
ECE 301 – Digital Electronics Representation of Negative Numbers, Binary Arithmetic of Negative Numbers, and Binary Codes (Lecture #11) The slides included.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
69 Decimal (Base 10) Numbers n Positional system - each digit position has a value n 2534 = 2*1, * *10 + 4*1 n Alternate view: Digit position.
DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck.
IT1004: Data Representation and Organization Negative number representation.
NUMBER SYSTEMS AND CODES. CS Digital LogicNumber Systems and Codes2 Outline Number systems –Number notations –Arithmetic –Base conversions –Signed.
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic Herbert G. Mayer, PSU Status 1/14/2016 Copied with Permission from prof. Mark PSU ECE.
Introduction to Digital Electronics Lecture 2: Number Systems.
Lec 11Systems Architecture1 Systems Architecture Lecture 11: Arithmetic for Computers Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some or all.
ECE 2110: Introduction to Digital Systems
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
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.
Computer Math CPS120 Introduction to Computer Science Lecture 7.
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.
Presentation transcript:

1 Digital Design: Number Systems Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals of Logic Design, 5/e, Thomson, 2004

2 Positional Number Systems A number is represented by a string of digits, where each digit position has an associated weight and it has the following form: d p  1 d p  2  d 1 d 0. d  1 d  2  d  n The value of the number is given by:

3 Binary Numbers The general form of a binary number of p+n binary digits (bits) is: b p  1 b p  2  b 1 b 0. b  1 b  2  b  n and its value is:

4 Octal and Hexadecimal Numbers The octal number system uses radix 8, while the hexadecimal number system uses radix 16 The octal and hex number systems are useful for representing multibit numbers

5 Conversion from Binary to Decimal Method: summation Example: = 1            2 0 =

6 Conversion from Decimal to Binary Method: successive divisions Example:

7 EXAMPLE: convert to binary

8 EXAMPLE: convert.625 ten to binary

9 EXAMPLE: convert to binary.

10 EXAMPLE: convert to base 7.

11 Addition of Binary Numbers EXAMPLE: Add and in binary.

12 Subtraction of Binary Numbers EXAMPLES:

13 Representation of Negative Numbers Signed-Magnitude Representation  10 ten  10 ten two two The number zero has two representations (+0 and  0) An n-bit signed-magnitude number lies within the range  (2 n  1  1) through  (2 n  1  1) To add signed-magnitude numbers we must examine the signs of the addends to determine what to do … Radix Complement Representation Diminished Radix Complement Representation

14 Representing Numbers ???? Key observation: Numbers are just strings of symbols. The meaning (value) we assign to each string instance (pattern) is up to us. If the string is n symbols (digits) long and each symbol can take up to different r instances (radix) then we can form r n different patterns. “Common sense” characteristics of a system number: Assign a different value to each different pattern Split the patterns equally between positive numbers and negative numbers The mechanic of doing arithmetic operations should be as “simple’ as possible

15 Complement Number Systems While the signed-magnitude system negate a number by changing its sign, a complement number system negates a number by taking its complement. Radix-complement Representation The complement of an n-digit number D is obtained by subtracting it from r n r n – D = ((r n  1)  D)  1 Diminished Radix-complement Representation In a diminished radix-complement system the complement of an n-digit number D is obtained by subtracting it from r n  1

16 Complement Number Systems

17 Complement Number Systems

18 Complement Number Systems Once we know how to compute the diminished-radix complement of a number, computing the radix-complement is very simple: radix complement = diminished-radix complement

19 C 2 Number System For binary numbers, the radix complement is called two’s complement (C 2 ). The MSB of a number in this system serves as the sign bit. Negative numbers have MSB equal to 1 Positive numbers have MSB equal to 0 The range of representable numbers is: –(2 n  1 ) through +(2 n  1  1) Zero has only one representation

20 Two’s Complement Number System  

21 C 1 Number System For binary numbers, the diminished-radix complement is called one’s complement (C 1 ). The MSB of a number in this system serves as the sign bit. Negative numbers have MSB equal to 1 Positive numbers have MSB equal to 0 The range of representable numbers is: –(2 n  1  1) through +(2 n  1  1) Zero has two representations: positive zero (00  00) and negative zero (11  11)

22 Summary of Signed Number Systems

23 C 1 Number System In the C 1 number system to negate an n-bit number all we have do is to flip (invert) all the bits

24 C 2 Number System In the C 2 number system to negate an n-bit number requires two steps:  invert all bits of the number (i.e. take the C 1 of the number) and then  add 1

25 “Playing” with the C 2 notation The sum of a number and its inverted representation must be 111….111 two, which in C 2 represent –1

26 C 2 EXAMPLES

27 C 2 sign extension As far as m > n, it is possible to convert n-bit numbers into m- bit numbers, but some care is needed : copy the most significant bit (the sign bit) into the other bits 0010   This procedure is referred as "sign extension"

28 C 2 Addition and Subtraction 1. Addition of 2 positive numbers, sum < 2 n –1. 2. Addition of 2 positive numbers, sum ≥ 2 n –1

29 C 2 Addition and Subtraction 3. Addition of positive and negative numbers (negative number has greater magnitude). 4. Addition of positive and negative numbers (positive number has greater magnitude).

30 C 2 Addition and Subtraction 5. Addition of two negative numbers, |sum| ≤ 2 n –1. 6. Addition of two negative numbers, | sum | > 2 n –1.

31 Detecting overflow Overflow occurs when the value affects the sign bit: adding two positives yields a negative adding two negatives gives a positive subtract a negative from a positive and get a negative subtract a positive from a negative and get a positive No overflow when adding a positive and a negative number No overflow when subtracting two numbers of same sign Consider the operations A + B, and A – B Can overflow occur if B is 0 ? Can overflow occur if A is 0 ? cannot occur ! can occur ! (for A  B if B=  2 n  1 )

32 Binary Codes for Decimal Numbers

33 Gray Code

34 Character Codes

35 N-cubes and Hamming distance

36 Traversing a 3-cube in Gray code order