Slides for Lecture 3
ENEL 353: Digital Circuits — Fall 2013 Term Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary 13 September, 2013 ENEL 353 F13 Section 02 Slides for Lecture 3 slide 2/22Previous Lecture
Number systems: decimal, binary, octal and hexadecimal. ENEL 353 F13 Section 02 Slides for Lecture 3 slide 3/22Today’s Lecture
◮ a little more about binary, octal, and hexadecimal numbers ◮ introduction to signed and unsigned number systems ◮ unsigned binary integer addition ◮ sign/magnitude representation of signed integers Related material in Harris & Harris (our course textbook): ◮ Sections 1.4.4 and 1.4.5 ◮ the beginning of Section 1.4.6 ENEL 353 F13 Section 02 Slides for Lecture 3 slide 4/22Repeat slide from previous lecture: Learn these tables!
- ctal
Conversion between binary, octal, and hex
One more example: Convert 48710 to hex and octal. (This problem was left unsolved in the previous lecture.) We can use repeated division to go from decimal to hexadecimal . . . division quotient remainder hex digit 487 / 16 30 7 7 30 / 16 1 14 E 1 / 16 1 1 Answer: 48710 = 1E716. To get the octal answer, we could start with 48710 and do repeated division again, this time dividing by 8. What would be a faster way to get the octal answer? ENEL 353 F13 Section 02 Slides for Lecture 3 slide 6/22Review of conversion between binary and hex and conversion between binary and octal
Hex to binary: Replace each hex digit with the equivalent 4-bit binary pattern. Binary to hex, step 1: If necessary, add leading zeros so you can make groups of 4 bits. Binary to hex, step 2: Replace each group of 4 bits with the equivalent hex digit. For octal, see above, but use 3-bit groups instead of 4-bit groups. Why does this work? See the next slide . . . ENEL 353 F13 Section 02 Slides for Lecture 3 slide 7/22Detailed demonstration of conversion from binary to hex: 1010 0110 10112 = A6B16
1010 0110 10112 = 1 × 211 + 0 × 210 + 1 × 29 + 0 × 28 + 0 × 27 + 1 × 26 + 1 × 25 + 0 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20 = (1 × 23 + 0 × 22 + 1 × 21 + 0 × 20) × 28 + (0 × 23 + 1 × 22 + 1 × 21 + 0 × 20) × 24 + (1 × 23 + 0 × 22 + 1 × 21 + 1 × 20) × 20 = 10 × 162 + 6 × 161 + 11 × 160 ENEL 353 F13 Section 02 Slides for Lecture 3 slide 8/22Signed and unsigned number systems
Signed and unsigned are adjectives used to describe number systems. A signed system has some negative numbers, zero, and some positive numbers. An unsigned system has only zero and positive numbers. ENEL 353 F13 Section 02 Slides for Lecture 3 slide 9/22About the words signed and unsigned
From the previous slide: Signed and unsigned are adjectives used to describe number systems. They are also useful words for describing types in computer programming systems. They are NOT fancy synonyms for “negative” and “positive”, and should NEVER used to describe individual values. AVOID saying things like “−42 is signed” and “37 is unsigned”. Statements like that just don’t make sense!