I was looking through the debouncer code and being a good C programmer drilled to initialize all variables before use, was perplexed that the line of code:
begin
PB_cnt <= PB_cnt + 1; // something's going on, increment the counter
if(PB_cnt_max) PB_state <= ~PB_state; // if the counter is maxed out, PB changed!
end
used PB_State assuming it was at zero. I don't see any place else that it is initialized. I know that you can't generally rely on gates powering up to any defined value but here it seems we are assuming PB_State will be zero when the module is entered. Is this safe?