02-Numbers

02-Numbers - CS231: Computer Architecture I Mara J. Garzarn...

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

View Full Document Right Arrow Icon
CS231: Computer Architecture I María J. Garzarán Spring 2008
Background image of page 1

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

View Full DocumentRight Arrow Icon
©2000-2002 Howard Huang 2 Number systems To get started, we’ll discuss one of the fundamental concepts underlying digital computer design: Deep down inside, computers work with just 1s and 0s. Computers use voltages to represent information. In modern CPUs the voltage is usually limited to 1.6-1.8V to minimize power consumption. It’s convenient for us to translate these analog voltages into the discrete, or digital, values 1 and 0. But how can two lousy digits be useful for anything? First, we’ll see how to represent numbers with just 1s and 0s. Then we’ll introduce special operations for computing with 1s and 0s, by treating them as the logical values “true” and “false.” Volts 1.8 0 1 0
Background image of page 2
Introduction to CS231 3 Rest of Today’s lecture Having seen an overview last week, We will now start a more thorough study Number systems Review of binary number representation How to convert between binary and decimal representations Octal and Hex representations Basic boolean operations AND, OR and NOT The idea of “Truth Table” Boolean functions and expressions Truth table for Boolean expressions
Background image of page 3

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

View Full DocumentRight Arrow Icon
Introduction to CS231 4 Decimal review Numbers consist of a bunch of digits, each with a weight : The weights are all powers of the base, which is 10. We can rewrite the weights like this: To find the decimal value of a number, multiply each digit by its weight and sum the products. 1 6 2 . 3 7 5 Digit s 100 10 1 1/ 10 1/ 100 1/ 1000 Weight s 1 6 2 . 3 7 5 Digit s 10 2 10 1 10 0 10 -1 10 -2 10 -3 Weight s ( 1 x 10 2 ) + ( 6 x 10 1 ) + ( 2 x 10 0 ) + ( 3 x 10 -1 ) + ( 7 x 10 -2 ) + ( 5 x 10 -3 ) = 162.375
Background image of page 4
Introduction to CS231 5 Converting binary to decimal We can use the same trick to convert binary , or base 2, numbers to decimal. The only difference is that the weights are powers of 2 . For example, here is 1101.01 in binary: The decimal value is: 1 1 0 1 . 0 1 Binary digit s, or bit s 2 3 2 2 2 1 2 0 2 -1 2 -2 Weight s (in base 10) ( 1 x 2 3 ) + ( 1 x 2 2 ) + ( 0 x 2 1 ) + ( 1 x 2 0 ) + ( 0 x 2 -1 ) + ( 1 x 2 -2 ) = 8 + 4 + 0 + 1 + 0 + 0.25 = 13.25 Powers of 2: 2 0 = 1 2 4 = 16 2 8 = 256 2 1 = 2 2 5 = 32 2 9 = 512 2 2 = 4 2 6 = 64 2 10 = 1024 2 3 = 8 2 7 = 128
Background image of page 5

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

View Full DocumentRight Arrow Icon
Introduction to CS231 6 Converting decimal to binary To convert a decimal integer into binary, keep dividing by 2 until the quotient is 0. Collect the
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

02-Numbers - CS231: Computer Architecture I Mara J. Garzarn...

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

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