##### Child pages
• Will Fitch CS232 Project 1
Go to start of banner

# Will Fitch CS232 Project 1

This project was in two parts. The first was to build prime number finder that would take a 4-bit number and return 1 if it was prime, 0 otherwise. I did this using a k-map that helped me to determine the series of logic gates that determined if the number was one of the prime numbers, 2, 3, 5, 7, 11, or 13. Below is a picture of the final logic gate I used: To test this circuit, I used ghdl to simulate each input. A picture of the simulation is below: The simulation shows an output of 1 for f only when abcd is the 4-bit representation of a prime number, and thus the circuit works.

As an extension, I also did a prime finder for 5 bits, which is shown below: This is a link to me testing it on the board. https://photos.app.goo.gl/J83tpsmWQ11X2ei36

I tested every 5-bit number and the light lit only when the number was prime, so the circuit worked.

The second part of the project was to simulate a traffic light using a counter to count up through 16 numbers, each of which was associated with 2 different lights on two traffic lights. The logic schematic is shown below. I associated the time signatures that produced the same combination of lights with each other and made separate logic circuits for each group. Here is the link of me testing it on the board: https://photos.app.goo.gl/gKKBfzYruEt1C48T6

We can see that the lights are correct for each output, so the circuit works.

For an extension I built a circuit that switches the lights from normal behavior to blinking red when a switch is turned off, simulating a power outage. The circuit is shown below. 