Lecture 2: Digital Systems and Binary Numbers Matthew Shuman October 2nd, 2009
Complements — 1-5 in Text
The meaning of complement is something required to make a thing complete. For example, salsa complements tortilla chips, beer complements pizza, an ice cream cone complements a hot summer day, and apple sauce complements pork chops. A key concept to explore is how two things complement each other. For example, when a piece of pizza is removed from a whole pizza the piece complements what is left behind and vice versa. Each of the 4 following complements use the same concept except in different bases and what is considered a complete number in that base.
Diminished Radix Complement
The diminished radix complements are called by the radix − 1. The diminished complement for a decimal number is the 9’s complement and 1’s complement for a binary number. 1.1.1
The 9’s complement finds whatever is needed to make an entire set of 9’s. This is shown in the example below. Finding the 5 digit 9’s complement of 1357 All 90 s Initial V alue 90 s Complement The 5 digit 9’s complement of 1357 is 98642 1.1.2
99999 −01357 − − −− 98642
The 1’s complement finds whatever is needed to make an entire set of 1’s. This is shown in the example below. Finding the 8 digit 1’s complement of 01101100 All 10 s Initial V alue 90 s Complement The 8 digit 1’s complement of 01101100 is 10010011
11111111 −01101100 −−−−−−− 10010011
The radix complements are called by their radix. The radix complement for a decimal number is the 10’s complement and 2’s complement for a binary number. The value that is considered the whole part is radixdigit . 1
10’s Complement Finding the 5 digit 10’s complement of 1357 radix5 Initial V alue 100 s Complement The 5 digit 10’s complement of 1357 is 98643
2’s Complement Finding the 8 digit 2’s complement of 01101100 radix8 Initial V alue 20 s Complement The 8 digit 2’s complement of 01101100 is 10010100
100000 −01357 − − −− 98643
100000000 −01101100 − − − − −− 10010100
Signed Binary Numbers — 1-6 in Text
A key use of complements is to do subtraction. Building an adder in hardware is fairly easy, but a subtractor is much more difficult. Using the following mathematical property subtraction can be avoided. A − B = A + (−B) The following example shows how adding the radix complement can give an identical result as subtraction. Showing how to do 72532 - 3250 Initial Value Adding a 10’s complement Difference
Normal Way Using Complements 72532 72532 −3250 +96750 − − − − −− − − − − −− 69282 169282
Note the answer has a positive carry out. This means that the difference is positive. If the carry out was 0, then the difference would be a negative number. Taking the radix complement of this negative number indicates the magnitude of the negative number.
Binary Codes — 1-7 in Text
There are other codes, besides standard binary for interpreting how a binary sequence is interpreted. This section covers three separate types of codes.
Binary Coded Decimal
Binary coded decimal is most often used when displaying a decimal value out on 7 segment displays. Figure 1 shows a block diagram of a simple 4 digit calculator. Note how the BCD register has exactly four bits going to each digit. Notice that each 7-segment driver has four inputs, that represent a controlling nibble of information. The driver turns on all of the outside LEDs when a 00002 is input. The defining feature of BCD is 00012 + 10012 = 0001 00002 instead of 00012 + 10012 = 10102 .
ECE 271 Notes
Figure 1: Block diagram of a very simple calculator.
Gray code is another method of interpreting a binary sequence as a number. The defining feature of Gray code is that only one bit changes at a time. This feature makes Gray code useful for rotary knobs and Karnaugh Maps. It is only necessary to memorize the Gray code up to the number 3. 00 → 01 → 11 → 10.
Figure 2: Metal pattern used to make a 3 bit grey code encoder.
American Standard Code for Information Exchange
ASCII codes are used to represent characters. Several key characters are shown in the table below. ’0’ → ’a’ → ’A’ →
4810 9710 6510
ECE 271 Notes
Binary Storage and Registers — 1-8 in Text
Registers are the fundamental storage units in digital logic. A typical register is shown in figure 3. Key parts of the register are the high nibble, the low nibble, the MSB, the LSB, a bit, and a byte.
Figure 3: Diagram showing a typical 8 bit register.
Binary Logic — 1-9 in Text
This section covers the background information necessary to understand how binary values and functions are represented and some information about the analog traits of a digital signal.
Boolean Algebra Symbols ’and’ → ’or’ → ’not’ →
∗ + x0 or x
Logic Gate Symbols
Figure 4: Here are the three fundamental logic gates, with slight variations below them.
The voltage being read into a gate is an analog signal, but the gate acts in a digital manner. This is accomplished by using thresholds to compare the incoming signal. Higher than a threshold is considered a high voltage and is assigned to a 12 . Lower than a voltage is considered a low voltage and assigned to a 02 . If there is a voltage between the two thresholds then it is considered a metastable input and the uncertain input is assigned an ’X’. The images in figure 5 are all from the 74HC08 Quad 2-Input And Gate. ECE 271 Notes
Figure 5: This table shows threshold voltages for the a discrete quad and gate IC.
Logic gates do not instantly have a valid output. It takes time for the inputs to be read and generate a valid output. This delay from input to output is called a propagation delay. The images in figure 6 and 7 give examples of this propagation delay from the 74HC08 Quad 2-Input And Gate.
Figure 6: This table shows propagation delays for a same IC in figure 5
ECE 271 Notes
Figure 7: Chart depicting how the table in figure 6 is measured.
ECE 271 Notes