lecture4 binary-numbers-logic-operations

Click here to load reader

Post on 15-Jul-2015

351 views

Category:

Documents

1 download

Embed Size (px)

TRANSCRIPT

Binary Numbers & Logic Operations

IT 100- 08 IT Fundamentals Lecture 4Binary Numbers & Logic Operations1The focus of the last lecture was about the Computer SystemDuring that lecture we learnt about the various types of computers with respect to their size, capability, applications (FIVE TYPES)

And its five essential components and various subsystemBus interface unitPortModem2Learning Goals for TodayTo become familiar with number system used by the microprocessors - binary numbers

To become able to perform decimal-to-binary conversions

To understand the NOT, AND, OR and XOR logic operations the fundamental operations that are available in all microprocessors3BINARY(BASE 2)numbers4DECIMAL(BASE 10)numbers5Decimal (base 10) number system consists of 10 symbols or digits0 1 2 3 4 5 6 7 8 9 6Binary (base 2) number system consists of just two0 17Other popular number systemsOctalbase = 88 symbols (0,1,2,3,4,5,6,7)

Hexadecimalbase = 1616 symbols (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)8Decimal (base 10) numbers are expressed in the positional notation4202 = 2x100 + 0x101 + 2x102 + 4x103The right-most is the least significant digitThe left-most is the most significant digit9Decimal (base 10) numbers are expressed in the positional notation4202 = 2x100 + 0x101 + 2x102 + 4x1031s multiplier110Decimal (base 10) numbers are expressed in the positional notation4202 = 2x100 + 0x101 + 2x102 + 4x10310s multiplier1011Decimal (base 10) numbers are expressed in the positional notation4202 = 2x100 + 0x101 + 2x102 + 4x103100s multiplier10012Decimal (base 10) numbers are expressed in the positional notation4202 = 2x100 + 0x101 + 2x102 + 4x1031000s multiplier100013Binary (base 2) numbers are also expressed in the positional notation10011 = 1x20 + 1x21 + 0x22 + 0x23 + 1x24

The right-most is the least significant digitThe left-most is the most significant digit14Binary (base 2) numbers are also expressed in the positional notation10011 = 1x20 + 1x21 + 0x22 + 0x23 + 1x24

1s multiplier115Binary (base 2) numbers are also expressed in the positional notation10011 = 1x20 + 1x21 + 0x22 + 0x23 + 1x24

2s multiplier216Binary (base 2) numbers are also expressed in the positional notation10011 = 1x20 + 1x21 + 0x22 + 0x23 + 1x24

4s multiplier417Binary (base 2) numbers are also expressed in the positional notation10011 = 1x20 + 1x21 + 0x22 + 0x23 + 1x24

8s multiplier818Binary (base 2) numbers are also expressed in the positional notation10011 = 1x20 + 1x21 + 0x22 + 0x23 + 1x24

16s multiplier1619Counting in Decimal0123456789101112131415161718192021222324252627282930313233343536...

0110111001011101111000100110101011110011011110111110000100011001010011101001010110110101111100011001110101101111100111011111011111100000100001100010100011100100...Counting in Binary20Why binary?Because this system is natural for digital computers

The fundamental building block of a digital computer the switch possesses two natural states, ON & OFF.

It is natural to represent those states in a number system that has only two symbols, 1 and 0, i.e. the binary number system

In some ways, the decimal number system is natural to us humans. Why?21bitbinary digit22is the basic unit of information in computing and telecommunications; it is the amount of information that can be stored by a digital device or other physical system that can usually exist in only two distinct states. Byte = 8 bits23Conversion table 1 Kilobyte = 1,024 bytes1 Megabyte = 1, 024 KB = 1, 048, 576 bytes1 Gigabyte = 1,024 MB = 1, 048, 576 KB = 1, 073, 741, 824 bytes.24Mega = million, giga = billion, tera = trillionDecimal Binary conversion25Convert 7510 to Binary75237121812902412202102011001011

remainder26Check1001011=1x20 + 1x21 + 0x22 + 1x23 + 0x24 + 0x25 + 1x26=1 + 2 + 0 + 8 + 0 + 0 + 64=75

27Convert 10010 to Binary1002500225021212602302112011100100remainder

28Binary Decimal conversion29Convert 10002 to Decimal 10002= 0x20 + 0x21 + 0x22 + 1x23 =0 + 0 + 0 + 8=810

30Convert 1110012 to Decimal 11100121x20 = 10x21 = 00x22 = 0 1x23 = 8 1x24 = 16 1x25 = 32 5710

31Hexadecimal

Decimal conversion32Convert 100AH to Decimal 100AH10x160 = 100x161 = 00x162 = 0 1x163 = 4096 4106

33Binary

Hexadecimal conversion34Convert 100110102 to Hexadecimal 1001 10102 10 = A 9 9AH

35Hexadecimal

Binary conversion36Convert 100AH to Decimal 1 0 0 AH 1010 0000 0000 = 0001000000001010 0001 or 1000000001010

37Decimal

Octal conversion38Convert 15 to Octal1581871781st remainder

1st quotient180012nd remainder2nd quotient39Convert 264 to Octal26483326404108Check if the last quotient (MSD) is still divisible by 8. If not consider the MSD as the leftmost value then append the remainder(start with the last remainder).

1st quotient33843212nd remainder2nd quotient1st remainder40Octal

Decimal conversion41Convert 1248 to Decimal 12484x80 = 42x81 = 161x82 = 64 84

42That finishes our first topic - introduction to binary numbers and their conversion to and from decimal, hexadecimal and octal numbers.

Our next topic is 43Boolean Logic Operations44Let x, y, z be Boolean variables. Boolean variables can only have binary values i.e., they can have values which are either 0 or 1

For example, if we represent the state of a light switch with a Boolean variable x, we will assign a value of 0 to x when the switch is OFF, and 1 when it is ON45A few other names for the states of these Boolean variables01OffOnLowHighFalseTrue46We define the following logic operations or functions among the Boolean variablesNameExampleSymbolicallyNOTy = NOT(x)xANDz = x AND yx yORz = x OR yx + yXORz = x XOR yx y47Well define these operations with the help of truth tables

what is the truth table of a logic function

A truth table defines the output of a logic function for all possible inputs?48Truth Table for the NOT Operation(y true whenever x is false)xy = x0149Truth Table for the NOT Operationxy = x011050Truth Table for the AND Operation(z true when both x & y true)xyz = x y0001101151Truth Table for the AND Operationxyz = x y00001010011152Truth Table for the OR Operation(z true when x or y or both true)xyz = x + y0001101153Truth Table for the OR Operationxyz = x + y00001110111154Truth Table for the XOR Operation(z true when x or y true, but not both)xyz = x y0001101155Truth Table for the XOR Operationxyz = x y00001110111056Those 4 were the fundamental logic operations. Here are examples of a few more complex situationsz = (x + y)

z = y (x + y)

z = (y x) wSTRATEGY: Divide & Conquer57xyx + yz = (x + y)0001011010101110z = (x + y)58xyx + yz = y (x + y)0000011110101111z = y (x + y)59xywy xz = (y x) w0000000101010000110110000101011101111110z = (y x) w60Number of rows in a truth table?2nn = number of input variables61Assignment # 1Convert the following into base 2, 8 and H:The last five digits of your cellphone number256

x, y & z are Boolean variables. Determine the truth tables for the following combinations: (x y) + y (x y) + w

Whole sheet of yellow paper. Deadline: July 12 (Monday 12nn).Show your solution.62What have we learnt today?About the binary number system, and how it differs from the decimal system

Positional notation for representing binary and decimal numbers

A process (or algorithm) which can be used to convert decimal numbers to binary numbers

Basic logic operations for Boolean variables, i.e. NOT, OR, AND, XOR, NOR, NAND, XNOR

Construction of truth tables (How many rows?)63Focus of the Next LectureNext lecture will be the ?

The focus of the one after that, the 10th lecture, however, will be on software. During that lecture we will try:

To understand the role of software in computingTo become able to differentiate between system and application software

64

View more