Well, it seems to work for you, so take the following with a grain of salt.
On FPGAs, any kind of logic generated clock tends to have skew issues.
The two possible approaches to clock gating are (in Altera terms):
a) use the ALTCLKCTRL that sits atop the clock distribution trees
b) use the clock gating logic in each LAB.
For a), you need to use the ALTCLKCTRL functions.
For b) you should simply code with a clock enable style.
always @ (posedge clk)
begin
if(enable) begin
...
end
end
Alternatively, if you have previously written code which is already gated, you can activate the "Auto-Gated clock conversion" option in Quartus to have the synthesis convert logic gated clocks to "clock enables". Your clock gating modules do need to comply with Quartus' template.
The clock gating module you posted is not recognized by Quartus and is not converted into a "clock enable". It simply synthesizes to exactly what you've described, which has two bad things for FPGAs: a latch and a logic generated clock.
The following code does get recognized by the "Auto-Gated clock conversion" option. I do not know if it supports hierarchical clock gating though.
module clockGate(
input wire enable,
input wire clkIn,
output wire clkOut
);
reg q;
always @ (negedge clkIn) begin
q <= enable;
end
assign clkOut = q & clkIn;
References:
Using Timequest:
http://quartushelp.altera.com/current/mergedprojects/logicops/logicops/def_synth_gated_clock_conversion.htm Following Altera's clock gating guidelines:
http://quartushelp.altera.com/9.1/mergedprojects/verify/da/comp_file_rules_clock.htm Lastly, modern synthesis tools for ASIC can generate clock gating from "clock enable" style coding (and a bit more in fact).
I much prefer to turn that option on and avoid explicit clock gating modules in my RTL code.
Also, I have this memory in the back of my mind some of the not-so-modern versions have trouble doing STA on designs with multi-stage clock gating.