1. 2 n computers represent information as patterns of bits n a bit (binary digit) is one of the two...

40
1 1 1 DATA STORAGE

Post on 15-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

111DATA

STORAGE

Page 2: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

2

Computers represent information as patterns of bits

A bit (Binary Digit) is one of the two digits 0 or 1

Storing a bit in the machine requires a device that can be in one of two states:On or Off , True or False , 0 or 1

Storage of Bits

Page 3: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

3

GATES AND FLIP-FLOPS

There are several gates that perform logical operations

The basic gates are: AND OR EXLUSIVE-OR(X-OR) NOT

Page 4: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

4

AND Gate

Truth Table

A B Y

0 0 0

0 1 0

1 0 0

1 1 1

Logic Equation

Y= A.B

Logic Circuit

Page 5: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

5

OR Gate

Truth Table

A B Y

0 0 0

0 1 1

1 0 1

1 1 1

Logic Equation:

Y = A + B

Logic Circuit

Page 6: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

6

Exclusive OR (X-OR)

Truth Table

A B Y

0 0 0

0 1 1

1 0 1

1 1 0

Logic Equation

Y = A + B

Logic Circuit

Page 7: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

7

NOT Gate

Truth Table

A Y

0 1

1 0

Logic Equation

Y= A

Logic Circuit

Page 8: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

8

NAND Gate

Page 9: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

9

NOR Gate

Page 10: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

10

Example(1) Draw the logic circuit and find the truth table for the following logic equation:

X=(A+B)C

A B C X

0 0 0 0

0

0

0

0 0

Page 11: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

11

Example(1) Draw the logic circuit and find the truth table for the following logic equation:

X=(A+B)C

A B C X

0 0 0 0

0 0 1 0

0

0

1

0 0

Page 12: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

12

Example(1) Draw the logic circuit and find the truth table for the following logic equation:

X=(A+B)C

A B C X

0 0 0 0

0 0 1 0

0 1 0 0

0

1

0

1 0

Page 13: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

13

Example(1) Draw the logic circuit and find the truth table for the following logic equation:

X=(A+B)C

A B C X

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 0

1 1 1 1

1

1

1

1 1

No. of States = 2No. Of Inputs

Page 14: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

14

FLIP - FLOP A flip-flop is a circuit that has one of two

output values; its output remains fixed until a temporary pulse from another circuit causes it to shift to other value

The significance of a flip-flop is that it stores the information

There are several kinds of flip flops like: J-K flip-flop , S-R flip-flop, D flip-flop ,

T flip-flop

Page 15: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

17

Numbering Systems Decimal System Binary System Octal System Hexadecimal

System

Decimal System Consists of 10 digits

0,1,2,3,4,5,6,7,8,9 The base for this system is 10 To analyze any decimal

number:

652= 102x6 + 101x5 + 100x2

= 600 + 50 + 2 = 652

Page 16: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

18

Binary System

Consists of two digits 0 and 1 The base for the binary system is 2 It is the system used to represent

information inside the computer system It is important to be familiar with

conversion methods between the different numbering systems

Page 17: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

19

Binary System

Decimal -to- Binary conversion:

To convert (8)10from decimal to binary:

2 8

(8)10=(1000)2 2 4 0 LSB

2 2 0

2 1 0

2 0 1 MSB

Page 18: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

20

Binary System

Binary -to- Decimal Conversion:

Convert (1011)2 into decimal number:

23x1 + 22x0 + 21x1 + 20x1=

8 + 0 + 2 + 1 = (13)10

Page 19: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

21

Octal System

Consists of 8 digits:

0,1,2,3,4,5,6,7 The base for the octal system is 8 It has many applications in information

coding systems

Page 20: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

22

Octal System Decimal -to- Octal Conversion:

To convert (13)10 into Octal number:

(13)10=(15)8 8 13

8 1 5

0 1 Octal -to- Decimal Conversion:

(15)8=

81x1 + 80x5= 8 + 5 = (13)10

Page 21: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

23

Hexadecimal System

It consists of 16 digits:

0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F The base for hexadecimal system is 16 It is commonly used to describe all the

information in the computer system(the information represented as binary numbers and described by hexadecimal system)

Page 22: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

24

Hexadecimal System

Decimal -to- Hexadecimal Conversion:

Convert(302)10 into Hexadecimal notation:

16 302

(302)10=(12E)16 16 18 14

16 1 2

16 0 1

Page 23: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

25

Hexadecimal System

Hexadecimal -to- Decimal Conversion:

(A4B)16=

162x10 + 161x4 + 160x11=

2560 + 64 + 11 =(2575)10

Page 24: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

26

Hexadecimal System

Hexadecimal -to- Binary:

(140B)= (0001 0100 0000 1011)2

Binary -to- Hexadecimal:

(10001001011111)2=( ? )16

2 2 5 F

Page 25: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

27

Fractions Decimal -to-Binary: Result Carry

(3.5)10=11.? 0.5x2=1.0 0.0 1

=11.1 1x2-1

(0.6)10= 0.6x2= 0.2 1

=(0.10011)2 0.2x2= 0.4 0

0.4x2= 0.8 0

1x2-1+1x2-4+1x2-5= 0.8x2= 0.6 1

0.5+0.0625+0.3125= 0.6x2= 0.2 1

0.59375 Round-off Problem

Page 26: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

28

Storing Integers:1. Excess Notation: It is easy to distinguish the patterns

that represent negative values from those do not.

Those that represent negative values have a 0 as their most significant bit, while those do not represent negative values have a 1 as their MSB.

The MSB is often called Sign Bit

Page 27: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

29

1)Excess Notation:The following is 3-bit , excess-4 notation:

Bit Pattern Value represented

111 + 3

110 + 2

101 + 1

100 0

011 - 1

010 - 2

001 - 3

000 - 4

Page 28: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

30

2) Two’s Complement Notation

A notation used to represent both positive and negative integers

It simplifies the arithmetic operations, such as Addition and Subtraction , and then Multiplication and Division

By using this notation, the subtraction operation can be done in similar way the addition performed

Page 29: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

31

Two’s Complement: To obtain two’s complement of a decimal number, for

example ( 5 ): Get the binary value 101, and to represent that this is

a positive number, put a leading 0 as MSB 0101 Get the 1’s complement of the above value by

inverting each digit: 0101

1010 Add 1 to the result to get + 1

-------------

2’s Complement 1011

Page 30: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

32

Two’s Complement:Example 0011 1100 1101

Perform 5 - 3.

Sol. Can be performed as 5 + (-3) using 2’s complement notation:

0101

1101 2’s complement of 3

------- +

1 0010 The result(+2)

Dropped

Page 31: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

33

3) Floating- Point Notation: A notation used to represent very large

or very small positive and negative numbers

Consists of byte. The MSB represents sign bit. 0 for positive and 1 for negative

The other bits divided as:

8 7 6 5 4 3 2 1

Sign Exponent Mantissa

Bit

Page 32: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

34

Floating-Point Notation: To convert 3 1/2 into F.P notation:

1) The number is +ve, the sign bit is 0

2) (3 1/2)10 is (11.1)2 , to represent it in F.P the radix should be shift left two places,

the value becomes .111(which is the mantissa) and the exponent is 2

3) Convert the exponent into excess-4 form by adding 4 to it (which results 6) and convert it into binary 110 (which is the exponent part)

4) The resulting F.P number is(01101110)

Page 33: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

35

Floating-Point Notation: Convert (10110101) from F.P notation

into decimal number:

1) Sign bit 1 , the No. is negative

2)The exponent is 011 which is 3 ,subtract 4 from it results (-1). This means the radix should be shift left one place.

3)The mantissa is .0101 the radix shifted one place left, the resulted value is (00101) which is 1/8 + 1/32 = 5/32

4)The resulted decimal value is - (5/32)

Page 34: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

36

Memory System

For purpose of storing data, a computer contains a large collection of circuits, each capable of storing a bit.

The computer system contains two main types of memory:

Main Memory Secondary Memory(Mass Storage)

Page 35: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

37

Main Memory: The storage circuits in a machine’s

main memory are arranged in manageable units called cells(or words) , with a typical cell size being 8 bits

Every 8 bits are called byte Every 1024 bytes called kilobyte(210

KB), and each 1024 KB is Megabyte … The main memory is divided to: Random Access Memory(RAM) Read Only Memory(ROM)

Page 36: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

38

Mass Storage:

Secondary storage is a cheap and very large (huge amount) storage area

It is a permanent storage Classified into: Tapes Disks Compact Disks (CDs)

Page 37: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

39

Communication Errors:During the data transmission between

two points, we may lose data. To resolve such a problem, a variety of error detection and error correction techniques have been developed such as:

Parity Bit Cyclic Redundancy Check(CRC) Hamming Distance

Page 38: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

40

Parity Bit:

It is a bit added as MSB used to detect errors without correcting them.

Is based on the principle that if each bit pattern being manipulated has an odd number of 1’s (Odd Parity)and a pattern found with an even number of 1’s (Even Parity)

This is achieved by adding an extra bit for parity check. Thus an ASCII of 8 bits becomes 9 bits

Page 39: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

41

Parity Bit: To obtain the odd parity for character(A):

1) From ASCII table,the hex code of A is 41, in binary is : 0100 0001

2) Since the number of 1’s in the code is even. The odd parity bit must be 1 to get odd number of 1’s, and the complete code becomes: 1 0100 0001

3)If an error happened in 3rd bit from right ,the received character becomes:

1 0100 0101 , the number of 1’s is even, so the receiver detect that an error has been occurred

Page 40: 1. 2 n Computers represent information as patterns of bits n A bit (Binary Digit) is one of the two digits 0 or 1 n Storing a bit in the machine requires

42

Parity Bit:

4) This method is used to detect single error and never correct it

5) It fails to detect the error if it happens in the parity bit itself