Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

- Short Company presentation Walter C.C. by guest79076 1088 views
- Photography Portfolio by Annie Hoogendoorn 274 views
- Daniel Yen's Hitwise 2008 Iptv Conf... by DanielYen 450 views
- Progressive Agency Business Models ... by Ignition Consulti... 4045 views
- Creating Value - Issue 6 by Ignition Consulti... 3723 views
- Your Agency in 30 Seconds: Four Que... by Ignition Consulti... 33566 views

1,235 views

961 views

961 views

Published on

Assignment purpose

No Downloads

Total views

1,235

On SlideShare

0

From Embeds

0

Number of Embeds

26

Shares

0

Downloads

0

Comments

0

Likes

1

No embeds

No notes for slide

- 1. Chapter 2Data Representation• Data Representation• Compliments• Subtraction of Unsigned Numbersusing r’s complement• How To Represent Signed Numbers• Floating-Point Representation
- 2. Data Types• The data types stored in digital computersmay be classified as being one of thefollowing categories:1. numbers used in arithmetic computations,2. letters of the alphabet used in dataprocessing, and3. other discrete symbols used for specificpurposes.All types of data are represented in computers inbinary-coded form.
- 3. Binary Numbers• Binary numbers are made of binary digits (bits):0 and 1• Convert the following to decimal(1011)2 = 1x23 + 0x22 + 1x21 + 1x20 = (11)10
- 4. Example• Use radix representation to convert the binary number(101.01) into decimal.• The position value is power of 2• 1 0 1. 0 1•• 22 21 20 2-1 2-2• 4 + 0 + 1 + 0 + 1/22 = 5.25(101.01)2 (5.25)10
- 5. Converting an Integer from Decimal to AnotherBase• Divide the decimal number by the base (e.g.• The remainder is the lowest-order digit• Repeat the first two steps until no divisorremains.• For binary the even number has no remainder‘0’, while the odd has ‘1’For each digit position:
- 6. Converting an Integer from Decimal toAnother BaseExamplefor (13)10:IntegerQuotient13/2 = (12+1)½ a0 = 16/2 = ( 6+0 )½ a1 = 03/2 = (2+1 )½ a2 = 11/2 = (0+1) ½ a3 = 1Remainder CoefficientAnswer (13)10 = (a3 a2 a1 a0)2 = (1101)2
- 7. Converting a Fraction from Decimalto Another BaseExample for(0.625)10: Integer0.625 x 2 = 1 + 0.25 a-1 = 10.250 x 2 = 0 + 0.50 a-2 = 00.500 x 2 = 1 + 0 a-3 = 1Fraction CoefficientAnswer (0.625)10 = (0.a-1 a-2 a-3 )2 = (0.101)2
- 8. DECIMAL TO BINARY CONVERSION(INTEGER+FRACTION)(1) Separate the decimal number into integer and fraction parts.(2) Repeatedly divide the integer part by 2 to give a quotientand a remainder andRemove the remainder. Arrange the sequence of remaindersright to left from the period. (Least significant bit first)(3) Repeatedly multiply the fraction part by 2 to give an integerand a fraction partand remove the integer. Arrange the sequence of integersleft to right from the period. (Most significant fraction bit first)
- 9. (Example) (41.6875)10 (?)2Integer = 41, Fraction = 0.6875The first procedure produces41= 1 x 25 + 0 x 24 + 1 x 23 + 0 x 22 + 0 x 2 + 1 = (101001)0.6875=0.101141.6875 (10) = 101001.1011 (2)Integer remainder41 /2 120 010 05 12 01 1Overflow FractionX by 2 .68751 .37500 .7501 .51 0
- 10. Octal Numbers• Octal numbers (Radix or base=8) are made of octaldigits: (0,1,2,3,4,5,6,7)• How many items does an octal number represent?• Convert the following octal number to decimal(465.27)8 = 4x82 + 6x81 + 5x80 + 2x8-1 + 7x8-2
- 11. Converting an Integer from Decimalto OctalExample for (0.3125)10:Integer0.3125 x 8 = 2 + 0.5 a-1 = 20.5000 x 8 = 4 + 0 a-2 = 4Fraction CoefficientAnswer (0.3125)10 = (0.24)8Combine the two (175.3125)10 = (257.24)8Remainderof divisionOverflow ofmultiplication
- 12. Hexadecimal Numbers• Hexadecimal numbers are made of 16 symbols:o (0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F)• Convert a hexadecimal number to decimalo (3A9F)16 = 3x163 + 10x162 + 9x161 + 15x160 = 1499910• Hexadecimal with fractions:o (2D3.5)16 = 2x162 + 13x161 + 3x160 + 5x16-1 = 723.312510• Note that each hexadecimal digit can berepresented with four bits.o (1110) 2 = (E)16• Groups of four bits are called a nibble.o (1110) 2
- 13. Example• Convert the decimal number(107.00390625)10 into hexadecimal number.• (107.00390625)10 (6B.01)16Integer remainder107 Divide/166 11=B0 6Overflow FractionX by 16 .003906250 .06251 .0000.Closer tothe period
- 14. Conversion Between Number BasesDecimal(base 10)Octal(base 8)Binary(base 2)Hexadecimal(base16)° We normally convert to base 10because we are naturally used to thedecimal number system.° We can also convert to other numbersystems
- 15. One to one comparison• Binary, octal, andhexadecimal similar• Easy to build circuits tooperate on theserepresentations• Possible to convertbetween the three formats
- 16. Converting between Base 16 andBase 2° Conversion is easy! Determine 4-bit value for each hex digit° Note that there are 24 = 16 different values offour bits which means each 16 value isconverted to four binary bits.° Easier to read and write in hexadecimal.° Representations are equivalent!3A9F16 = 0011 1010 1001 111123 A 9 F
- 17. Converting between Base 16 andBase 81. Convert from Base 16 to Base 22. Regroup bits into groups of three starting from right3. Ignore leading zeros4. Each group of three bits forms an octal digit (8 isrepresented by 3 binary bits).352378 = 011 101 010 011 11125 2 3 733A9F16 = 0011 1010 1001 111123 A 9 F
- 18. ExampleConvert 101011110110011 toa. octal numberb. hexadecimal numbera. Each 3 bits are converted to octal :(101) (011) (110) (110) (011)5 3 6 6 3101011110110011 = (53663)8b. Each 4 bits are converted to hexadecimal:(0101) (0111) (1011) (0011)5 7 B 3101011110110011 = (57B3)16Conversion from binary to hexadecimal is similar except that the bitsdivided into groups of four.
- 19. ComplimentsComplements Of Numbers
- 20. Subtraction usingaddition• Conventional addition (using carry) is easily• implemented in digital computers.• However; subtraction by borrowing isdifficult and inefficient for digital computers.• Much more efficient to implementsubtraction using ADDITION OF theCOMPLEMENTS of numbers.
- 21. Binary Addition1 1 1 1 0 1+ 1 0 1 1 1---------------------0101111111 1 00carriesExample Add (11110)2 to(10111)2(111101)2 + (10111) 2 = (1010100)2carry
- 22. Binary Subtraction• We can also perform subtraction (with borrows).• Example: subtract (10111) from (1001101)1 100 10 10 0 0 101 0 0 1 1 0 1- 1 0 1 1 1------------------------0 1 1 0 1 1 0borrows1+1=2(1001101)2 - (10111)2 = (0110110)2
- 23. The complement 1’s of1011001 is 01001100 1 1 0 0- 11 1 1 1 1 11 0 0 1 1 00 0 1 1 1- 11 1 1 1 1 11 1 0 0 0 0110The 1’s complement of0001111 is 1110000011l’s complement
- 24. For binary numbers, r = 2,r’s complement is the 2’s complement.The 2’s complement of N is 2n - N.2’s complementDigitnDigitn-1NextdigitNextdigitFirstdigit0 0 0 0 0-1
- 25. 2’s complement ExampleThe 2’s complement of1011001 is 0100111The 2’s complement of0001111 is 11100010 1 1 0 0- 10 0 0 0 0 01 0 0 1 1 10 0 1 1 1- 11 1 0 0 0 11000110 0 0 0 0 001
- 26. Fast Methods for 2’sComplementMethod 1:The 2’s complement of binary number is obtained by adding 1 to thel’s complement value.Example:1’s complement of 101100 is 010011 (invert the 0’s and 1’s)2’s complement of 101100 is 010011 + 1 = 010100
- 27. Fast Methods for 2’sComplementMethod 2:The 2’s complement can be formed by leaving all least significant 0’sand the first 1 unchanged, and then replacing l’s by 0’s and 0’s by l’sin all other higher significant bits.Example:The 2’s complement of 1101100 is0010100Leave the two low-order 0’s and the first 1 unchanged, and thenreplacing 1’s by 0’s and 0’s by 1’s in the four most significant bits.
- 28. Exampleso Finding the 2’s complement of (01100101)2• Method 1 – Simply complement each bit andthen add 1 to the result.(01100101)2[N] = 2’s complement = 1’s complement (10011010)2+1=(10011011)2• Method 2 – Starting with the least significantbit, copy all the bits up to and including thefirst 1 bit and then complement the remainingbits.N = 0 1 1 0 0 1 0 1[N] = 1 0 0 1 1 0 1 1
- 29. Video Reference• http://www.youtube.com/watch?v=SXAr35BiqK8

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment