Chapter 03 The Language of Bits

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

The Language of Bits

Computer Architecture and Organization

Chapter 3 The Language of Bits

PROPRIETARY MATERIAL. © 2014 The McGraw-Hill Companies, Inc. All rights reserved. No part of this PowerPoint slide may be displayed, reproduced or distributed in any form or by any
means, without the prior written permission of the publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual course preparation.
PowerPoint Slides are being provided only to authorized professors and instructors for use in preparing for classes using the affiliated textbook. No other use or distribution of this PowerPoint slide
is permitted. The PowerPoint slide may not be sold and may not be distributed or be used by any student or any other third party. No part of the slide may be reproduced, displayed or distributed in
any form or by any means, electronic or otherwise, without the prior written permission of McGraw Hill Education (India) Private Limited.
1
Outline

 Boolean Algebra
 Positive Integers
 Negative Integers
 Floating-Point Numbers
 Strings

2
What does a Computer Understand ?
 Computers do not understand natural human languages, nor
programming languages
 They only understand the language of bits

Bit 0 or 1

Byte 08 or
bits1

Word 40bytes
or 1

kiloByte 1024 bytes


0 or 1

megaByte 1006 or
bytes
1

3
Number systems
 Is defined as a system of writing to express numbers.
 It is the mathematical notation for representing numbers of a given set
by using digits or other symbols in a consistent manner.
 It provides a unique representation of every number and represents the
arithmetic and algebraic structure of the figures.
 It also allows us to operate arithmetic operations like addition,
subtraction, multiplication and division.
 The value of any digit in a number can be determined by:
 The digit
 Its position in the number
 The base of the number system
Types of Number Systems

 There are various types of number systems in mathematics.


The four most common number system types are:
1. Decimal number system (Base - 10)
2. Binary number system (Base - 2)
3. Octal number system (Base - 8)
4. Hexadecimal number system (Base - 16)
Types of Number Systems (1)

Decimal Number System (Base 10 Number System)


 The decimal number system has a base of 10 because it uses ten digits from 0 to 9.
 In the decimal number system, the positions successive to the left of the decimal point
represent units, tens, hundreds, thousands and so on.
 This system is expressed in decimal numbers.
 Every position shows a particular power of the base (10).

Binary number system (Base - 2)


 The base 2 number system is also known as the Binary number system wherein, only
two binary digits exist, i.e., 0 and 1.
 Specifically, the usual base-2 is a radix of 2.
 The figures described under this system are known as binary numbers which are the
combination of 0 and 1.
Types of Number Systems (2)
Octal Number System (Base – 8)
 In the octal number system, the base is 8 and it uses numbers from 0 to 7 to
represent numbers.
 Octal numbers are commonly used in computer applications.

Hexadecimal number system (Base - 16)


 In the hexadecimal system, numbers are written or represented with base 16.
 In the hexadecimal system, the numbers are first represented just like in the
decimal system, i.e. from 0 to 9.
 The numbers are represented using the alphabet from A to F.
 The below-given table shows the representation of numbers in the hexadecimal
number system.
Common Number Systems

Used by Used in
System Base Symbols humans? computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
Hexa- 16 0, 1, … 9, No No
decimal A, B, … F
Quantities/Counting (1)
Hexa-
Decimal Binary Octal decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
Quantities/Counting (1 of 2)
Hexa-
Decimal Binary Octal decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Conversion Among Bases
• The possibilities:

Decimal Octal

Binary Hexadecimal
Binary to decimal Conversion
Decimal-to-Binary
Conversion

Binary-to-Decimal
Conversion
Binary to decimal Conversion

 Humans use base ten (or decimal), because we have ten fingers and
that digital electronics uses base-two (binary) because it only
understands two states; ON and OFF.
 For students to be able to analyze and design digital electronics,
they need to be proficient at converting numbers between these
two number systems.
 Base ten has ten unique symbols (0 – 9) while binary has two unique
symbols (0 – 1). Any number can represent a base and the number of
symbols it utilizes will always be that number.
Binary to decimal Conversion
The Process : Weighted Multiplication
a) Multiply each bit of the Binary Number by it corresponding bit-weighting
factor (i.e. Bit-0→20=1; Bit-1→21=2; Bit-2→22=4; etc).
b) Sum up all the products in step (a) to get the Decimal Number.

Example:
Convert the decimal number 01102 into its decimal equivalent.

0 1 1 0
 0110 2 = 6 10
8 4 2 1
0 + 4 + 2 + 0 = 610
Review of Logical Operations
 A + B (A or B) A B A+B
0 0 0
1 0 1
0 1 1
1 1 1

A B A.B
 A.B ( A and B) 0 0 0
1 0 0
0 1 0
1 1 1

15
Review of Logical Operations - II
A B A NAND B A B A NOR B

0 0 1 0 0 1
1 0 1 1 0 0

0 1 1 0 1 0

1 1 0 1 1 0

 NAND and NOR operations


 These are universal operations. They can be used to
implement any Boolean function.

16
Review of Logical Operations

 XOR Operation : (A B)
A B A XOR B

0 0 0
1 0 1
0 1 1
1 1 0

17
De Morgan's Laws

 Two very useful rules

A + B = A.B

A.B = A + B

18
Binary Number System

 They would use a number system with


base 2.
Number in decimal Number in binary
5 101
100 1100100
500 111110100
1024 10000000000

19
Hexadecimal and Octal Numbers

 Hexadecimal numbers
 Base 16 numbers – 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
 Start with 0x

 Octal Numbers
 Base 8 numbers – 0,1,2,3,4,5,6,7
 Start with 0

20
ASCII Character Set
 ASCII – American Standard Code for Information
Interchange
 It has 128 characters
 First 32 characters (control operations)
 backspace (8)
 line feed (10)
 escape (27)
 Each character is encoded using 7 bits

21
ASCII Character Set
Character Code Character Code Character Code
a 97 A 65 0 48
b 98 B 66 1 49
c 99 C 67 2 50
d 100 D 68 3 51
e 101 E 69 4 52
f 102 F 70 5 53
g 103 G 71 6 54
h 104 H 72 7 55
i 105 I 73 8 56
j 106 J 74 9 57
k 107 K 75 ! 33
l 108 L 76 # 35
m 109 M 77 $ 36
n 110 N 78 % 37
o 111 O 79 & 38
p 112 P 80 ( 40
q 113 Q 81 ) 41
r 114 R 82 * 42
s 115 S 83 + 43
t 116 T 84 , 44
u 117 U 85 . 46
v 118 V 86 ; 59
w 119 W 87 = 61
x 120 X 88 ? 63
y 121 Y 89 @ 64
z 122 Z 90 ^ 94

22
THE END

23

You might also like