W4-one - 198:211 Computer Architecture Lecture 6 Fall 2009...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
198:211 Computer Architecture 198:211 Computer Architecture z Topics: z Data representation 2.1 and 2.2 in book z Floating point 2.4 in book Lecture 6 Fall 2009
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Computer Architecture z What do computers do? z Manipulate stored information z Manipulation: operations … more on this later z Information is data: how is it represented? z Basic information: numbers z Human beings have represented numbers throughout history z Roman numerals z Decimal system Discoveregypt.com
Background image of page 2
Number System z Comprises of z Set of numbers or elements z Operations on them z Rules that define properties of operations z Need to assign value to numbers z Let us take decimal z 1s place, 10s place, 100s place etc z Base 10 z Value= z Humans use decimal × i i 10
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Binary numbers z Base 2; each digit is 0 or 1 z Each bit in place i has value 2 i z Binary representation is used in computers z Easy to represent by switches (on/off) z Manipulation by Digital logic in hardware z But hard for humans to read z (13) 10 = (1101) 2
Background image of page 4
Hexadecimal representation z Binary hard to read for humans z Especially 16 bits, 32 bits, 64 bits z Base 16 representation or hex representation z Symbols ={0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F} z Value = z First 10 (0 through 9) symbols are same as decimal z A=10,B=11,C=12, D=13, E=14, F=15 × i i 16
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Decimal to binary z Example: Convert 10 in decimal to binary z Above code works for any base z For hex, replace N%2 by N%16 and replace reminders > 9 by A, B, C, D, E and F z Example: Convert 240 to HEX main(){ int N,i=0; int Maxbits=32; char bitarray[Maxbits] while (N > 0){ bitarray[i]=N%2;i++; N=N/2; }
Background image of page 6
Binary to decimal z Convert 110110 to decimal z Value = i*2 i z Value = 2 5 2 4 2 2 2 1 z = 32+ 16 + 4 + 2 z = 54 z z
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Converting Hex to binary z Each digit in Hex can be represented by 4 bit binary (base 16) or nibble z Convert 2A8C to binary z 0010 1010 0100 1100
Background image of page 8
z Group binary bits into groups of four z Replace each nibble by a hex digit z Example 1011011110011100 z 1011 0111 1001 1100 z
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/24/2011 for the course CS 211 taught by Professor Chakraborty during the Spring '08 term at Rutgers.

Page1 / 36

W4-one - 198:211 Computer Architecture Lecture 6 Fall 2009...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online