220 likes | 356 Views
This lecture explores the fundamentals of binary numbering systems, including decoders and 7-segment displays. We'll discuss the complexity of wiring in digital systems and tackle questions about binary representation, such as how to identify negative numbers and convert between numeral systems. The importance of the base and radix will be highlighted, along with methods for binary addition and subtraction, and the challenges of representing negative numbers. Join us as we review key concepts and prepare for upcoming homework challenges.
E N D
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? • 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?
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 ?
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.
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?
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?
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
Other bases • Octal • Hexadecimal • Does it matter that you can convert between them?
Basics • Conversion • How do you do it? • What is 10 in binary? • What is 100 in binary?
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?
Subtraction • 101 – 011 =
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. ?
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.
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.
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
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
Question • In one’s complement what are the following numbers? • 000 • 111
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.
Review • Binary • Numbering systems • Addition / Subtraction • One different way to represent them