Lab 4

Make a decimal digit advance once per second

A board clock keeps ticking while your browser waits for the next camera frame. Use the DE1-SoC's 50 MHz clock to display 0 through 9 repeatedly on HEX0. SW8 resets the counter. SW9 pauses the count so you can read the display.

Lab setup

Physical DE1-SoCCyclone V · 5CSEMA5F31C6 · camera, switches and buttons in the browser

  1. Get the starterDownload second_digit.v
  2. Open the LabsLand Online EditorOpen the lab LabsLand asks you to sign in. Use the access your course or institution provides.
  3. Follow the worksheetPredict first, then build, read the board and hand in. The build steps are below.

Starter files · Verilog · VHDL · SystemVerilog

Design the interval

How many rising edges make one second? If the first count is zero, find the last count and the minimum width of the interval register. Draw the sequence across the last two clock edges before a tick and the first edge after it. Use a clock enable in one clock domain.

Build

Open the second_digit starter for your HDL in the Standard Online Editor. The two switches are already synchronized to CLOCK_50. The reset path and active-low display decoder are supplied. Implement the interval and decimal counters. Check that pause holds both counters and reset takes priority over pause. Keep the hardware parameter at 50,000,000 when you synthesize and upload the program.

Measure a complete cycle

Raise SW8 until HEX0 reads 0. Lower SW8 and start timing when the display changes from 0 to 1. Observe the sequence for a full turn. Time the interval from one transition to the same transition ten digits later. Camera updates can arrive unevenly, so measure the full cycle and divide by ten.

Trial First and last digits Elapsed time Observation
Ten transitions
SW9 held high for at least 3 seconds
Reset while paused, then release reset

Resume and confirm that the next digit follows from the one you froze. Submit the table, one observation of 9 wrapping to 0 and your measured seconds per digit. Explain what happens if the terminal count is 24,999,999. Return both switches to zero before leaving.

Adapted from FPGAcademy Digital Logic 21.1 · Lab 4, III. verilog · vhdl · MIT