CSE370 Laboratory Assignment 2

Constructing Simple Logic Circuits

Distributed: Monday, January 16, 2006
Due: By the end of lab section


This second laboratory assignment continues the introduction to the prototyping breadboard and Aldec's Active HDL We will be using Aldec's Active-HDL as our primary design tool this quarter - both for schematic entry (drawing circuits) and simulating them (verifying that they will operate correctly when we wire them up). In this assignment you will learn how to do both these things for some basic circuits.  As you gain more practice with Active-HDL, we will expect you to use this tool to do a large part of your written assignments throughout the quarter.

By the end of this lab you should feel comfortable entering a schematic for a design, setting up simulation stimuli, and verifying that your circuit is correct. The overall goal for this lab will be to realize a Boolean expression that you will derive for the "Queen of Hearts" using simple Boolean logic gates included in your laboratory kit. By the end of this lab you should know how to construct and verify the operation of a small circuit (3-6 logic gates) in both Active-HDL and on your prototyping board using switches and LEDs as I/O devices.

Each student should complete this lab individually.


  1. Complete Tutorial #1  for Aldec's ActiveHDL.  Make sure to complete the entire tutorial. It is quite long but very informative and thorough. Feel free to get a head start on the tutorial before your lab session so you will have plenty of time to complete the lab. Please remember to create a new design and/or workspace for various class assignments. This quarter you will be using Active-HDL for both laboratory and written assignments to generate many different schematics. Separating the files into different designs based off the assignment/project will help prevent compiling bugs and help the course staff to diagonse your problem faster.
  1. In Chapter 1, problems 1.3 and 1.4, you are asked to realize a circuit to detect the "jack of diamonds".  For this lab you will design a circuit to detect the "queen of hearts" using the encoding scheme below and only the gates that are available in your lab kit. The gates are availbe for use in your schematics in lib370 as "c74<chip_package_number>".  If you don't remember the package number, refer to the lab kit chip map .

1.3)  Encoding for a deck of cards:

Observe that the cards come in groups of 13 (4 suits).  Therefore each card has 2 values that distinguish it: suit (Hearts,Clubs,Diamonds,Spades) and value (Ace,2,...,King). Since the suit can be one of four values, we need 2 bits to encode the suit (0, 1, 2, 3 assigned to clubs, diamonds, hearts, spades, respectively).  The value ranges from 1 to 13 (1=ace, 2, 3, ... , 10, 11=jack, 12=queen, 13=king). 

Encoding values of 0, 14, and 15 are unused.  Note that this encoding requires 6 bits:

V3 V2 V1 V0 S1 S0

In general, note that the higher-numbered subscripts denote higher-order (more significant) bits. By convention, bits progress, left to right, from most significant to least significant.

1.4) As an example of using the encoding scheme above, here is the derivation of an expression for recognizing the jack of diamonds.

The diamond suit is numbered 1 and the jack is the card with value 11 . Its encoding with this scheme is 1011 concatenated with 01 to yield 101101 or:

V3 and V2' and V1 and V0 and S1' and S0

To design a circuit to detect the "queen of hearts" you will need to choose the appropriate gates to implement this logic as the lab kit does not include AND gates. You will want your circuit to be as small as possible.

  1. Draw a schematic for your "queen of hearts" circuit using Active-HDL and the chip parts from the lib370 library.  Using stimulators as shown in Tutorial #1, simulate this circuit for all possible input values, and show that your circuit recognizes the "queen of hearts". Show your schematic and the result of your simulation to a TA at checkoff.  There is no need to print anything.
  1. Using the schematic from task 3, construct a circuit that will identify the "queen of hearts" on the prototyping board by connecting the inputs to switches and the output to an LED. You will need 6 switches and 1 LED for this part.  Please use SW1 through SW4 for the card value and SW5 through SW6 for the suit. Demonstrate your circuit to a TA and have them check you off as having completed this laboratory assignment. They may ask you to show them your work and explain your circuit. HINT: If you circuit is not working as expected use the logic probe to trace through the circuit to help you identify any wiring errors.


 Lab Demonstration/Turn-in Requirements: A TA will "check you off" after you

  1. Show your schematic and simulation output from Active-HDL from task 3.
  2. Demonstrate your "queen of hearts" circuit.

Comments to: cse370-webmaster@cs.washington.edu