ECE Undergraduate Laboratories
ECE 394 - Digital Systems Laboratory

Lab 5: Design Project – A Gate Function Detector

1.    Objectives

This project is designed to allow students to apply digital design techniques to design a chip function detector. Given a two inputs one output gate with unknown function, you should detect the function of this gate.

2.   Experiments

Generate a two bit sequence “00 01 10 11” as the inputs to the unknown gate, from the output sequence, you should be able to detect the function of the gate.  The functions of the gate are restricted to one of NAND, AND, and XOR. Fig. 1 shows a block diagram for the gate function detector. 

Gate function Detector block diagram
Fig. 1. Block diagram of a gate function detector.

The sequence generator is actually a 2-bit counter which can be constructed using flip-flops.  The sequence detector has three output lines corresponding to the functions NAND, AND, and XOR, respectively.

To visualize how this works, think about the truth tables for these simple binary functions.  For two inputs, there are four possible input values, 00, 01, 10, and 11.  You know the output generated by the NAND, AND, and XOR gates for each of these input values from their truth tables.  The sequence generator portion of your circuit will generate these input values, one per clock cycle.  These values will be input to the test gate, which will produce an output; the sequence detector portion of your circuit will store the output for each set of inputs.  When your circuit has gone through all four sets of input values and generated the output for each one, the sequence detector will have the four output values stored.  You can then compare the four output values to the values you expect to see for each function and light an LED that corresponds to the function of the gate.  For example, if your sequence generator produces the pattern 00, 01, 10, 11, and the test gate outputs 0, 0, 0, 1, your test gate is an AND gate.  Your sequence detector looks for that pattern as the last four bits generated and lights the LED for the AND function.

In order to function properly, you will have to synchronize your input sequences.  That is, you should use the Reset input to force your sequence generator to start at 00, as well as to clear the stored outputs in the sequence detector.  This will ensure that you do not light one of the LEDs due to some random value being stored in the sequence detector.

3.     Prelab Assignment

1. Draw the circuit diagram of the sequence generator.

2. Draw the circuit diagram of the sequence detector.

4.    Extra credit

Extend the design so that it can test all 16 functions for a two-input gate.