Presentation is loading. Please wait.

Presentation is loading. Please wait.

+ CS 325: CS Hardware and Software Organization and Architecture Integers and Arithmetic.

Similar presentations


Presentation on theme: "+ CS 325: CS Hardware and Software Organization and Architecture Integers and Arithmetic."— Presentation transcript:

1 + CS 325: CS Hardware and Software Organization and Architecture Integers and Arithmetic

2 + Outline Number Representation Decimal Binary Hexadecimal Decimal vs. Hexadecimal vs. Binary Number Conversions Dec  Bin, Dec  Hex Bin  Dec, Bin  Hex Hex  Dec, Hex  Bin

3 + Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 4923 = (4x10 3 ) + (9x10 2 ) + (2x10 1 ) + (3x10 0 )

4 + Number Base: Number with base x  x digits: Base 10 (Decimal): 0, 1, 2, 3, 4,5,6,7, 8, 9 Base 2 (Binary): 0, 1 Number representation: d 31 d 30 d 29 ….d 2 d 1 d 0 is a 32 digit number 43262 10 is a 5 digit base 10 (Dec) number 10101101011 2 is a 11 digit base 2 (Bin) number

5 + Binary Numbers: Base 2 Digits: 0, 1 Example: 101011= (1x2 5 ) + (0x2 4 ) + (1x2 3 ) + (0x2 2 ) + (1x2 1 ) + (1x2 0 ) = 43 10 What about a base that converts to binary easily? 32168421 2525 2424 23232 2121 2020 101011

6 + Hexadecimal Numbers: Base 16 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Decimal digits + A – F Example: 12E = (1x16 2 ) + (2x16 1 ) + (Ex16 0 ) = 302 10 ABCDEF 101112131415

7 + Decimal vs. Hexadecimal vs. Binary DECHEXBIN 000000 110001 220010 330011 440100 550101 660110 770111 881000 991001 10A1010 11B1011 12C1100 13D1101 14E1110 15F1111 DECHEXBIN 16100001 0000 17110001 18120001 0010 19130001 0011 20140001 0100 21150001 0101 22160001 0110 23170001 0111 24180001 1000 25190001 1001 261A0001 1010 271B0001 1011 281C0001 1100 291D0001 1101 301E0001 1110 311F0001 1111

8 + Number Conversion: Dec  Bin Converting from base 10 to base 2: Continue dividing decimal number by 2 and keep the remainder Example: 35 10 100011 2 35/2171LSB 17/281 8/240 4/220 2/210 1/201MSB

9 + Number Conversion: Dec  Bin Example: Convert 423 10 to Bin 110100111 2

10 + Number Conversion: Dec  Hex Converting from base 10 to base 16: Example:35 10 23 16 35/1623LSB 2/1602MSB

11 + Number Conversion: Dec  Hex Example: Convert 210 10 to Hex D2 16

12 + Number Conversion: Bin  Dec Converting from base 2 to base 10: Example: 11010 2 (1x2 4 ) + (1x2 3 ) + (0x2 2 ) + (1x2 1 ) + (0x2 0 ) 16 + 8 + 0 + 2 + 0 = 26 10 168421 11010 MSBLSB

13 + Number Conversion: Bin  Dec Example: Convert 10101110 2 to Dec 174 10

14 + Number Conversion: Bin  Hex Converting from base 2 to base 16: Example: 11010110 2 1 Hex digit represents 16 Decimal values 4 Binary digits represent 16 Decimal values 1 Hex digit replaces 4 Binary digits D6 16 11010110 13  D6

15 + Number Conversion: Bin  Hex Example: Convert 11001111 2 to Hex CF 16

16 + Number Conversion: Hex  Dec Converting from base 16 to base 10: Example: 8E3 16 (8x16 2 ) + (Ex16 1 ) + (3x16 0 ) 2048 + 224 + 3 = 2275 10

17 + Number Conversion: Hex  Dec Example: Convert 63F 16 to Dec 1599 10

18 + Number Conversion: Hex  Bin Converting from base 16 to base 2: Example: 9A2E 16 1001101000101110 2 91001MSB A1010 20010 E1110LSB

19 + Number Conversion: Hex  Bin Example: Convert 26FA 16 to Bin 10011011111010 2

20 + What to do with representations of numbers? add, subtract, multiply, divide, compare Example: 8 + 6 = 14 1000 +0110 1110 Simple enough to add in binary that we can build circuits to do it.

21 + Which base do we use? Decimal: Great for human, especially when doing arithmetic Hex: Easier for humans to read than long strings of binary numbers. Easy to convert to binary, each hex decimal = 4 binary bits. Binary: used by all computers. Bin represents an abstraction…but and abstraction of what?

22 + The Transistor A controlled switch. Collector – positive lead Emitter – negative lead Base – control lead A binary “1” represents an active transistor.

23 + The Transistor

24 + Limits of Computer Numbers Bits can represent anything Characters ‘a’, ‘F’ 7 bit ASCII, 8 bit Extended ASCII Logical Values 0  False, 1  True Colors? Locations/addresses? Commands? But N bits  only 2 N things


Download ppt "+ CS 325: CS Hardware and Software Organization and Architecture Integers and Arithmetic."

Similar presentations


Ads by Google