DOC PREVIEW
GT ECE 2030 - Number System

This preview shows page 1-2-3-25-26-27 out of 27 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ECE2030 Introduction to Computer Engineering Lecture 2: Number SystemDecimal Number RepresentationGeneric Number RepresentationCounting numbers with base-bHow about base-2Slide 6Slide 7Derive Numbers in Base-2Base-2Base 8Base 16Slide 12Number Examples with Different BasesConvert between different basesBase-b AdditionNegative Number RepresentationSign-magnitudeOne’s ComplementTwo’s ComplementSlide 20Slide 21Range of NumbersBinary ComputationSlide 24BACKUPApplication of Two’s ComplementExamplesECE2030 Introduction to Computer EngineeringLecture 2: Number SystemProf. Hsien-Hsin Sean LeeProf. Hsien-Hsin Sean LeeSchool of Electrical and Computer EngineeringSchool of Electrical and Computer EngineeringGeorgia TechGeorgia Tech22Decimal Number Representation•Example: 90134 (base-10, used by Homo Sapien)= 90000 + 0 + 100 + 30 + 4= 9*104 + 0*103 + 1*102 + 3*101 + 4*100 •How did we get it? 901349013410901390131044 9019011033 90901011 990033Generic Number Representation•90134 = 9*104 + 0*103 + 1*102 + 3*101 + 4*100•A4 A3 A2 A1 A0 for base-10 (or radix-10)= A4*104 + A3*103 + A2*102 + A1*101 + A0*100(A is coefficient; b is base)•Generalize for a given number N N w/ base-bbNN = An-1 An-2 … A1 A0NN = An-1*bn-1 + An-2*bn-2 + … + A2*b2 + A0*b0**Note that A < b**Note that A < b44Counting numbers with base-bb001122334455667788991010111112121313141415151616171718181919Base-109090919192929393949495959696979798989999…..100100101101102102103103104104105105106106107107108108109109How about Base-80011223344556677101011111212131314141515161617172020212122222323242425252626272770707171727273737474757576767777…..100100101101102102103103104104105105106106107107202021212222232324242525262627272828292955How about base-22001110101111100100101101110110111111100010001001100110101010101110111100110011011101111011101111111166How about base-220 0 1 1 10101111100100101101110110111111100010001001100110101010101110111100110011011101111011101111111177How about base-220 0 = 0= 01 1 = 1= 110 10 = 2= 211 11 = 3= 3100 100 = 4= 4101 101 = 5= 5110 110 = 6= 6111 111 = 7= 71000 1000 = 8= 81001 1001 = 9= 91010 1010 = 10= 101011 1011 = 11= 111100 1100 = 12= 121101 1101 = 13= 131110 1110 = 14= 141111 1111 = 15= 15Binary Binary == DecimalDecimal88Derive Numbers in Base-2 •Decimal (base-10)–(25)10•Binary (base-2)–(11001)2•Exercise252521212 211 66 200 33 200 111199Base-2 •Decimal (base-10)–(982)10•Binary (base-2)–(1111010110)2•Exercise1010Base 8•Decimal (base-10)–(982)10•Octal (base-8)–(1726)8•Exercise1111Base 16•Decimal (base-10)–(982)10•Hexadecimal (base-16)•Hey, what do we do when we count to 10??•0•1•2•3•4•5•6•7•8•9•10•11•12•13•14•1500112233445566778899aabbccddeeff1212Base 16•(982)10 = (3d6)16•(3d6)16 can be written as (0011 1101 0110)2•We use Base-16 (or Hex) a lot in computer world–Ex: A 32-bit address can be written as 0xfe8a7d20 0xfe8a7d20 ((0x 0x is an abbreviation of Hex))–Or in binary form Or in binary form 1111_1110_1000_1010_0111_1101_0010_0000 1111_1110_1000_1010_0111_1101_0010_00001313Number Examples with Different Bases•Decimal (base-10)–(982)10•Binary (base-2)–(01111010110)2•Octal (base-8)–(1726)8•Hexadecimal (base-16)–(3d6)16•Others examples: –base-9 = (1321)9 –base-11 = (813)11–base-17 = (36d)171414Convert between different bases•Convert a number base-x to base-y, e.g. (0100111)2 to (?)6–First, convert from base-x to base-10 if x  10–Then convert from base-10 to base-y0100111 = 026 + 125 + 024 + 023 + 122 + 121 + 120 = 39 3939666 633 1100 (0100111)2 = (103)6Base-b Addition1616Negative Number Representation•Options–Sign-magnitude–One’s Complement–Two’s Complement (we use this in this course)1717Sign-magnitude•Use the most significant bit (MSB) to indicate the sign–00: positive, 11: negative•Problem–Representing zeros?–Do not work in computation•We will NOT use it in this course !+0 000+1 001+2 010+3 011-3 111-2 110-1 1010 1001818One’s Complement•Complement (flip) each bit in a binary number •Problem–Representing zeros?–Do not always work in computation•Ex: 111 + 001 = 000  Incorrect !•We will NOT use it in this course !+0 000+1 001+2 010+3 011-3 100-2 101-1 1100 1111919Two’s Complement•ComplementComplement (flip) each bit in a binary number and adding 1adding 1, with overflow ignored•Work in computation perfectly•We will use it in this course !011100One’s complement3101Add 1-3010One’s complement101-3011Add 132020Two’s Complement•ComplementComplement (flip) each bit in a binary number and adding 1adding 1, with overflow ignored•Work in computation perfectly•We will use it in this course !0 000+1 001-1 111+2 010-2 110+3 011-3 101?? 100100011One’s complement100Add 1The same 100 representsboth 4 and -4 which is no good2121Two’s Complement•ComplementComplement (flip) each bit in a binary number and adding 1adding 1, with overflow ignored•Work in computation perfectly•We will use it in this course !0 000+1 001-11111+2 010-21110+3 011-31101--41100100011One’s complement100Add 1MSB = 1 for negative Number, thus 100 represents -42222Range of Numbers •An N-bit number–Unsigned: 0 .. (2N -1)–Signed: -2N-1.. (2N-1 -1)•Example: 4-bit 1110 (-8)0111 (7)Signed numbers0000 (0)1111 (15)Unsigned numbers2323Binary Computation010001 (17=16+1)001011 (11=8+2+1)---------------011100 (28=16+8+4)Unsigned arithmetic 010001 (17=16+1)101011 (43=32+8+2+1)---------------111100 (60=32+16+8+4)Signed arithmetic (w/ 2’s complement) 010001 (17=16+1)101011 (-21: 2’s complement=010101=21)---------------111100 (2’s complement=000100=4, i.e. -4)2424Binary ComputationUnsigned arithmetic 101111 (47)011111 (31)---------------001110 (78?? Due to overflow, note that 62 cannot be represented by a 6-bit unsigned number)The carry isdiscardedSigned arithmetic (w/ 2’s complement) 101111 (-17 since 2’s complement=010001)011111 (31)---------------001110 (14)The carry isdiscardedBACKUP2626Application of Two’s Complement•The first Pocket CalculatorPocket Calculator “Curta” used Two’s complement method for subtractionsubtraction•First complement the subtrahend –Fill the left digits to be the same length of the minuend–Complemented number = (9 – digit) •4’s complement = 5•7’s complement = 2•0’s complement = 9•Add 1 to the complemented


View Full Document

GT ECE 2030 - Number System

Documents in this Course
Load more
Download Number System
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 Number System 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 Number System 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?