Yuh-Jzer JoungDigital Systems1 Number Systems decimal number : 7397=7×10 3 +3×10 2 +9×10 1 +7×10 0 a 4 a 3 a 2 a 1 a 0. a -1 a -2 = a 4 ×10 4 +a 3 ×10.

Slides:



Advertisements
Similar presentations
A digital system is a system that manipulates discrete elements of information represented internally in binary form. Digital computers –general purposes.
Advertisements

Arithmetic Operations and Circuits
ECE 331 – Digital System Design
Chapter 1 Binary Systems 1-1. Digital Systems
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Assembly Language and Computer Architecture Using C++ and Java
Storage of Bits Computers represent information as patterns of bits
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
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
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.
Mantıksal Tasarım – BBM231 M. Önder Efe
CS 105 Digital Logic Design
1.6 Signed Binary Numbers.
Dr. Bernard Chen Ph.D. University of Central Arkansas
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Digital Systems and Logic Design
Logic and Digital System Design - CS 303
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Dept. of Computer Science Engineering Islamic Azad University of Mashhad 1 DATA REPRESENTATION Dept. of Computer Science Engineering Islamic Azad University.
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.
Digital Arithmetic and Arithmetic Circuits
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
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.
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.
CE1111 :Digital Logic Design lecture 01 Introduction Dr. Atef Ali Ibrahim.
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.
Topic 1 – Number Systems. What is a Number System? A number system consists of an ordered set of symbols (digits) with relations defined for addition,
1 Lecture 3 ENGRE 254 1/14/09. 2 Lecture 1 review Digital signals assume two values represented by “0” and “1”. Typically a “0” represents a voltage near.
1 Representation of Data within the Computer Oct., 1999(Revised 2001 Oct)
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
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.
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
Chapter 1 Digital Systems and Binary Numbers
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.
Chapter 1: Binary Systems
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits
NUMBER SYSTEMS AND CODES. CS Digital LogicNumber Systems and Codes2 Outline Number systems –Number notations –Arithmetic –Base conversions –Signed.
ECE DIGITAL LOGIC LECTURE 4: BINARY CODES Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/26/2016.
Lecture 1.2 (Chapter 1) Prepared by Dr. Lamiaa Elshenawy
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
BINARY SYSTEMS ENGR. KASHIF SHAHZAD 1. BINARY NUMBERS 1/2 Internally, information in digital systems is of binary form groups of bits (i.e. binary numbers)
Digital Logic Design Ch1-1 Chapter 1 Digital Systems and Binary Numbers Mustafa Kemal Uyguroğlu Digital Logic Design I.
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.
N 3-1 Data Types  Binary information is stored in memory or processor registers  Registers contain either data or control information l Data are numbers.
Chapter 3 Data Representation
INTRODUCTION TO LOGIC DESIGN Chapter 1 Digital Systems and Binary Numbers gürtaçyemişçioğlu.
Data Representation Data Types Complements Fixed Point Representation
ECE 331 – Digital System Design
Presentation transcript:

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 3 +a 2 ×10 2 +a 1 ×10 1 +a 0 ×10 0 +a -1 x a -2 ×10 -2 a i : coefficient 10 : base or radix a 4 : most significant bit ( msb ) a -2 : least significant bit ( lsb )

Yuh-Jzer JoungDigital Systems2 In general, number N in a base-r system is represented as N = (a n a n a 1 a 0. a -1 a a -m ) which has the value N = (a n.r n + a n-1.r n a 1.r +a 0 +a -1.r -1 + a -2 r a -m.r -m ) In binary system ﹐ r = 2 ﹐ a i  {0, 1}. In octal system ﹐ r = 8 ﹐ a i  {0,1,…,7}. In decimal system ﹐ r = 10 ﹐ a i  {0,1,…,9}. In hexadecimal system ﹐ r = 16 ﹐ a i  {0,1,…9,A,B,C,D,E,F}.

Yuh-Jzer JoungDigital Systems3 Conversion between different Bases Base-r to base-10 conversion ﹕ Straightforward ﹗ Base-r to base-s conversion ﹕ By repeated division for integers and repeated multiplication for fractions. Ex1. Convert ( ) 10 to octal number. Integer ﹕ 153 (153) 10 = (231)

Yuh-Jzer JoungDigital Systems4 fractional: 0.513×8 = ×8 = ×8 = (0.513) 10 = (0.4065…) ×8 = ( ) 10 = ( …) 8 Ex2. Convert (12A) 16 to octal. 1. Convert (12A) 16 to (298) Convert (298) 16 to octal as in Ex1.

Yuh-Jzer JoungDigital Systems5 Conversions between binary ﹐ octal ﹐ and hexadecimal can be done in a simpler way. Ex1. Convert ( ) 2 to octal and hexadecimal (2723) (5D3) 16 5 D 3 Ex2. Convert (12A7F) 16 to binary and octal. 1 2 A 7 F binary octal

Yuh-Jzer JoungDigital Systems6 Complement ﹕ for simplifying subtraction. Two types of complements for each base-r system ﹕ (r-1)’s complement r’s complement The (r-1)’s complement of an n-digital number N ﹕ ( r n  1)  N Ex. In decimal system ﹐ the 9’s complement of is (10 6  1)  =  = The 9’s complement of is  = The 1’s complement of is (2 8  1)  =  = The 1’s complement of is

Yuh-Jzer JoungDigital Systems7 The r’s complement of an n-digital number N ﹕ r n  N N ≠0 0 N = 0 Ex. The 10’s complement of is The 10’s complement of is The 2’s complement of is The 2’s complement of is Comments ﹕ 1.To compute the complement of a number having radix point, first ﹐ remove the radix point ﹐ compute the complement of the new number ﹐ and restore the radix point. Ex. The 1’s complement of is The 2’s complement of is

Yuh-Jzer JoungDigital Systems8 2.The complement of the complement of N is N. (r  1)’s complement of (2 n  1)  N = (2 n  1)  ((2 n  1)  N) = N Signed Binary Numbers Addition ﹕ Subtraction ﹕  13  1101  4 ?

Yuh-Jzer JoungDigital Systems9 How do we represent signed numbers in digital systems? representation of +9 with 8 bits: representation of  9: signed magnitude: signed -1’s-complement: signed -2’s-complement: Numbers that can be represented in n bits: signed magnitude: (  2 n  1 +1) ~ (2 n  1  1) signed-1’s-complement: (  2 n  1 +1) ~ (2 n  1  1) signed-2’s-complement: (  2 n  1 ) ~ (2 n  1  1)

Yuh-Jzer JoungDigital Systems10 Addition and Subtraction on signed-magnitude numbers       Summary: to perform arithmetic operations on signed magnitude numbers, we need to compare the signs and the magnitudes of the two numbers, and then perform either addition or subtraction.

Yuh-Jzer JoungDigital Systems11 Addition and subtraction on signed-2’s-complement numbers: Addition: add the corresponding digits ( including the sign digits) and ignore any carry out  discarded carryout

Yuh-Jzer JoungDigital Systems   the 2’s complement of (4)    the 2’s complement of (22) Discussion: (  N) + (M)  (2 n  N) + M = 2 n  (N  M) Case N > M: there will be no carry out, and the result is the 2’s complement of (N  M) N  M: = 2 n + (M  N) there will be a carry out, and the result after discarding the carry out is (M  N)

Yuh-Jzer JoungDigital Systems13 overflow:    negative! positive! using 8 bits, we can represent only -128 ~ +127! When add two n-bits (including the sign bit) numbers N and M, overflow occurs when: 1. N, M  0, N+M  2 n  1  1 2. N, M < 0, N+M   2 n  1 Note that overflow cannot occur if one of N and M is positive and the other is negative.

Yuh-Jzer JoungDigital Systems14 Subtraction: N  M = N+ (  M) = N + (2’s complement of M)  13   ’s complement of

Yuh-Jzer JoungDigital Systems15 Addition and Subtraction on Signed-1’s-complement numbers: Assume that M, N  0, and they have n bits (including sign) Case M + N : normal binary addition Case  N + M : (1’s complement of N) + M = [(2 n  1)  N] + M = (2 n  1)  (N  M) Sub-case: N  M  0: there will be no carry. Sub-case: N  M  0: (2 n  1)  (N  M) = 2 n + (M  N)  1 carry bit  0 So there will be a carry. To obtain (M  N), we discard the carry and add 1 to the result.

Yuh-Jzer JoungDigital Systems16 Ex.  end-around carry Case (  N) + (  M) =  (N+M) : (1’s complement of N) + (1’s complement of M) = [(2 n  1)  N] + [(2 n  1)  M] = 2 n  1 + (2 n  1)  (N+M) carry 1’s complement of (N+M) We obtain (2 n  1)  (N  M) by discarding the carry and adding 1 to the result.    ’s complement of (22)

Yuh-Jzer JoungDigital Systems17 Overflow: Similar to the case of 2’s complement, an overflow occurs when N+M  2 n  1  1 or (  N) + (  M)   2 n  1 +1 An overflow can be detected by examining the most significant bit of the result (positive) (positive) (negative)  (negative)  96  (negative)  (positive) carry

Yuh-Jzer JoungDigital Systems18 Comparison of the three signed numbers systems : signed-magnitude: useful in ordinary arithmetic, awkward in computer arithmetic signed-1’s-complement: used in old computers, but is now seldom used. signed-2’s-complement: used in most computers.

Yuh-Jzer JoungDigital Systems19 Binary Codes Binary codes can be established for any set of discrete elements. Using n bits, we can represent at most 2 n distinct elements. So, to represent m distinct objects, we need at least  log 2 m  bits. For example, we need  log 2 10  = 4 bits to represent { 0,1,…9}. MAN(1) WOMAN (0) WHITE(00) RED(01) BLUE(10) BLACK(11)

Yuh-Jzer JoungDigital Systems20 Decimal BCD Excess Bi-quinary digits (8421) ( ) Some possible binary codes are illustrated below.

Yuh-Jzer JoungDigital Systems21 Alphanumeric Codes -- ASCII (American Standard Code for Information Interchange) originally use 7 bits to code 128 characters since most digital systems handle 8-bit (byte) more efficiently, an 8 bit version ASCII has also been developed. -- EBDIC (Extended Binary-Coded Decimal Interchange Code) used in most IBM systems use 8 bits to code the same 128 character symbols as ASCII Gray Code each binary code differs from either its successor or predecessor by only one bit.

Yuh-Jzer JoungDigital Systems22 Decimal Gray Code bit Gray Code

Yuh-Jzer JoungDigital Systems23 Gray Code is often used in situations where other binary code might produce erroneous or ambiguous results during transitions from one code to another. If we use BCD code to transmit 0111 (7) and then 1000 (8), then, an erroneous intermediate code 1001 may be generated if the rightmost bit takes more time to change. The Gray code eliminates this problem since only one bit changes between two consecutive numbers. A/D Converter Transmitter Receiver

Yuh-Jzer JoungDigital Systems24 Generation of Gray Codes: an n-bits code is generated by reflecting the (n-1)-bit code

Yuh-Jzer JoungDigital Systems25 Error-Detecting Code Binary code that can detect errors during data transmission. The most common ways to achieve error-detection is by means of a parity bit. A parity bit is an extra bit included in a binary code to make the total number of 1’s transmitted either odd (odd parity) or (even parity). odd parity even parity message parity bit message parity bit Transmitter  source Parity generator ERROR  destination Parity detector Receiver

Yuh-Jzer JoungDigital Systems26 4-bits Adder FA x3x3 x1x1 y1y1 x0x0 y0y0 x2x2 y2y2 y3y3 S3S3 S0S0 S1S1 S2S2 c0c0 c4c4 c2c2 c1c1 c3c3 Full Adder xy cz S Digital Circuits

Yuh-Jzer JoungDigital Systems27 NameTruth TableAlgebraic Function AND F = xy OR F = x+y Inverter F = x’ Buffer F = x NAND F = (xy)’ Gate

Yuh-Jzer JoungDigital Systems28 NOR F = (x+y)’ Exclusive-OR (XOR) F = xy’+x’y = x  y Exclusive-NOR (equivalence) F = xy+x’y’ = x  y

Yuh-Jzer JoungDigital Systems29 Extension to multiple inputs xyzxyz x y z

Yuh-Jzer JoungDigital Systems30 In real implementation, the three-input Exclusive-OR is usually implemented by 2-input Exclusive-OR: Even a two input Exclusive-OR is usually constructed with other types of gates. x’y+y’x x  y  z x  y = x’y+xy’

Yuh-Jzer JoungDigital Systems31 This is how a gate adds a binary 1 and 0 in the “ones” place. If you feed a 1 and a 0 to the gate, it puts out a 1, which is the correct result of adding a binary 1 and 0. Place

Yuh-Jzer JoungDigital Systems32 Place Addition with a carryover is a little more difficult, for instance, adding 1 plus 1. If you feed the gate a 1 and 1, it will put a 0 in the “ones” place and put a carryover of 1 in the “twos” place. This produces the correct result for adding 1 and 1 in binary.

Yuh-Jzer JoungDigital Systems33 c = f(x,y,z) =  (3,5,6,7) s =  (1,2,4,7) c: s: y y z x c = xy+yz+xz s = x’y’z+x’yz’+xy’z’+xyz y z x y

Yuh-Jzer JoungDigital Systems34 (a) S = xy’+x’y C = xy (b) S = (x+y)(x’+y’) C = xy Various Implementations of a half-adder

Yuh-Jzer JoungDigital Systems35 (c) S = (C + x’y’)’ C = xy (d) S = (x+y)(x’+y’) C = xy (e) S = x  y C = xy

Yuh-Jzer JoungDigital Systems36 Binary Adder and Subtractor = x  y  z = xy + yz + xz 4-bit parallel adder

Yuh-Jzer JoungDigital Systems37 4-bit adder-subtractor