ECE238 laboratory lecture notes – University of New Mexico

Lab 3 Lecture Notes - Introduction to Arithmetic circuits
Part 1. Introduction to Multiplexers
The multiplexer is one of the basic building blocks of any digital design system. What it does is it takes a number of inputs and multiplexes them onto a single output line. That is, it selects one of the input lines, and passes its state to the output line. The input on the A, B, and C lines tells the multiplexer which one of the inputs 0-7 to pass to the output. In the image above A=0, B=1, and C=0, so the input line selected to be passed to the output would be line 2. This property of multiplexers is very useful. As you will see later on, we can use a multiplexer to implement complex logic functions. In terms of practical lab experience, it allows one chip, the multiplexer, to do the job of several simple logic gates. Later on, you will see how to use the multiplexer to implement binary addition and subtraction. However, before you can do this, you need to know something about binary arithmetic.

0 1 2 3 4 5 6 7 enable Data Selector / Multiplexor Y

A B C

Figure 1: A Multiplexer

Part 2. Digital Arithmetic - Adition
This section discusses the basics of digital addition. Here is a block diagram of a binary adder: From this diagram, you can see that the adder has three inputs and two outputs. This will mean that one must generate two different K-maps, one for each output. Here are the functions each line performs: • • • • A,B - The two numbers to be added K- Carry-in C- Carry-out S- Sum

Figure 2. Adder block diagram

Fall 2005,alnz@v1.1

1

Note that the Sum is A when B and K are both true and false. The Sum is the complement of A when B or K is true. the 4-to-1 MUX will be used to implement the binary adder. but not both. K-map for the Sum Let's take a few moments to inspect this Karnaugh map.1 2 .ECE238 laboratory lecture notes – University of New Mexico Figure 3. Fall 2005.alnz@v1. The following is the logic diagram of the 4-to-1 MUX. and one for the Carry Out. Figure 4. one K-map for the Sum. Full adder truth table Using Multiplexers to Design a Binary Adder Instead of using the 8-to-1 MUX introduced in Part 1. Figure 5. generate two K-maps. Adder implemented using a MUX Design process Using the truth table shown in figure 3.

Recall that the value on the control lines determines which input line is passed to the output. Think of how we could use this K-map to produce the Carry-Out using a 4-to-1 MUX. we have to address the Carry Out output. K-map for the Carry-Out. A A A A Data Selector / Multiplexor Sum S1 S2 B K Figure 6. Also. This makes things easier.1 3 . note that when B or K are true. S1. you can cascade several binary adders together to produce the sum. The block diagram for the carry out is shown in figure 8. then the output is also true. how can we use this knowledge to create the Sum from a 4-to-1 MUX? Recall that the output is either A or the complement of A. we can generate the correct Carry-Out by tying input line 0 to ground. the output is A. Carry out block diagram If you want to add bigger numbers.alnz@v1. Finally. Note that when B and K are both true.ECE238 laboratory lecture notes – University of New Mexico Now. Figure 7. And. Figure 6 shows a block diagram for the sum implemented using 4x1 MUX. you can see that we can build a simple onebit adder using just two 4-to-1 MUXes. here. So. 0 A A 1 Data Selector / Multiplexor Carry in S1 S2 B K Figure 8. Then we must tie the complement of A to input lines 1 and 2 (01 and 10). This allows us to use a 4-to-1 MUX to produce the Sum. This will generate the correct output. inspect the K-map shown in figure 7 for a moment. then we can tie A to input lines 0 and 3 (00 and 11). notice how the 4-to-1 MUX has two control lines. and S2. input line 3 to Vcc. and both input lines 1 and 2 to A. then the output is also false. Note that when B and K are both false. if we again apply B to S1 and K to S2. Block diagram for SUM Now. Here is the solution: If we tie B to S1 and K to S2. but not both. Fall 2005. Now.

The two numbers to be subtracted.ECE238 laboratory lecture notes – University of New Mexico Part 3. D – Difference. Digital Arithmetic . This will mean that one must generate two different K-maps. X.Substraction This section discusses the basics of digital subtraction. Subtractor truth table.Borrow-in.alnz@v1. b . B . one for each output. Subtractor block diagram. Figure 9. you can see that the subtractor has three inputs and two outputs. Figure 9 shows the truth table for the subtractor. This subtractor will work on two one-bit numbers X and Y. From figure 9.Borrow-out. Fall 2005.1 4 . Here are the functions each line performs. • • • • Figure 9. Here is a block diagram of a binary subtractor.Y .