Download Lab 7: Sequential Circuits - Digital Electronics Lab | EE 231L and more Lab Reports Digital Electronics in PDF only on Docsity! Lab 7: Sequential Circuits How fast are you? October 20, 2008 In this lab you will design a sequential circuit to test your reaction speed. The basic idea is that you hit a switch as soon as you see an LED light up. The amount of time you took to react will be displayed on two 7-segment displays. Figure 1 shows the overall circuit that you will design and build. You will use a clock clk to drive a two digit counter, the w signal will be a pulse that lights the LED. The LED will turn off as soon as you hit the switch, and the signal Reset can be used to reset the counters, the display and get the circuit ready to start over. 7−Seg Decoder Enable Reset Two Digit BCD counter 7−Seg Decoder 1 0 Q’ QD Vcc Vcc w 1 Reset clk Figure 1: Circuit for testing your reaction speed. 1 Contents 1 Prelab 2 2 Lab 2 3 Supplementary Material 3 3.1 Verilog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.1.1 Sequential HDL . . . . . . . . . . . . . . . . . . . . . . . . 3 1 Prelab 1. Assuming that we want a minimum resolution of measuring your reaction time to be 1/100 of a second but your board has a 50MHz clock. How can you use a counter to generate a clock with frequency 100Hz. 2. Now that you have a 100Hz clock, you can use that to count the time it takes you to press the switch after the LED goes on and display that on two 7-segment displays. To accomplish this you will need to write a code that will increment the least significant digit and every time it reaches the number 9 you reset it and increment the most significant digit. Write a Verilog code to implement the two digit BCD counter as shown in Figure 1. 3. Write a Verilog code to implement the entire circuit as shown in Figure 1. Use one of the LEDs on your board. 2 Lab 1. Simulate your Verilog program and make sure it works as planned. 2. Wire you two seven segment display and test your counter code. 3. Wire two debounced switches. One will be used as the input to w and the other will be the one you depress once you see the LED light on. 4. Ask the instructor or the TA to test the circuit and record how fast you are. 2