Multi Clock Frequency Converter and Debounce Function

By the CRAM Group

November 22, 2001

The crystal oscillator built for the FLEX10K device provides the system a 25MHz clock which is often too fast for most FPGA designs. Very often different slower clock frequencies are needed for different parts of an FPGA system. In this AppNote, we attempt to illustrate how a good debounce circuit uses a 25MHz clock -> 100Hz clock converter to increment a 4-bit counter circuit (Lab 2, Fall 2001) from a push button on connected to the FLEX10K device.

The clk_div.vhd circuit can also be used to convert the 25MHz system clock to four other clock frequencies at the same time. This is useful when you require more than one frequency type in your design. There XX outputs for the different clock frequencies. More can be added if you require extra clock frequency types. The outputs can just be ignored and not port mapped to anything if not needed.

Here are the files that you should copy and compile in a directory. You won?t need to instantiate anything as it has already been done for you in the top level file called count4bit.vhd. The .vhd files listed below should be compiled from bottom up (starting from clk_div.vhd).
 
 

Count4bit.vhd(This file shows how the debounce and clk_div circuits are instantiated at the top level program)

Bin_to_led.vhd (This won't be shown since it's the Lab 2 assignment. You can run the program by downloading the .sof and .pin files. )

Debounce.vhd

Clk_div.vhd

count4bit.sof(If you can't find the pins from the .sof, you?ll have to assign the pins according to the pin assignments below)

count4bit.pin

The following pin assignments are recommended when using the above circuit.

Reset-> Pin 29 (push button PB 2)

Clock_manual->Pin 28 (push button PB 1)

Clock_25MHz->Pin 91(system clock)

Led0->Pin 6(led segments)

Led1->Pin 7

Led2-> Pin 8

Led3->Pin 9

Led4->Pin 11

Led5->Pin 12

Led6->Pin 13
 
 

Press on PB 1 (clock_manual) to see the counter increment a number at a time to see how the debounce circuit works. PB 1 is the reset button and should set the led segment display back to 0.

Please write to sueann_u@yahoo.com or any of the CRAM group members shahid1994@yahoo.com and sbhamra@hotmail.com if you have any questions or wish to report a bug in the above appnote.

If you like this appnote, don't forget to look at other appnotes by the CRAM group