Successfully reported this slideshow.
Upcoming SlideShare
×

# Meghna ppt.

797 views

Published on

Published in: Technology, Education
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

### Meghna ppt.

1. 1. Data Representation(in computer system)
2. 2. Data Representation How do computers represent data?a Most computers are digital • Recognize only two discrete states: on or off • Computers are electronic devices powered by electricity, which has only two states, on or off
3. 3. on 1 1 1 1 1off 0 0 0 0 0
4. 4. Data RepresentationWhat is the binary system?a A number system that has just two unique digits, 0 and 1 • A single digit is called a bit (binary digit) • A bit is the smallest unit of data the computer can represent • By itself a bit is not very informativea The two digits represent the two off and on states
5. 5. Binary Digit (bit) Electronic Electronic State Charge
6. 6. Data Representation What is a byte?a Eight bits are grouped together to form a bytea 0s and 1s in each byte are used to represent individual characters such as letters of the alphabet, numbers, and punctuation
7. 7. 8-bit byte for the number 38-bit byte for the number 58-bit byte for the capital letter T
8. 8. Data RepresentationWhat are two popular coding systemsto represent data?a American Standard Code for Information Interchange (ASCII)a Extended Binary Coded Decimal Interchange Code (EBCDIC) • Sufficient for English and Western European languages • Unicode often used for others
9. 9. Data RepresentationHow is a character sent from thekeyboard to the computer? Step 1: The user presses the letter T key on the keyboard Step 2: An electronic signal for the letter T is sent to the system unit Step 3: The signal for the letter T is converted to its ASCII binary code (01010100) and is stored in memory for processing Step 4: After processing, the binary code for the letter T is converted to an image on the output device
10. 10. Decimal to Binary Conversions•In an earlier slide, we said that every integer value canbe represented exactly using any radix system.•You can use either of two methods for radix aconversion: the subtraction method and the divisionremainder method. The subtraction method is more intuitive, but cumbersome. It does, however reinforce the ideas behind radix mathematics. The division method employs the idea that successive division by a base is equivalent to successive subtraction by powers of the base.
11. 11. Decimal to D Binary Conversions•Fractional decimal values have nonzero digitsto the right of the decimal point.•Fractional values of other radix systems havenonzero digits to the right of the radix point.•Numerals to the right of a radix point representnegative powers of the radix: 0.4710 = 4 × 10 -1 + 7 × 10 -2 0.112 = 1 × 2 -1 + 1 × 2 -2 = ½ + ¼ = 0.5 + 0.25 = 0.75
12. 12. Decimal to Binary Conversions•As with whole-number conversions, you canuse either of two methods: a subtractionmethod and an easy multiplication method.•The subtraction method for fractions isidentical to the subtraction method for wholenumbers. Instead of subtracting positive powersof the target radix, we subtract negative powersof the radix.•We always start with the largest value first, n -1,where n is our radix, and work our way alongusing larger negative exponents
13. 13. Decimal to Binary Conversions•HoweverThe binary numbering system is themost important radix system for digitalcomputers.•, it is difficult to read long strings of binarynumbers-- and even a modestly-sized decimalnumber becomes a very long binary number. For example: 110101000110112 = 1359510•For compactness and ease of reading, binaryvalues are usually expressed using thehexadecimal, or base-16, numbering system.
14. 14. Decimal to Binary Conversions•The hexadecimal numbering system uses thenumerals 0 through 9 and the letters A through F. The decimal number 12 is C16. The decimal number 26 is 1A16.•It is easy to convert between base 16 and base2, because 16 = 24.•Thus, to convert from binary to hexadecimal, allwe need to do is group the binary digits intogroups of four.A group of four binary digits is called a hextet
15. 15. Decimal to Binary Conversions•Using groups of hextets, the binary number110101000110112 (= 1359510) in hexadecimal is:•Octal (base 8) values are derived frombinary by using groups of three bits (8 = 23):Octal was very useful when computers used six-bitwords
16. 16. Signed Integer Representation•Several representations exist for negative values:Sign Magnitude Ones Complement TwosComplement 000 = +0 000 = +0 000 = +0 001 = +1 001 = +1 001 = +1 010 = +2 010 = +2 010 = +2 011 = +3 011 = +3 011 = +3 100 = -0 100 = -3 100 = -4 101 = -1 101 = -2 101 = -3 110 = -2 110 = -1 110 = -2 111 = -3 111 = -0 111 = -1
17. 17. Signed Integer Representation
18. 18. •Given a full adder (FA), we can use it toadd binary digits (up to 3) A B carry_in carry_out S 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0
19. 19. Signed Integer Representation• Several FAs can be used to add binary numbers by feeding out the carry_out one FA to the carry_in of the FA of the left. add/sub B31 B2 B1 B0 A31 A2 A1 A0 1-bit 1-bit 1-bit 1-bit C32 FA C31 C3 FA C2 FA C1 FA C0 S31 S2 S1 S0 32-bit Ripple Carry Adder/Subtractor (Better: Carry Lookahead Adder) Note: add/sub is ON (1) if we want A-B, otherwise is OFF
20. 20. •Booth’s algorithm -Multiplier and multiplicand are placed in registers Q & M -Q-1, 1-bit register placed to the right of Q0 Initialize A (third register) and Q-1 to 0 Do n times (n is the number of bits in Q): If Q0Q-1 = 01 then A <-- A + M If Q0Q-1 = 10 then A <-- A – M Arithmetic shift right A, Q, Q-1