Outline. What Digit? => Number System. Decimal (base 10) Significant Digits. Lect 03 Number System, Gates, Boolean Algebra. CS221: Digital Design

Similar documents
Octal & Hexadecimal Number Systems. Digital Electronics

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

EE292: Fundamentals of ECE

Number representations

The. Binary. Number System

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

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

Chapter 1 Review of Number Systems

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

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

Digital Systems and Binary Numbers

DIGITAL SYSTEM DESIGN

MACHINE LEVEL REPRESENTATION OF DATA

2 Number Systems 2.1. Foundations of Computer Science Cengage Learning

CS & IT Conversions. Magnitude 10,000 1,

COMP Overview of Tutorial #2

CMPE223/CMSE222 Digital Logic Design. Positional representation

CHAPTER 2 (b) : AND CODES

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

CHW 261: Logic Design

1. Mark the correct statement(s)

Digital Logic Lecture 2 Number Systems

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

CHAPTER 2 Number Systems

Number Systems CHAPTER Positional Number Systems

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

Lecture 1: Digital Systems and Number Systems

DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM

Chapter 3 DATA REPRESENTATION

DATA REPRESENTATION. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift, Jaipur Region. Based on CBSE curriculum Class 11. Neha Tyagi, KV 5 Jaipur II Shift

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

Introduction to Numbering Systems

6. Binary and Hexadecimal

Lecture 2: Number Systems

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

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

MC1601 Computer Organization

Arithmetic and Bitwise Operations on Binary Data

Chapter Overview. Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts. Printing this Slide Show

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

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

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

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

Logic design Ibn Al Haitham collage /Computer science Eng. Sameer

CS222: Processor Design

Chapter 2: Number Systems

TOPIC: NUMBER SYSTEMS

History of Computing. Ahmed Sallam 11/28/2014 1

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

Number System. Introduction. Decimal Numbers

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

World Inside a Computer is Binary

Korea University of Technology and Education

Introduction to Computers and Programming. Numeric Values

Numbering systems. Dr Abu Arqoub

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

Princeton University Computer Science 217: Introduction to Programming Systems. Goals of this Lecture. Number Systems and Number Representation

Digital Fundamentals

Computer Logical Organization Tutorial

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

D I G I T A L C I R C U I T S E E

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal

THE LOGIC OF COMPOUND STATEMENTS

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

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

Number Systems and Number Representation

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Logic Design: Part 2

Chapter 10 Binary Arithmetics

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

Bits and Bytes. Why bits? Representing information as bits Binary/Hexadecimal Byte representations» numbers» characters and strings» Instructions

Binary. Hexadecimal BINARY CODED DECIMAL

Lecture (04) Boolean Algebra and Logic Gates

Lecture (04) Boolean Algebra and Logic Gates By: Dr. Ahmed ElShafee

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

This tutorial gives a complete understanding on Computer Logical Organization starting from basic computer overview till its advanced architecture.

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

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

Chapter 4. Operations on Data

Final Labs and Tutors

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

Review. EECS Components and Design Techniques for Digital Systems. Lec 05 Boolean Logic 9/4-04. Seq. Circuit Behavior. Outline.

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Winter Notes - Unit 4. hundreds.

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

LECTURE 1-2. Introduction and Number Systems

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.

1.3 Systems of numeration: To represent quantities in the different systems of numeration, specific symbols are used, which are also called ciphers.

CS/COE 0447 Example Problems for Exam 2 Spring 2011

9/23/15. Agenda. Goals of this Lecture. For Your Amusement. Number Systems and Number Representation. The Binary Number System

Arithmetic and Bitwise Operations on Binary Data

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng

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

Software and Hardware

Transcription:

Lect 3 Number System, Gates, Boolean Algebra CS22: Digital Design Dr. A. Sahu Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati Outline Number System Decimal, Binary, Octal, Hex Conversions Operations: Add, Sub, Mul, Div, Complement Gates in Digital System Basic Gates (AND, OR & NOT) Universal Gates (NAND & NOR) Others : XOR, XNOR Boolean Algebra Axioms Boolean Functions 2 Number System Number System Decimal, Binary, Octal, Hex Conversion (one to another) Decimal to Binary, Octal, Hex & Vice Versa Binary to HEX & vice versa Other representation Signed, Unsigned, Complement Operation Add, Sub, Mul, Div, Mod 3 What Digit? => Number System Famous Number System: Decimal, Binary, Octal, Hexa decimal Decimal System: 9 May evolves: because human have finger Binary System, Others (Oct, Hex) 4 Significant Digits Decimal (base ) Binary: Most significant digit Least significant digit Decimal: 6379 Most significant digit Least significant digit Uses positional representation Each digit corresponds to a power of based on its position in the number The powers of increment from,, 2, etc. as you move right to left,479 = * 3 + 4 * 2 + 7 * + 9 *

Binary (base 2) Two digits:, To make the binary numbers more readable, the digits are often put in groups of 4 = * 2 3 + * 2 2 + * 2 + * 2 = + 2 = = *2 7 + *2 6 + *2 3 + *2 = 2 + 64 + + = 2 How to Encode Numbers: Binary Numbers Working with binary numbers In base ten, helps to know powers of one, ten, hundred, thousand, ten thousand,... In base two, helps to know powers of 2 one, two, four, eight, sixteen, thirty two, sixty four, one hundred twenty eight Count up by powers of two 2 9 2 2 7 2 6 2 5 52 256 2 64 32 2 4 2 3 2 2 2 2 6 4 2 a Octal (base ) Shorter & easier to read than binary digits:,, 2, 3, 4, 5, 6, 7, Octal numbers 36 = * 2 + 3* + 6* = *64 + 3* + 6 * = 94 Hexadecimal (base 6) Shorter & easier to read than binary 6 digits:,, 2, 3, 4, 5, 6, 7,, 9, A, B, C, D, E, F x often precedes hexadecimal numbers x23 = *6 2 + 2*6 + 3*6 = *256 + 2*6 + 3* = 256 + 32 + 3 = 29 Counting Decimal Binary Octal Hexadecimal Counting Decimal Binary Octal Hexadecimal 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 9 9 2 A 3 B 2 4 C 3 5 D 4 6 E 5 7 F 6 2 2 2

Fractional Number Point: Decimal Point, Binary Point, Hexadecimal point Decimal 247.7575 = 2x 2 +4x +7x +7x +5x 2 Fractional Number Point: Decimal Point, Binary Point, Hexadecimal point Binary.= = x2 +x2 +x2 +x2 2 +x2 3 Hexadecimal 6A.7D=6x6 +x6 +7x6 +Dx6 2 Converting To and From Decimal Decimal Binary Octal 2 3 4 5 6 7 Decimal 2 3 4 5 6 7 9 Binary 2 Hexadecimal 6 2 3 4 5 6 7 9 A B C D E F a) Divide the decimal number by 2; the remainder is the LSB of the binary number. b) If the quotation is zero, the conversion is complete. Otherwise repeat step (a) using the quotation as the decimal number. The new remainder is the next most significant bit of the binary number. 5 Decimal Binary a)multiply each bit of the binary number by its corresponding bit weighting factor (i.e., Bit 2 =; Bit 2 =2; Bit 2 2 2 =4; etc). b)sum up all of the products in step (a) to get the decimal number. Decimal to Binary : Subtraction Method Goal Good for human Get the binary weights to add up to the decimal quantity Work from left to right (Right to left may fill in s that shouldn t have been there try it). Desired decimal number: 2 32 6 4 2 =32 32 6 4 2 too much =6 32 6 4 2 too much = 32 6 4 2 ok, keep going =+4=2 32 6 4 2 DONE answer 32 6 4 2 a 3

Decimal to Binary : Method Good for computer: Divide decimal number by 2 and insert remainder into new binary number. Continue dividing quotient by 2 until the quotient is. Example: Convert decimal number 2 to binary 2 div 2 = ( Quo=6, Rem=) LSB 6 div 2 = (Quo=3, Rem=) 3 div 2 = (Quo=,Rem=) div 2 = ( Quo=, Rem=) MSB 2 = 2 Conversion Process Decimal Base N a) Divide the decimal number by N; the remainder is the LSB of the ANY BASE Number. b) If the quotient is zero, the conversion is complete. Otherwise repeat step (a) using the quotient as the decimal number. The new remainder is the next most significant bit of the ANY BASE number. a) Multiply each bit of the ANY BASE number by its corresponding bitweighting factor (i.e., Bit N ; Bit N ; Bit 2 N 2 ; etc). b) Sum up all of the products in step (a) to get the decimal number. Decimal Octal Conversion The Process: Divide number by ; R is the LSB of the octal number While Q is Using the Q as the decimal number. New remainder is MSB of the octal number. 94 r = 6 LSB r = 3 r = MSB 94 = 36 2 Decimal Hexadecimal Conversion The Process: Divide number by 6; R is the LSB of the hex number While Q is Using the Q as the decimal number. New remainder is MSB of the hex number. 6 6 5 94 5 r = E LSB r = 5 MSB 94 = 5E 6 Example: Hex Octal Example: Convert the hexadecimal number 5A H into its octal equivalent. Solution: First convert the hexadecimal number into its decimal equivalent, then convert the decimal number into its octal equivalent. 5 A 9 r = 2 LSB 6 6 6 r = 3 + = 9 r = MSB 5A H = 32 23 Example: Octal Binary Example: Convert the octal number 32 into its binary equivalent. Solution: First convert the octal number into its decimal equivalent, then convert the decimal number into its binary equivalent. 3 2 2 64 64 + 24 + 2 = 9 45 2 9 22 2 45 2 22 5 2 2 2 5 2 2 2 r = LSB r = r = r = r = r = r = MSB 32 = 2 24 4

Binary Octal Hex Shortcut Relation Binary, octal, and hex number systems All powers of two Exploit (This Relation) Make conversion easier. Substitution Code Convert 2 to hex using the 4 bit substitution code : 5 6 A E 6 A 56AE6A 6 25 Substitution Code Substitution code can also be used to convert binary to octal by using 3 bit groupings: 2 5 5 2 7 5 2 2552752 Conversion of Fractional Number Convert 63.75 to binary Integer part 63/2=>/2=>4/2=>2/2=>/2=>5/2=>2/2=> LSB Integer part: Fractional part.75*2=.75 =>.75*2=.5 =>.5*2=. Fractional part :. Total :. 2 Conversion of Fractional Number Convert.5 to binary Fractional part.5*2=.3 =>.3*2=.6 => 6*2.6 = 2.2 =>.2*2 =.4 =>.4*2 =. =>.*2 =.6 =>.6*2 =>. Repeating sequences Total :.. Other Representation Signed & Unsigned Number Signed number last bit (one MSB) is signed bit Assume: bit number Unsigned 2 : Signed +2 : Signed 2 : Complement number Unsigned binary 2 = s Complement of 2 = 29 3 5

Operations on Numbers Addition Substraction Binary Addition ne bit + = + = + = + = (Carry bit) Multibit (consider carry) + = 3 Binary Subtraction ne bit = = = (Carry bit) = Multibit (consider carry) = Subtraction 9 s complement and s complement Suppose Decimal two digit System Max number 99, Min = Substation : 55 33= 22 [55 + ( 33)] %= [55+67]%= [22]%=22 Tow s complement in Dec 99 33+ == 33 Binary Subtraction Multibit (consider carry) = Add 2 s complement= () += += Other way (add 2 s complement & discard carry) + = 2 s complement examples Express 45 in bit 2 s complement form +45 in bit form Complement it = Add to it = + 2 s complement = 36 6

Binary Repeated addition Many improved technique (Famous Partial Sum) = X =7 = + + + + = 56 37 Binary Repeated addition Many improved technique [7 is ] = X =7 = + + + + = 56 3 Binary Repeated addition Many improved technique [7 is ] = X + =7 = + + + = 56 39 Binary Booth Methods + + + Binary & Modulus = 5 3 ) ( ( ( ( ( Q==6 R== 2 ( 4 Hex Addition Addition + A + 2 B + 7 C A 6 = 9 6 D Subtraction +6 A 2 B 9 C F 3 5 C 6 Carry Value to higher significant one is 42 7

Boolean Algebra Boolean Algebra Computer hardware using binary circuit greatly simply design George Boole (3-64): developed a mathematical structure in 47 To deal with binary operations with just two values Binary circuits: To have a conceptual framework to manipulate the circuits algebraically Claude Shannon : 937, Master Thesis Basic Gates in Binary Circuit Element : FALSE. Element : TRUE. + operation OR, * operation AND and operation NOT. OR AND NOT 45 OR Gate + operation OR X Y R=X+Y OR X Y R=X OR Y R= X + Y + Y = 46 AND Gate * operation AND X Y R=X AND Y X Y R=X*Y AND R= X * Y * Y = 47 NOT Gate operation NOT or use BAR R= X R=X X X R=X R= NOT X 4

Boolean Algebra Defined Boolean Algebra B : 5-tuple {B, +, *,,, } + and * are binary operators, is a unary operator. Boolean Algebra Defined Axiom #: Closure If a and b are Boolean (a + b) and (a * b) are Boolean. Axiom #2: Cardinality/Inverse if a is Boolean then a is Boolean Axiom #3: Commutative (a + b) = (b + a) (a * b) = (b * a) Boolean Algebra Defined Axiom #4: Associative : If a and b are Boolean (a + b) + c = a + (b + c) (a * b) * c = a * (b * c) Axiom #6: Distributive a * (b + c) = (a * b) + (a * c) a + (b * c) = (a + b) * (a + c) Thanks 2 nd one is Not True for Decimal numbers System 5+(2*3) (5+2)*(5+3) 56 52 9