Forum: FPGA, VHDL & Verilog Coding style suggestions for clocks and clock frequencies

Author: Martin Stolpe (stmartin81)
Posted on:

Rate this post
0 useful
not useful

I'm trying to find some good coding guidelines regarding clock signals. 
I've used the approaches to append the frequency to the clock name (e.g. 
clk_2p5mhz). Another approach I took was to give the clocks specific 
names (e.g. clk_system).

But when I want to reuse components the clock names and the frequency of 
the clock could change.

I think the input clock can be named just "clk" or similar if the 
component doesn't need to know the frequency of the clock. Sometimes I 
need to count for a certain period of time and for that I need to know 
the frequency of the clock / clock period.

I though about using a generic which is of type time like this:
entity my_entity is
  generic (
    CLK_PERIOD_G : time
  port (
    CLK : std_logic;
end entity;

I'm interested to see what other coding styles you use.


Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
You can also define a package and specify the clock frequency or the 
clock cycle time as a constant. But generics are more direct and 


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.