Project 1: Combinational Circuits
Purpose: to give you experience with basic digital design components.
- 4-bit prime number circuit
Create a circuit with 4 inputs, treated as a 4-bit positive binary integer. The circuit should output a 1 if the input is a prime number and 0 otherwise. Note, the numbers 0 and 1 are not prime numbers.
Simluate your circuit by testing all possible combinations of inputs, similar to the way we tested the circuit in the lab exercise. Take a screen shot of your final circuit design. Include the screen shot in your report. Note, demonstrating that your circuit works is a required part of the project writeup. Be sure to test your circuit and document that testing in your writeup.
Run your circuit on the FPGA board. You will want to map input pins to the switches and the output to an LED. Make it possible for the user to indicate a 4-bit binary number using 4 switches.
- 5-bit prime number circuit.
Create a circuit with 5 inputs, treated as a 5-bit positive binary integer. The circuit should output a 1 if the input is a prime number and 0 otherwise. Note, the numbers 0 and 1 are not prime numbers.
Simulate your circuit by testing all possible combinations of inputs, similar to the way we tested the circuit in the lab exercise. Take a screen shot of your final circuit design. Include the screen shot in your report. Note, demonstrating that your circuit works is a required part of the project writeup. Be sure to test your circuit and document that testing in your writeup.
- Traffic lights
Create a circuit that has two components. One component should be a counter, which is available as a module. The important inputs to the counter are a clock and a reset button.
The second part of the circuit should be a combinational circuit that controls the six lights of a 4-way traffic light. There are NS-red, NS-green, and NS-yellow, EW-red, EW-green, and EW-yellow. They should follow the timings below, given the 4-bit input from the counter.
Input Values Light setting 0 N/S Red, E/W Red 1-5 N/S Green, E/W Red 6-7 N/S Yellow, E/W Red 8 N/S Red, E/W Red 9-13 N/S Red, E/W Green 14-15 N/S Red, E/W Yellow
Test your circuit by driving the counter with a clock. The easiest way to test it is using the board and having a push-button as the clock input. Demonstrate your six output signals for all possible inputs.
Now, test it again using VHDL simulation. Because of issues using LM_COUNTER in VHDL, you should download this VHDL counter to test your program (unless, of course, you have already written your own). With your traffic project open, open the counter.vhd file. Then select Project:Add current file to project. Then select File:create/update:make symbol files from current file. After that, replace your lpm_counter with the new counter, reconnect the inputs, and try again. Note that the counter I'm providing has an enable input, which should always be 1 (you can use the symbol vcc to create a 1) and a reset signal, which should start at 1 to reset the counter and then go to 0 a short time later to let the counter run. Make the reset signal be an input to your traffic circuit.
Here is also an example of a testbench for the counter circuit. It shows you how to make a clock of arbitrary length (which might be easier for driving your traffic circuit). You can modify it to drive the traffic light circuit instead of the counter.
Take a screen capture of your final circuit and your simulation. Include them in your project report.
- Use a Karnaugh map to make one of your circuits a minimal logical circuit. Test the new circuit to make sure its output is correct. Then include images of your K-map and your minimal circuit in your write-up.
- Make additional circuits minimal, using a K-map. Be sure to include an image of your K-map along with the image of your circuit.
- Extend the prime numbers circuit to 6 bits.
- Do something interesting with the traffic light circuit, like add a walk button that makes the light leave the opposite green early (this is challenging).
Create a wiki page with your writeup. For each task, write a short description of the task, in your own words.
- Include a picture of your final design.
- Include a picture of your simulation, if you have one.
- Describe why the simulation proves your circuit works, if you simulated the circuit.
- If you tested your circuit using hardware, describe your procedure and explain why it is sufficient.
- Include a description, and pictures, of any extensions.
- Please supply a list of people you worked with, including TAs, and professors. Include in that list anyone whose code you may have seen, such as those of friends who have taken the course in a previous semester.
Give your wiki page the label cs232f16project1.
Put your bdf files in a folder called project1 in your private subdirectory on the Courses server in /COMP/CS232. Put only the bdf file into your handin directory.