This repository contains a Verilog implementation of a 24-hour digital clock designed for FPGA platforms. The design displays hours, minutes, and seconds on a 7-segment display, providing a complete timekeeping solution that can be easily integrated into various FPGA development boards.
- 24-hour time format (00:00:00 to 23:59:59)
- Real-time display on 7-segment displays
- Configurable clock frequency
- Reset functionality
- Efficient display multiplexing
digital_clock.v
- Main implementation of the digital clockdigital_clock_tb.v
- Testbench for simulation and verification
The digital clock consists of several key components:
- Clock Divider: Converts the 100MHz system clock to a 1Hz clock for timekeeping
- Time Counter: Tracks seconds, minutes, and hours with appropriate rollover logic
- Display Controller: Manages the 7-segment display multiplexing
- 7-Segment Decoder: Converts BCD values to 7-segment display patterns
- FPGA development board (tested on boards with 100MHz clock)
- 6 seven-segment displays
- Reset button
To simulate the design using your preferred Verilog simulator:
# Example for Icarus Verilog
iverilog -o digital_clock_sim digital_clock.v digital_clock_tb.v
vvp digital_clock_sim
To implement on an FPGA:
- Add the source files to your project
- Assign appropriate pins for:
- System clock (
clk
) - Reset button (
reset
) - Anode signals (
an[7:0]
) - 7-segment display signals (
seg[6:0]
)
- System clock (
- Generate bitstream and program your FPGA
The clock frequency can be adjusted by modifying the CLK_FREQ
parameter in the digital_clock.v
file. For simulation purposes, you may want to reduce this value to speed up the simulation process.
The included testbench (digital_clock_tb.v
) provides a basic verification environment:
- Applies reset
- Runs the clock for an extended period
- Monitors time values and display outputs