w4-one - 198:211 Computer Architecture Lecture 8,9(W5 Fall 2012 l Topics l l Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book

w4-one - 198:211 Computer Architecture Lecture 8,9(W5 Fall...

This preview shows page 1 - 12 out of 40 pages.

1 198:211 Computer Architecture l Topics: l Data representation 2.1 and 2.2 of the book l Floating point 2.4 of the book Lecture 8,9 (W5) Fall 2012
Image of page 1
2 Computer Architecture l What do computers do?
Image of page 2
3 Number System l Comprises of l Set of numbers or elements l Operations on them (+ - / *) l Rules that define properties of operations (identity, inverse ) l Need to assign value to numbers l Let us take decimal system l 1 s place, 10 s place, 100 s place etc l Base 10 l Value= l Humans use decimal × i i 10
Image of page 3
4 Binary numbers l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers l Easy to represent by switches (on/off) l Manipulation by Digital logic in hardware l But hard for humans to read l (13) 10 = (1101) 2
Image of page 4
5 Hexadecimal representation l Binary hard to read for humans l Especially 16 bits, 32 bits, 64 bits l 1010101001010101 l Base 16 representation or hex representation l Symbols ={0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F} l Value = l First 10 (0 through 9) symbols are same as decimal numbers l A=10,B=11,C=12, D=13, E=14, F=15 × i i 16
Image of page 5
6
Image of page 6
Same for Hex 7 l Example: Convert 10 in decimal to binary l The code for binary works for any base with modifications l For hex, replace by N%16 and N=N/16 replace reminders > 9 by A, B, C, D, E and F l Example: Convert 240 to HEX
Image of page 7
8 Binary to decimal l Convert 110110 to decimal l Value = i*2 i l Value = 2 5 2 4 2 2 2 1 l = 32+ 16 + 4 + 2 l = 54 l l
Image of page 8
9 Converting Hex to binary l Each digit in Hex can be represented by 4 bit binary (base 16) or nibble l Convert 2A8C to binary l 0010 1010 0100 1100
Image of page 9
10 Convert Binary to hex l Group binary bits into groups of four l Replace each nibble by a hex digit l Example 1011011110011100 l 1011 0111 1001 1100 l B 7 9 C or 0x B 7 9 C l In C, numeric constants starting with 0x are interpreted as being in hexadecimal
Image of page 10
11 Examples l 0x8F7A93 to binary l 1011011110011100 to hex l 0xC4E5 to decimal
Image of page 11
Image of page 12

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture