Forum Discussion
robert_g
New Contributor
4 years agoGated clock conversion and state machines
I'm having issues with gated clock conversion if there is state machine in gated clock tree. As soon as I remove fsm or select synthesis option to not infer state machines the gated clock conversion ...
ak6dn
Regular Contributor
4 years agoWhat do you mean by 'gated clock tree'?
I have run state machines at an effective lower frequency than the master clock by using an enable signal for the state machine.
Ie, something like this:
reg [3:0] count = 0; reg [3:0] state = 0; reg enable = 0; always @(posedge clk) begin count <= count+1; enable <= (count == 0); end always @(posedge clk) begin if (reset) state <= 0; else if (enable) begin case (state) 0: state <= 1; 1: state <= 2; ... default: state <= 0; end end
so that in this case the state machine triggers every 16 clocks based on the value in count.