Unformatted text preview:

CS231: Computer Architecture IComponents of a basic computerNumber systemsReviewRest of Today’s lectureConverting decimal to binaryWhy does this work?Base 16 is useful tooBinary and hexadecimal conversionsNumber Systems SummaryBoolean OperationsBoolean valuesFunctionsBasic Boolean operationsBoolean expressionsTruth tablesPrimitive logic gatesExpressions and circuitsBoolean operations summaryCS231: Computer Architecture ILaxmikant KaleFall 2007Introduction to CS2312Components of a basic computerMemoryALU(Arithmetic/Logic Unit:Basic operationsDataProgramControl and Decoding©2000-2002 Howard Huang3Number 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 analogvoltages 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 withjust 1s and 0s.–Then we’ll introduce special operationsfor computing with 1s and 0s, by treating them asthe logical values “true” and “false.”Volts1.8010Introduction to CS2314Review•There are 10 kinds of people in the world–Those who understand binary and those who don’t0000 00001 1234567891011121314151625768120452732Introduction to CS2315Rest 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 expressionsIntroduction to CS2316Converting decimal to binary•To convert a decimal integer into binary, keep dividing by 2 until the quotient is 0. Collect the remainders in reverse order.•To convert a fraction, keep multiplying the fractional part by 2 until it becomes 0. Collect the integer parts in forward order.•Example: 162.375:•So, 162.37510 = 10100010.0112162 / 2 = 81 rem 0 81 / 2 = 40 rem 1 40 / 2 = 20 rem 0 20 / 2 = 10 rem 0 10 / 2 = 5 rem 0 5 / 2 = 2 rem 1 2 / 2 = 1 rem 0 1 / 2 = 0 rem 10.375 x 2 = 0.7500.750 x 2 = 1.5000.500 x 2 = 1.000Introduction to CS2317Why does this work?•This works for converting from decimal to any base•Why? Think about converting 162.375 from decimal to decimal.•Each division strips off the rightmost digit (the remainder). The quotient represents the remaining digits in the number.•Similarly, to convert fractions, each multiplication strips off the leftmost digit (the integer part). The fraction represents the remaining digits.162 / 10 = 16 rem 2 16 / 10 = 1 rem 6 1 / 10 = 0 rem 10.375 x 10 = 3.7500.750 x 10 = 7.5000.500 x 10 = 5.000Introduction to CS2318Decimal Binary Hex0 0000 01 0001 12 0010 23 0011 34 0100 45 0101 56 0110 67 0111 78 1000 89 1001 910 1010 A11 1011 B12 1100 C13 1101 D14 1110 E15 1111 FDecimal Binary Hex0 0000 01 0001 12 0010 23 0011 34 0100 45 0101 56 0110 67 0111 78 1000 89 1001 910 1010 A11 1011 B12 1100 C13 1101 D14 1110 E15 1111 FBase 16 is useful too•The hexadecimal system uses 16 digits:0 1 2 3 4 5 6 7 8 9 A B C D E F•You can convert between base 10 and base 16 using techniques like the ones we just showed for converting between decimal and binary.•For our purposes, base 16 is most useful as a “shorthand” notation for binary numbers.–Since 16 = 24, one hexadecimal digit is equivalent to 4 binary digits.–It’s often easier to work with a number like B4 instead of 10110100.•Hex is frequently used to specify things like 32-bit IP addresses and 24-bit colors.Introduction to CS2319Binary and hexadecimal conversions•Converting from hexadecimal to binary is easy: just replace each hex digit with its equivalent 4-bit binary sequence.•To convert from binary to hex, make groups of 4 bits, starting from the binary point. Add 0s to the ends of the number if needed. Then, just convert each bit group to its corresponding hex digit.261.3516 = 2 6 1 . 3 516 = 0010 0110 0001 . 0011 0101210110100.0010112= 1011 0100 .0010 11002= B 4 . 2 C161111F1011B01117001131110E1010A01106001021101D1001901015000111100C100080100400000BinaryHexBinaryHexBinaryHexBinaryHexIntroduction to CS23110Number Systems Summary•Computers are binary devices.–We’re forced to think in terms of base 2.–Today we learned how to convert numbers between binary, decimal and hexadecimal. •We’ve already seen some of the recurring themes of architecture:–We use 0 and 1 as abstractions for analog voltages.–We showed how to represent numbers using just these two signals.•Next we’ll introduce special operations for binary values and show how those correspond to circuits.©2000-2002 Howard Huang11Boolean Operations•So far, we’ve talked about how arbitrary numbers can be represented using just the two binary values 1 and 0.•Now we’ll interpret voltages as the logical values “true” and “false” instead. We’ll show:–How functions can be defined for expressing computations–How to build circuits that implement our functions in hardwareIntroduction to CS23112Boolean values•Earlier, we used electrical voltages to representtwo discrete values 1 and 0, from which binary numberscan be formed.•It’s also possible to think of voltages as representingtwo logical values, true and false.•For simplicity, we often still write digits instead:–1 is true–0 is false•We will use this interpretation along with special operations to design functions and hardware for doing arbitrary computations.Volts1.80TrueFalseIntroduction to CS23113Functions•Computers take inputs and produce outputs, just like functions in math!•Mathematical functions can be expressed in two ways:•We can represent logical functions in two analogous ways too:–A finite, but non-unique Boolean expression. –A truth table, which will turn out to be unique and finite.x y f (x,y)0 0 0… … …2 2 6… … …23 41 87… … …f(x,y) = 2x + y= x + x + y= 2(x + y/2)= ...An expression isfinite but not uniqueA function table isunique but infiniteIntroduction to CS23114Basic Boolean operations •There are three basic operations for logical values.x y xy0 0 00 1 01 0 01 1


View Full Document

U of I CS 231 - Computer Architecture

Documents in this Course
Counters

Counters

23 pages

Latches

Latches

22 pages

Lecture

Lecture

33 pages

Lecture

Lecture

16 pages

Lecture

Lecture

4 pages

Datapaths

Datapaths

30 pages

Lecture

Lecture

6 pages

Registers

Registers

17 pages

Datapaths

Datapaths

28 pages

Decoders

Decoders

20 pages

Load more
Download Computer Architecture
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Computer Architecture and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Computer Architecture 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?