DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck.

Slides:



Advertisements
Similar presentations
HEXADECIMAL NUMBERS Code
Advertisements

Chapter 2 : Number System
CHAPTER 2 Number Systems, Operations, and Codes
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Number Systems Standard positional representation of numbers:

Storage of Bits Computers represent information as patterns of bits
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
CS2100 Computer Organisation
Digital Fundamentals Floyd Chapter 2 Tenth Edition
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
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
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.
© 2010 Kettering University, All rights reserved..
Information Representation and Number Systems BIL- 223 Logic Circuit Design Ege University Department of Computer Engineering.
Data Representation – Chapter 3 Sections 3-2, 3-3, 3-4.
Binary Number Systems.
1.6 Signed Binary Numbers.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Simple Data Type Representation and conversion of numbers
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
IT253: Computer Organization
Computer Architecture
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
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.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
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.
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
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.
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.
ECE2030 Introduction to Computer Engineering Lecture 2: Number System Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Tech.
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Microcomputers I - Electrical and Computer Engineering Dept. at Kettering.
1 Representation of Data within the Computer Oct., 1999(Revised 2001 Oct)
Number Systems & Operations
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
MECH1500 Chapter 3.
1 Digital Design Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.
NUMBER SYSTEMS AND CODES. CS Digital LogicNumber Systems and Codes2 Outline Number systems –Number notations –Arithmetic –Base conversions –Signed.
Number Representation and Arithmetic Circuits
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
DATA REPRESENTATION Data Types Complements Fixed Point Representations
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.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
CS2100 Computer Organisation
CS2100 Computer Organisation
Lecture No. 4 Number Systems
Number Representation
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
CS1010 Programming Methodology
Data Representation Data Types Complements Fixed Point Representation
Digital Logic & Design Lecture 03.
Data Representation – Chapter 3
Prof. Giancarlo Succi, Ph.D., P.Eng.
Number Systems.
Computer Architecture CST 250
Presentation transcript:

DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck

Number Systems A set of symbols representing digits, S A string of symbols represents a value Value may be computed from the position of digits in a string (positional number system) Example: Decimal number system –base 10 or radix 10 –(724.6) 10 =7x x10 + 4x1 + 6x1/10

examples Decimal: r = 10, S = {0, 1, 2,..., 9} Binary: r = 2, S = {0,1} Octal: r = 8, S = {0,1,2,3,4,5,6,7} Hexadec: r = 16, S = {0,..., 9, A,B,C,D,E,F} Conversion from one base to another: -By successive division or multiplications by the radix.

Positional number system Base r A number is a string Significance of a digit in a string is indicated by its position

Example for binary numbers A binary number is a weighted number. The structure is 2 n-1   2 -n where n is the number of bits from the binary point. Ex: conversion of the binary number –Weight –Binary = = =

2-to-10 and 10-to-2 Converting a binary number to a decimal number is easy : there is a radix point here What about the way back?

Addition and subtraction of binary numbers Same as in school: borrow from preceding neighbor By example:

Multiplication/division Examples –Multiplication: 7 x 5 = x 101 = = = 35 –Division: 12 / 4 = / 100 = 11

Negative numbers Signed magnitude form 1- complement 2-complement

Signed magnitude representation The most significant bit indicates the sign – = +85 – = - 85 Problem is the adding/subtracting of numbers

1-complement representation Binary complement for negative numbers 17 = = = = -119 sign

2-complement representation Positive numbers +A Negative numbers -A where

4-bit numbers

remarks Adding/subtracting – ignoring any carries beyond the MSB MSB = most significant bit (largest weight) – correct as long as range not exceeded

implementation Note: we represent a negative number –A as Example: 99 = = = Example: 98 = = =

Overflow detection MSB different No problem –Reason: always within range Example: MSB the sameMSB addition different Example: = =-5

In other words Calculations are done modulo 2 r+1 Let a and b be positive numbers; 0  a,b < 2 r ; - a = 2 r+1 – a mod 2 r+1 + a + b + a + b = c < 2 r no problem ( overflow detected by sign comparison) - a - b - a - b = 2 r+1 – a + 2 r+1 – b = 2 r+1 – (a + b) + 2 r+1 = 2 r+1 – (a + b) modulo 2 r+1 no problem if (a + b) < 2 r ( otherwise overflow detected ) - a + b - a + b = 2 r+1 – a + b = b –a modulo 2 r+1 for b  a = 2 r+1 – (a - b ) for b  a

Floating point numbers Decimal –Example: x 10 9 sign mantissa exponent

Binary floating point (IEEE standard) Binary: –single- (32 bits), double- (64 bits), extended precision (80 bits) S E = exponent F = mantissa 1 8 bits 23 bits To find E and F, write a binary number as 1. a 1 a 2 a 3 a 4 … 2 x –F = a 1 a 2 a 3 a 4 … –E = x range of x: -126 ≤ x ≤ 128 The number 0.0 is represented by all 0’s Infinity is represented by all 1’s in the exponent and 0’s in the mantissa Number = (-1) S (1+F)(2 E-127 )

Hexadecimal numbers Widely used in computer and microprocessor applications Base is 16: Decimalbinary hexadecimal – – – – – – – – – – –101010A –111011B –121100C –131101D –141110E –151111F

Hexadecimal numbers (count) A B C D E F A 1B 1C 1D 1E 1F A 2B 2C 2D 2E 2F 30 etc. i.e. In decimal13 16 means 1 x C 16 means 2 x A2B 16 means 10 x x With 2 hexadecimal digits we can count up to FF 16 = 255 decimal Each hexadecimal character represents a 4-bit number!

Hexadecimal numbers (examples) Example Binary to hexadecimal C A F Example Hexadecimal to binary 6BD3 = 6 x x x in binary:

octal numbers used in computer and microprocessor applications Base is 8: Decimalbinary octal – – – – – – – – – – – – – – – –

octal numbers (count) etc. i.e. In decimal13 8 means 1 x means 2 x means 3 x x With 2 octal digits we can count up to 77 8 = 63 decimal Each octal character represents a 4-bit number!

octal numbers (examples) Example Binary to octal Example octal to binary 6233 = 6 x x x in binary:

octal numbers (examples) Conversion digital to octal Example: 359 decimal = 5 x 8 2 (320) + 4 x 8 (32) + 7

Binary Coded Decimal Conversion table DecimalBCD decimal 35 = BCD 30011decimal 98 = BCD BCD = 86 decimal

Some other codes DecimalBCD 1-out-of-10 Biquinary Binary coded decimal Application: error detection (check!)

Gray Code By example for binary words of length 3 # codeword numbers differ by 1 binary difference Homework: design a general code for length n

parity An extra bit is added to a string to make the number of 1’s always even (or odd if desired) –i.e. the parity for 011 is the parity for 111 is RESULT: any odd number of changes detectable!