Use an lpm_counter configured for down mode (this ensures that fast carry chains are used, and the compare with zero comes for free).
Here's an example ...
-- Altera LPM components
library lpm;
use lpm.lpm_components.all;
...
-- Bit counter
bit_d <= to_slv(BIT_VALUE, BIT_WIDTH);
u3: lpm_counter
generic map (
LPM_WIDTH => BIT_WIDTH,
LPM_DIRECTION => "DOWN"
)
port map (
-- Simulation-only output (suppress Quartus II warning)
--
-- altera translate_off
q => bit_q,
-- altera translate_on
aclr => rst,
clock => clk,
sload => bit_load,
cnt_en => bit_en,
cout => bit_done,
data => bit_d
);
The carry-out, i.e., done indicator, is the zero comparison - it asserts when the count-down counter reaches zero.
Cheers,
Dave