L08-NumberSysAdders

L08-NumberSysAdders - Fall 2009 ECE 18-240 Fundamentals of...

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

View Full Document Right Arrow Icon
Fall 2009 ECE 18-240 Fundamentals of Computer Engineering LEC 8: Finite Number Representation Don Thomas & William Nace Electrical & Computer Engineering Carnegie Mellon University LEC 8 18-240: Where are we. ..? ! 1 Handout: Lec8 " HW2 due in your recit this Fri. Short QUIZ in your recit, too " Lab2 starts this week, part 2A this week. Midterm 1 Thursday next week Up through L7
Background image of page 1

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

View Full DocumentRight Arrow Icon
Fall-09 18-240 L8 — Finite Number Representation ! What? " Counting, base conversion, positional systems, signed numbers, arithmetic, etc. ! Why? " Isn’t this like learning the multiplication tables in 3rd grade? " Actually more like how to count and add in 1 st grade. But you need some basic building blocks … ! Where? " As in, where is this useful? " Everywhere: Digital computers are all about and based on numbers! High performance arithmetic, supercomputers, signal processing, etc. " And . . . 3 ! What do you need to “represent” a number? " Need a base or radix = r " Need r unique symbols (digits in base 10) " r = 10 digits = {0,1,2,3,4,5,6,7,8,9} " r = 2 digits = {0,1} " r = 8 digits = {0,1,2,3,4,5,6,7} " r = 16 digits = {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F} ! Number Structure " Place value for digit d i is " Value of a number is So far this is very natural and unambiguous for positive numbers. Don't confuse what is a number with how to represent it. Fall-09 18-240 L8 — Non-Decimal Representations … d 2 d 1 d 0 . d -1 d -2 radix point 4
Background image of page 2
Fall-09 18-240 L8 — Binary Number Representation ! Let b n-1 b n-2 …b 2 b 1 b 0 represent an n-bit unsigned integer " its value is " a finite representation between 0 and 2 n -1 " e.g., 1011 two = 8 ten + 2 ten + 1 ten = 11 ten (more commonly rewritten as ‘b1011=11) ! Often written in Hex for easier human consumption " to convert, starting from the LSB, map 4 binary digits at a time into a corresponding hex digit; and vice versa " e.g., 1010_1011 two =AB hex For converting between binary and decimal, memorize decimal values of 2 0 ~ 2 10 , and remember 2 10 is about 1000 value of the i’th digit weight of the i’th digit 5 Fall-09 18-240 L8 — ! What other bases are interesting " Take the decimal number: 1987 — “nineteen-eighty seven” " you grouped decimal digits into “decadecimal” digits 1990 10 = (digit1, digit2) 100 “19” “90” = “19” • 100 1 + “90” • 100 0 ! How about in binary: number 2 = (?) 2 k Interesting cases like these are easier to convert: binary # octal (2 3 ) binary # hex (2 4 ) Special Case Conversions you need 100 symbols!! 6
Background image of page 3

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

View Full DocumentRight Arrow Icon
! You can do exactly same thing from binary Ex1: 101111110 2 = (?) 8 (9’b101_111_110) group by 3 digits from the radix point! (typically from the right, for us) 101 111 110 2 5 7 6 —> 576 8 —> 9’o576 in Verilog Ex2: 2 = (?) 16 group by 4 digits from the radix point! 0001 0111 1110 2 1 7 E —>17E 16 —> 12’h17E in Verilog Fall-09 18-240 L8 — Binary, Octal and Hex add 0’s as needed on the left 7 Fall-09 18-240 L8 — Finite Number Systems 8 In 2nd grade, we said “numbers are points on a line” and you believed it. 0 1 2 3 4 1 + 1 = 2 In 5th grade, we said “by the way, numbers can be negative” and you believed it. 0
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

L08-NumberSysAdders - Fall 2009 ECE 18-240 Fundamentals of...

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

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