There are several ways in which this clock enabling can be done in Verilog.
In the code snippet below you can find two processes. The first process generates a clock_enable pulse every 128 clock cycles. It is easy to update this code to other cycle lengths.
The second process uses the clock_enable signal to have something executed every 128 clock cycles.
reg clock_enable;
reg counter;
always @(posedge clock)
if (reset) begin
clock_enable = 0;
counter = 0;
end else begin
if (counter == 7'b1111111) begin
counter = 0;
clock_enable = 1;
end else begin
counter = counter + 1;
clock_enable = 0;
end
end
always @(posedge clock)
if (reset) begin
// ... bla bla bla;
end else begin
if (clock_enable) begin
// do whatever needs to be done every 128 clock cycles
end
end
Verilog designers could be very well tempted to use a clock enable signal as generated above in the sensitivity list of the always @(posedge clock)-construct. This is however bad design practice, as you are also menitoning in your question. When doing this your design will be vulnerable to glitches, races and hazards, and you will probably not design robust hardware.