1 / 22

ITEC 352

ITEC 352. Lecture 6 Back to binary. Review. Decoders 7 segment display Complexity of wiring Questions?. Outline. Homework Binary May be short depending on what you remember from Discrete Math. Questions. How can you tell if a number is negative in binary?

neila
Télécharger la présentation

ITEC 352

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ITEC 352 Lecture 6 Back to binary

  2. Review • Decoders • 7 segment display • Complexity of wiring • Questions?

  3. Outline • Homework • Binary • May be short depending on what you remember from Discrete Math

  4. Questions • How can you tell if a number is negative in binary? • How can you tell if a number is 3.5743 in binary? • How can you tell if a set of binary digits is a String? • What do these questions lead you to believe about binary numbers?

  5. Numeral systems • Numeral Vs. Number • same as difference between a word vs. the things it refers to. • numeral is a group of symbols that represents a number. • E.g., 15 can be represented as: • 15, Fifteen, XV (roman) • What numeral system do we use everyday ?

  6. Numeral system (2) • Any numeral system is characterized by the number of digits used to represent numbers. • E.g., • Unary system: ? • Binary system: ? • Octal: ? • Decimal: ? • The numeral system is called the base.

  7. Numeral system (3) • If we had lots of numeral systems in use, things will get confusing: • E.g., What is: 20 + 10 = ? • Is it: • 30 ? • 24? • 12?

  8. Number Systems • To make things easier for us: we use decimal number system as our base. • Every number in any other base is converted to decimal for us to be able to understand. • How do we do this conversion?

  9. Radix • Determines the value of a number, by assigning a weight to the position of each digit. • E.g., Number 481 • start all positions from 0. • Position of “1” : 0; weight of position: 1 • Position of “8” : 1; weight of position: 10 • Position of “4” : 2; weight of position: 100 • Hence number: 4*100 + 8 * 10 + 1 * 1 • Weight is calculated as 10^position • Any decimal number can be represented this way. • 10 is called the base or radix of the number system. • We use notation ()rto represent the radix. • E.g., the decimal number 481 can also be written as: (481)10

  10. Other bases • Octal • Hexadecimal • Does it matter that you can convert between them?

  11. ConversionChart

  12. Basics • Conversion • How do you do it? • What is 10 in binary? • What is 100 in binary?

  13. Adding Subtracting • What is binary 1 + binary 0 = ? • What about binary 1 + binary 1 = ? • Addition is similar to decimal addition. • remember though that the answer will only use one of two digits: 0 or 1. • How about subtraction?

  14. Subtraction • 101 – 011 =

  15. Subtraction • Subtraction introduces some challenges: • Answer maybe negative. How to represent negative binary numbers? • Subtraction isn’t easy: requires carry-ins… • Can we make it easier? What type of subtractions are easy to implement? • Can we use the same circuit for addition and subtraction. ?

  16. Limitations • TWO key limitations: • It only represents positive numbers. • How do we accommodate negative numbers? • What about numbers that have too many digits? • A computer is bound by its data bus in the number of digits it can handle. • E.g., a 32 bit data bus, implies, the computer can store upto 32 bits for a basic data such as a byte. • Ofcourse, integers can be represented as multiple bytes, but this decreases the speed of compuration. • Solution: Floating Point Representation. • Next: Representing negative numbers.

  17. Negative numbers • Our goal: • We want a representation of negative numbers such that: • Subtractions are as easy as additions: • Instead of subtraction we should be able to simply add. • Or • If it is a subtraction, there should be no carry. • We have some facts at our disposal. The number of bits you can use to represent any number in a computer is limited.

  18. Complement notation. • The invention of complements. • Assume our computer is limited to two digits. • Find x in the following equation (restricting answer to two digits): • 54 – 45 = 54 + x • Introducing 10’s complement • 10’s complement of 45 = 55 • 10’s complement of 99 = 1 • What is 54 + (10’s complement of 45) restricted to two digits ? • The 9’s complement for decimal digits: • 9’s complement for 45 = 99 – 45 = 54 • 54 + 54 = 108 • 1 + 08 = 9 = 54 - 45

  19. One’s complement • Invert all positions in the number • To subtract, add the numbers • If there is a carry out, add it to the first number in the result • Done

  20. Question • In one’s complement what are the following numbers? • 000 • 111

  21. Questions • On 3-bit architecture, what are all the positive and negative numbers that can be represented if numbers are represented in one’s complement notation? • Write down the binary representations of all the numbers.

  22. Review • Binary • Numbering systems • Addition / Subtraction • One different way to represent them

More Related