8. CMOS Logic Circuits

8.1. Objectives

  1. Reinforce basic principles of CMOS logic from ELEC 2210 lecture
  2. Gain experience with complex CMOS gates
  3. Learn to construct CMOS transmission gates
  4. Work with chains of CMOS inverters

8.2. Required Soft Front Panels (SFPs)

  1. Function Generator (FGEN)
  2. Scope
  3. Digital Writer
  4. Digital Reader

8.3. Required Components

  1. 3 x CD4007 (dual CMOS pair plus inverter). You can download or view the data sheet here or here.
  2. 3 x 1K Ohm resistor.

8.4. Overview

8.4.1. CD4007

The CD4007 consists of 3 pairs of complimentary MOSFETs, as shown in figure 1. Each pair shares a common gate (pins 6,3,10). The substrates of all PMOSFETs are common (pin 14), as well as those of the NMOSFETs (pin 7). For the left pair, one of the two NMOS N+ terminals is tied to the NMOS substrate, and one of the two PMOS P+ terminals is tied to PMOS substrate. The other two pairs are more general purpose. For the right pair, a N+ terminal of the NMOS is tied to a P+ terminal of the PMOS (pin 12).

CD4007 functional diagram

Figure 1: CD4007 functional diagram.

The CD4007 is a very versatile IC with many uses. For example, a single CD4007 can be used to make a chain of 3 inverters, an inverter plus two transmission gates, or a complex logic gate. Inverters and transmission gates are particularly useful for building D flip-flops.

8.4.2. Static Discharge

While the CD4007 is very versatile, it is also easily damaged by static, like all CMOS electronics. The CD4007 includes diodes to protect it from static discharge, but it can still be damaged if it is not handled carefully. Normally one would use anti-static mats and wrist straps when working with static sensitive electronics. However, we do not have those in the 2210 lab. A low budget way to avoid static discharge is to ground yourself before touching an IC. The ELVIS breadboard includes a metal pad in both top corners labeled “ESD PAD TOUCH TO DISCHARGE.” Discharging any built up static charge before picking up a CD4007 will help ensure that you do not have a broken chip half way through the lab.

8.4.3. Wiring Notation

When specifying wiring between the pins of an IC, engineers often use a shorthand for connections. For example, instead of saying, “connect pin 22 to pin 5 and pin 7,” one might write “(22,5,7)”. Groups of pins that are not connected are separated by a semicolon. For example, consider (22,5,7);(1,3,18). This notation is often used in datasheets, and is used below as well.

8.5. Pre lab

  1. Study the CD4007 datasheet thoroughly.

  2. Draw an equivalent circuit for the following wiring description using a CD4007: (1,5,10);(3,8,13);(14,2,11);(7,4,9);(14,Vdd);(7,Ground).

    You do not have to draw a gate level schematic if you can determine the logic function implemented. If you only give a logic diagram, show pin numbers between logic elements.

  3. Make a pin-level wiring diagram for a transmission gate using a CD4007. Use the top right PMOSFET and the bottom center NMOSFET shown in figure 2 below.

    CD4007 functional diagram

    Figure 2: CD4007 functional diagram.

  4. Determine the logic function implemented by the following connections to a CD4007: (2,14);(8,9,4);(12,13,5);(1,11);(14,Vdd);(7,Gnd). Pin 3 is A, pin 10 is B, and pin 6 is C. The output is pin 12,13, or 5. Draw a transistor level diagram and a truth table for the circuit.

8.6. Lab Exercises

8.6.1. CMOS Inverter Chain

  1. Construct 3 inverters using a CD4007 by making the following connections: (4,9,7);(1,5);(8,13);(14,2,11);(14,Vdd);(7,Ground). Use +5v for Vdd. Connect AI0+ to FGEN. Set the function generator to output a 500Hz sine wave, 5vpp, 2.5vdc offset.

  2. Test each inverter by connecting the function generator to the input and connecting AI1+ to the output. Remember to ground the AI- terminals.

    The respective input-output pairs are: 6-8,3-5,10-12. You should see 3 waveforms similar to the one shown in figure 3.

    inverter output

    Figure 3: Output of first inverter.

  3. Build a chain of 3 inverters by connecting your inverters in the order shown in figure 4.

    inverter chain

    Figure 4: Inverter chain.

  4. Keeping the input (from FGEN) at pin 6, connect AI1+ to the output of each inverter (one-after-another) and take a screenshot similar to figure 5. You should take a total of three screenshots, one each, corresponding to each inverter output.

    inverter chain output

    Figure 5: Output of second inverter.

  5. Do not dissassemble the inverter chain. It will be reused later.

What to do in lab report

Show 3 screen shots of inverter outputs. Describe the differences between the screenshots (other than that they are inverted).

8.6.2. CMOS Transmission Gates

  1. Build a double transmission gate using a new CD4007 chip as shown in Figure 6. We will test the two transmission gates by connecting FGEN to the input, and connecting a load of 1k \Omega on either (output) sides.

  2. Connect FGEN to (1,12,5); attach 1k \Omega resistors to (2,9) and (4,11) as shown in Figure 6.

  3. Connect pins (2,9) to CH0, and pins (4,11) to CH1. Remember to ground the CH(-) terminals.


    Figure 6: Double transmission gate connections.

  4. Set the function generator to produce a 500Hz square wave, 5vpp, 2.5vdc offset.

  5. Connect CLK to DIO7 to set CLK to 0 and 1. Observe the waveforms on CH0 and CH1 for CLK=0 and CLK=1. In each case take a screen-shot.

8.6.3. D-latch

We will now combine the double transmission gate built in the previous exercise with inverter chain of the first exercise to build a D-latch as shown in Figure 7. The two transmission gates work in tandem to realize the D-latch. During the transparent phase of the latch, i.e. CLK=0, the first transmission gate (left) is ON while the second (right) is OFF. D is transmitted to the output (Q) through the first transmission gate and the two-inverter cascade. During the hold phase of the latch, i.e. CLK=1, the first transmission gate is OFF but the second transmission gate is ON. As a result, any change in the input D is not reflected at the output Q. However, the second transmission gate, which is now turned ON ensures that the previous logic level at Q is retained through the closed loop with the two-inverter cascade.

  1. Connect pin 9, which serves as D input of the latch to DIO0. Connect pin 4, which serves as Q output of the latch to DIO8. Connect pin 6, which serves as CLK to DIO7.


    Figure 7: Schematic of D latch.

  2. Now insert two inverter chain you built earlier (and retained from the first exercise) to the circuit you have just built. It is shown in the dashed box labeled as chip 2 in Figure 7 above.

  3. First apply logic Low to CLK by starting the SFP and turning DIO7 low. Apply logic High to the D input by flipping DIO0 to high.

  4. Observe the output Q of the latch on DIO8 (by using the digital reader from the SFP). A steady high should appear. Capture a screen shot.

  5. Apply logic Low to the D input by flipping DIO0 to low. Observe the output on DIO8. This is the transparent phase of the latch. You should see that DIO8 is also low.

  6. Now apply logic High to CLK by making DIO7 high. Also apply logic High to the D input.

  7. Observe the DIO8 pin. A steady low should appear inspite of changing D to logic High since the previous value at D-input was low. Capture a screen shot. This is the opaque phase of the latch.

Two copies with opposite phase clocks will then make a master-slave D Flip Flop. That is going to be left as a bonus exercise.

8.6.4. Bonus Exercise - Building Your Own Master-Slave D Flip Flop from Transistors

We have just learned in our lecture that sequential CMOS circuits are implemented in CMOS specific fashion using CMOS transmission gates. A widely used circuit is a master slave D flip flop, which we will build and test below. We will use the D-latch constructed in the previous section as the master latch in our master slave D flip flop. We will now need to construct another D-latch that will serve as slave latch to form our master-slave D Flip-flop as shown in Figure 8 (Click on the Figure to view a full-size picture). For the complete circuit you will need 4 CD4007 chips. Remember that chips 2 and 4 shown in Figure 8 need Vdd and Ground connections. Proceed as follows:


Figure 8: Schematic of D flip flop.

  1. Build another set of transmission gates on a third CD4007 chip. For this pair the clock must be inverted, so the wiring is slightly different: (1,5,12);(2,9);(11,4);(3,8,13);(6,10);(7, ground); (14, VDD). Pin 2 or 9 is the D input, pin 4 or 11 is the Q output, and pin 6 is the clock signal.
  2. Build a second inverter buffer on a fourth CD4007 chip: (4,7);(1,5);(3, 8,13);(14,2);(14,Vdd);(7,Ground). Pin 6 is the input and pin 1 or 5 is the output.
  3. Complete the slave latch by connecting the buffer on chip 4 to the transmission gates on chip 3. Connect pin 6 on chip 4 to pin 1, 5, or 12 on chip 3. Connect pin 1 or 5 on chip 4 to pin 4 or 11 on chip 3.
  4. Test your second latch. Does the output follow the input when the clock is high? Will the latch hold both high and low states when the clock is low?
  5. Connect the output of the first latch to the input of the second latch (connect pin 4 or 11 on chip 1 to pin 2 or 9 on chip 3). Tie the clock signals together (connect pin 6 on chip 1 to pin 6 on chip 3). This combination is a master-slave flip-flop.
  6. Connect clock to FGEN. Connect the D input to the AO0. Connect AI0 to FGEN. Connect AI1 to the output.
  7. Download the waveform file here.
  8. Load the waveform file into the arbitrary waveform generator and check the box the box next to Enabled. Click run. This waveform is the input data.
  9. Use the function generator to generate a 5v clock signal (5Vpp, 2.5Vdc offset).
  10. Use the scope to observe the output and clock. Save a screenshot. Is the flip-flop rising or falling edge triggered?

8.6.5. Clean up

Please place components back in the correct drawer.

Thank you for keeping our lab clean and organized.


You are encouraged to write down your experience with this lab along with any feedback or suggestions.

You can also document mistakes or missteps that occurred, e.g.

  • my oscilloscope ground was not connected to the GROUND of the board, or
  • my IC was not connected to power, or
  • my IC was not grounded, or
  • my IC was broken, or
  • I couldn’t complete all the lab exercises within the designated time.

Such information will be used to improve this and future labs and your experience will help future students.