as a newbie to VHDL I wondered if there was any particular reason why I cannot slow my clock down using counters alone? In all the examples I looked at so far, people seem to have created an entity and separate process for the new clock. The code below is my attempt.
variable clk_counter : integer range 0 to 30 := 0;
begin
if rising_edge(clk) then
clk_counter:=clk_counter+1;
if clk_counter = 30 then
clk_counter := 0;
...
Any help would be much appreciated.
if clk_counter = 30 thenstatement, this should successfully clock enable once every 30 cycles. There are some important differences between clock enables and clock division though. First of all, using a clock enable this way will not affect your actual clock signal at all, it only affects the registers inside of your if statement. Secondly, if you do complex logic, you will still be limited by the setup and hold time of your original clock. Using an actual clock divider will relax your setup and hold times. - QuantumRipple