Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh.

Slides:



Advertisements
Similar presentations
COMP 2130 Intro Computer Systems Thompson Rivers University
Advertisements

A digital system is a system that manipulates discrete elements of information represented internally in binary form. Digital computers –general purposes.
Chapter 1 Digital Systems and Numbers System
Chapter 1 Binary Systems 1-1. Digital Systems
Digital Fundamentals Floyd Chapter 2 Tenth Edition
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 Fundamentals Floyd Chapter 2 Tenth Edition
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Digital Computers and Information
Information Representation and Number Systems BIL- 223 Logic Circuit Design Ege University Department of Computer Engineering.
EE 261 – Introduction to Logic Circuits
Mantıksal Tasarım – BBM231 M. Önder Efe
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
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.
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
Digital Systems and Logic Design
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Chapter 3 Data Representation
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.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Week #5 Arithmetic Circuits
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.
مدار منطقي مظفر بگ محمدي Course Structure & Grading Homework: 25% Midterm: 30% Final:50% There is 5% extra! ( =105!) Textbook:
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.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
IT101: INFORMATION TECHNOLOGY FUNDAMENTALS 1 Edited By Dr. Ahmed Abo-Bakr Information Technology Dept. Faculty of Computers & Information.
ENG241 Digital Design Week #1 Digital Computers and Information.
ECE 331 – Digital System Design
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)
Dr. Ahmed Telba EE208: Logic Design Lecture# 1 Introduction & Number Systems.
Number Base Conversions
1 Dr. Mohamed Abdur Rahman Office hours Sunday: 10:00- 12:00 & Tuesday: 3:00 - 3:50 Course website: Has been created
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
Digital Systems and Binary Numbers
Tutorial: ITI1100 Dewan Tanvir Ahmed SITE, UofO
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Chapter 1 Digital Systems and Binary Numbers
1 CHAPTER 1 DIGITAL SYSTEMS AND BINARY NUMBERS 2 O UTLINE OF C HAPTER Digital Systems 1.2 Binary Numbers 1.3 Number-base Conversions 1.4 Octal.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
MECH1500 Chapter 3.
D IGITAL C IRCUITS Book Title: Digital Design Edition: Fourth Author: M. Morris Mano 1.
Chapter 1: Binary Systems
CPEN Digital Logic Design Binary Systems Spring 2004 C. Gerousis © Digital Design 3 rd Ed., Mano Prentice Hall.
Digital Logic Design Lab 1,2 By Nora Alaqeel.
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.
DIGITAL DESIGN THIRD EDITION M. MORRIS MANO
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.
Week 1(Number System) Muhammad Ammad uddin Logic Design Lab I (CEN211)
Chapter 1 Introduction Digital Systems Digital systems: computation, data processing, control, communication, measurement - Reliable, Integration.
Chapter 1 Digital Systems and Binary Numbers
ENG2410 Digital Design “Introduction to Digital Systems”
Digital Systems and Binary Numbers
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
CHAPTER 1 : INTRODUCTION
Digital Systems and Binary Numbers
Chapter 3 Data Representation
Chapter 1 Digital Systems and Binary Numbers
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
INTRODUCTION TO LOGIC DESIGN Chapter 1 Digital Systems and Binary Numbers gürtaçyemişçioğlu.
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
Presentation transcript:

Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh

Princess Sumaya Univ. Computer Engineering Dept. Chapter 1:

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 2 / 45 Digital Systems  Discrete Data ●Examples: ♦ 26 letters of the alphabet (A, B … etc) ♦ 10 decimal digits (0, 1, 2 … etc) ●Combine together ♦ Words are made of letters (University … etc) ♦ Numbers are made of digits (4241 … etc)  Binary System ●Only ‘0’ and ‘1’ digits ●Can be easily implemented in electronic circuits AnalogDiscrete

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 3 / 45 Decimal Number System  Base (also called radix) = 10 ●10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }  Digit Position ●Integer & fraction  Digit Weight ●Weight = (Base) Position  Magnitude ●Sum of “Digit x Weight”  Formal Notation d 2 *B 2 +d 1 *B 1 +d 0 *B 0 +d -1 *B -1 +d -2 *B -2 (512.74) 10

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 4 / 45 Octal Number System  Base = 8 ●8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }  Weights ●Weight = (Base) Position  Magnitude ●Sum of “Digit x Weight”  Formal Notation /8641/ * * * * *8 - 2 =( ) 10 (512.74) 8

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 5 / 45 Binary Number System  Base = 2 ●2 digits { 0, 1 }, called b inary dig its or “bits”  Weights ●Weight = (Base) Position  Magnitude ●Sum of “Bit x Weight”  Formal Notation  Groups of bits 4 bits = Nibble 8 bits = Byte /241/ * * * * *2 - 2 =(5.25) 10 (101.01)

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 6 / 45 Hexadecimal Number System  Base = 16 ●16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }  Weights ●Weight = (Base) Position  Magnitude ●Sum of “Digit x Weight”  Formal Notation / /256 1E57A 1 * * * * *16 -2 =( ) 10 (1E5.7A) 16

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 7 / 45 The Power of 2 n2n2n 02 0 = = = = = = = =128 n2n2n 82 8 = = = = = =1M =1G =1T Mega Giga Tera Kilo

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 8 / 45 Addition  Decimal Addition = Ten ≥ Base  Subtract a Base 11Carry

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 9 / 45 Binary Addition  Column Addition ≥ (2) = 61 = 23 = 84

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 10 / 45 Binary Subtraction  Borrow a “Base” when needed − = (10) = 77 = 23 = 54

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 11 / 45 Binary Multiplication  Bit by bit x

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 12 / 45 Number Base Conversions Decimal (Base 10) Octal (Base 8) Binary (Base 2) Hexadecimal (Base 16) Evaluate Magnitude

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 13 / 45 Decimal (Integer) to Binary Conversion DD ivide the number by the ‘Base’ (=2) TT ake the remainder (either 0 or 1) as a coefficient TT ake the quotient and repeat the division Example: ( 13 ) 10 QuotientRemainder Coefficient Answer: (13) 10 = (a 3 a 2 a 1 a 0 ) 2 = (1101) 2 MSB LSB 13 / 2 = 61 a 0 = 1 6 / 2 = 30 a 1 = 0 3 / 2 = 11 a 2 = 1 1 / 2 = 01 a 3 = 1

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 14 / 45 Decimal (Fraction) to Binary Conversion MM ultiply the number by the ‘Base’ (=2) TT ake the integer (either 0 or 1) as a coefficient TT ake the resultant fraction and repeat the division Example: ( ) 10 IntegerFraction Coefficient Answer: (0.625) 10 = (0.a -1 a -2 a -3 ) 2 = (0.101) 2 MSB LSB * 2 = * 2 = 0. 5 a -2 = * 2 = 1. 0 a -3 = 1 a -1 = 1

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 15 / 45 Decimal to Octal Conversion Example: ( 175 ) 10 QuotientRemainder Coefficient Answer: (175) 10 = (a 2 a 1 a 0 ) 8 = (257) / 8 = 217 a 0 = 7 21 / 8 = 25 a 1 = 5 2 / 8 = 02 a 2 = 2 Example: ( ) 10 IntegerFraction Coefficient Answer: (0.3125) 10 = (0.a -1 a -2 a -3 ) 8 = (0.24) * 8 = * 8 = 4. 0 a -2 = 4 a -1 = 2

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 16 / 45 Binary − Octal Conversion  8 = 2 3  Each group of 3 bits represents an octal digit OctalBinary Example: ( ) 2 ( ) 8 Assume Zeros Works both ways (Binary to Octal & Octal to Binary)

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 17 / 45 Binary − Hexadecimal Conversion  16 = 2 4  Each group of 4 bits represents a hexadecimal digit HexBinary A1 0 B C D E F1 1 Example: ( ) 2 ( ) 16 Assume Zeros Works both ways (Binary to Hex & Hex to Binary)

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 18 / 45 Octal − Hexadecimal Conversion  Convert to Binary as an intermediate step Example: ( ) 2 ( ) 16 Assume Zeros Works both ways (Octal to Hex & Hex to Octal) ( ) 8 Assume Zeros

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 19 / 45 Decimal, Binary, Octal and Hexadecimal DecimalBinaryOctalHex A B C D E F

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 20 / 45 Complements 11 ’s Complement (Diminished Radix Complement) ●A●All ‘0’s become ‘1’s ●A●All ‘1’s become ‘0’s Example ( ) 2  ( ) 2 If you add a number and its 1’s complement …

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 21 / 45 Complements 22 ’s Complement (Radix Complement) ●T●Take 1’s complement then add 1 ●T●Toggle all bits to the left of the first ‘1’ from the right Example: Number: 1’s Comp.: OR

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 22 / 45 Negative Numbers CC omputers Represent Information in ‘0’s and ‘1’s ●‘●‘+’ and ‘−’ signs have to be represented in ‘0’s and ‘1’s 33 Systems ●S●Signed Magnitude ●1●1’s Complement ●2●2’s Complement All three use the left-most bit to represent the sign: ♦‘♦‘ 0’  positive ♦‘♦‘ 1’  negative

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 23 / 45 Signed Magnitude Representation MM agnitude is magnitude, does not change with sign (+3) 10  ( ) 2 (−3) 10  ( ) 2 CC an’t include the sign bit in ‘Addition’  (+3)  (−3)  (−6) 10 SignMagnitude SMagnitude (Binary)

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 24 / 45 1’s Complement Representation PP ositive numbers are represented in “Binary” NN egative numbers are represented in “1’s Comp.” (+3) 10  (0 011) 2 (−3) 10  (1 100) 2 TT here are 2 representations for ‘0’ (+0) 10  (0 000) 2 (−0) 10  (1 111) 2 0Magnitude (Binary) 1Code (1’s Comp.)

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 25 / 45 1’s Complement Range  4-Bit Representation 2 4 = 16 Combinations − 7 ≤ Number ≤ + 7 − ≤ Number ≤ +2 3 − 1  n-Bit Representation −2 n−1 +1 ≤ Number ≤ +2 n−1 − 1 Decimal1’s Comp − 01 1 − − − − − 51 0 − −

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 26 / 45 2’s Complement Representation PP ositive numbers are represented in “Binary” NN egative numbers are represented in “2’s Comp.” (+3) 10  (0 011) 2 (−3) 10  (1 101) 2 TT here is 1 representation for ‘0’ (+0) 10  (0 000) 2 (−0) 10  (0 000) 2 0Magnitude (Binary) 1Code (2’s Comp.) 1’s Comp

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 27 / 45 2’s Complement Range  4-Bit Representation 2 4 = 16 Combinations − 8 ≤ Number ≤ + 7 −2 3 ≤ Number ≤ − 1  n-Bit Representation −2 n−1 ≤ Number ≤ + 2 n−1 − 1 Decimal2’s Comp − 11 1 − − − − − 61 0 − −

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 28 / 45 Number Representations  4-Bit Example Unsigned Binary Signed Magnitude 1’s Comp.2’s Comp. Range0 ≤ N ≤ 15-7 ≤ N ≤ ≤ N ≤ +7 Positive Binary Negative X Binary1’s Comp.2’s Comp

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 29 / 45 Binary Subtraction Using 1’s Comp. Addition CC hange “Subtraction” to “Addition” II f “Carry” = 1 then add it to the LSB, and the result is positive (in Binary) II f “Carry” = 0 then the result is negative (in 1’s Comp.) (5) 10 – (1) 10 (+5) 10 + (-1) (5) 10 – (6) 10 (+5) 10 + (-6) − 1 1

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 30 / 45 Binary Subtraction Using 2’s Comp. Addition CC hange “Subtraction” to “Addition” II f “Carry” = 1 ignore it, and the result is positive (in Binary) II f “Carry” = 0 then the result is negative (in 2’s Comp.) (5) 10 – (1) 10 (+5) 10 + (-1) (5) 10 – (6) 10 (+5) 10 + (-6) − 1

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 31 / 45 Binary Codes GG roup of n bits ●U●Up to 2 n combinations ●E●Each combination represents an element of information BB inary Coded Decimal (BCD) ●E●Each Decimal Digit is represented by 4 bits ●(●(0 – 9)  Valid combinations ●(●(10 – 15)  Invalid combinations DecimalBCD

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 32 / 45 BCD Addition OO ne decimal digit + one decimal digit ●I●If the result is 1 decimal digit ( ≤ 9 ), then it is a simple binary addition Example: ●I●If the result is two decimal digits ( ≥ 10 ), then binary addition gives invalid combinations Example:

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 33 / 45 BCD Addition II f the binary result is greater than 9, correct the result by adding Two Decimal Digits Multiple Decimal Digits

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 34 / 45 Gray Code OO ne bit changes from one code to the next code DD ifferent than Binary DecimalGray Binary

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 35 / 45 ASCII Code American Standard Code for Information Interchange Info7-bit Code A B Z a b ?

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 36 / 45 Error Detecting Codes PP arity One bit added to a group of bits to make the total number of ‘1’s (including the parity bit) even or odd ●E●Even ●O●Odd GG ood for checking single-bit errors bit Example 7-bit Example

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 37 / 45 Binary Logic  Operators ●NOT If ‘x’ = 0thenNOT ‘x’ = 1 If ‘x’ = 1thenNOT ‘x’ = 0 ●AND If ‘x’ = 1 AND ‘y’ = 1then‘z’ = 1 Otherwise‘z’ = 0 ●OR If ‘x’ = 1 OR ‘y’ = 1then‘z’ = 1 Otherwise‘z’ = 0

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 38 / 45 Binary Logic  Truth Tables, Boolean Expressions, and Logic Gates xyz xyz xz ANDORNOT z = x y = x yz = x + yz = x = x’

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 39 / 45 Logic Signals BB inary ‘0’ is represented by a “low” voltage (range of voltages) BB inary ‘1’ is represented by a “high” voltage (range of voltages) TT he “voltage ranges” guard against noise of binary signalsExample

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 40 / 45 Switching Circuits ANDOR

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 41 / 45 Homework  Mano ●Chapter 1 ♦ 1-2 ♦ 1-7 ♦ 1-9 ♦ 1-10 ♦ 1-11 ♦ 1-16 ♦ 1-18 ♦ 1-20 ♦ 1-24(a) ♦ 1-29  Write your family name in ASCII with odd parity  Decode the following ASCII string (with MSB = parity): Is the parity even or odd?

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 42 / 45 Homework  Mano 1-2What is the exact number of bytes in a system that contains (a) 32K byte, (b) 64M byte, and (c) 6.4G byte? 1-7Express the following numbers in decimal: ( ) 2, (16.5) 16, and (26.24) Convert the hexadecimal number 68BE to binary and then from binary convert it to octal. 1-10Convert the decimal number 345 to binary in two ways: (a) convert directly to binary, (b) convert first to hexadecimal, then from hexadecimal to binary. Which method is faster?

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 43 / 45 Homework 1-11Do the following conversion problems: (a) Convert decimal to binary. (b) Calculate the binary equivalent of 1/3 out to 8 places. Then convert from binary to decimal. How close is the result to 1/3? (c) Convert the binary result in (b) into hexadecimal. Then convert the result to decimal. Is the answer the same? 1-16Obtain the 1’s and 2’s complements of the following binary numbers: (a) (b) (c) (d) (e)

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 44 / 45 Homework 1-18Perform subtraction on the following unsigned binary numbers using the 2’s-complement of the subtrahend. Where the result should be negative, 2’s complement it and affix a minus sign. (a) – (b) – (c) 1011 – (d) – Convert decimal +61 and +27 to binary using the signed- 2’s complement representation and enough digits to accommodate the numbers. Then perform the binary equivalent of (+27) + (– 61), (–27) + (+61) and (–27) + (–61). Convert the answers back to decimal and verify that they are correct.

Princess Sumaya University 4241 – Digital Logic Design Computer Engineering Dept. 45 / 45 Homework 1-24Represent decimal number 6027 in (a) BCD 1-29The following is a string of ASCII characters whose bit patterns have been converted into hexadecimal for compactness: 4A EF 68 6E 20 C4 EF E5. Of the 8 bits in each pair digit, the leftmost is a parity bit. The remaining bits are the ASCII code. (a) Convert to bit form and decode the ASCII (b) Determine the parity used: odd or even.