# Lab Project 4

## Introduction

#### Problem 1.

Amy, Baker, Cathy, and David, the bean buyers for the “Overhead Coffee Company”, have designed a more complex voting system to decide when to buy new beans. Design and implement a logic circuit that they can use to indicate whether they should buy new beans. Use slide switches for vote entry (either “buy” or “not buy”), and an LED to indicate when beans should be purchased. A “buy” order is placed if:

• Amy, Cathy, and David vote NO and Baker votes YES
• or Amy and David vote NO and the rest vote YES
• or Baker and David vote YES and the rest vote NO
• or Amy votes NO and the others vote YES
• or Baker votes NO and the others vote YES
• or Baker and Amy vote YES and the others vote NO
• or Cathy votes NO and the others vote YES
• or David votes NO and the others vote YES
• or Amy and Cathy vote YES and the others vote NO
• or they all vote YES

#### Problem 2.

Define and simulate a circuit that can detect all prime numbers less than 64. Assume that the four inputs to your circuit (B3B2B1B0) are used to form a four-bit binary number in the range 0 to 15. Your circuit should illuminate an LED whenever the input binary number is a prime number. Verify your circuit's behavior through simulation, then synthesize and download it to your board. Use four slide switches as inputs, and a single LED as output. Note that this circuit can co-reside in your board with the previous problem if you use a different LED for the output.

#### Problem 3.

Use twelve 1's in three groups of four cells to specify a 5-input, one output circuit to serve as your K-map battleship field in the diagram below. You may want to print additional copies of the K-map to practice designing a circuit that you think will be the hardest to guess. Find a minimum circuit, and enter and simulate it using the Xilinx CAD tools. Name the inputs A,B,C,D, and E, and name the output OUTPUT. Print and submit the circuit schematic and simulator output

#### Problem 4.

Download the circuit to your board and test it. If you are able to, find someone who can attempt to locate all the minterms in your circuit by moving one slide switch at a time. Before starting, the visitor can request that the five input switches be set to any initial pattern. The visitor hunts for your minterms by sliding the input switches one at a time to new positions. The visitor should record their path through your K-maps in the “offense” K-map in their submission form, and you should also record the path in your “defense” K-map. The visitor keeps changing the input pattern until all the 1's have been discovered. After all 1's have been discovered, enter the total number of moves the visitor required in the “defense“ blank below. Then change roles, and probe your neighbor's map. Enter the total number of moves required in the “offense” blank below.

Total score: (Equals Offensive Moves + (100 – Defensive Moves)) ____________