01-02-2020 03:38 PM
Hello. I try to create a circuit that toggles between one and zero every time a press a push button. I synchronize the input with a slow running clock (slow_clk in the schematic) which runs at 1 Hz. On the left side you see the output of a clock divider (uses a counter and a BUFGCE). I used it because another post recommended to use BUFGCE buffers for clock division. It divides a 5 Mhz clock by 5 Million produce a one Hz output. It works: I output the clock on a led pin on my evaluation board (basys 3) and see the led blinking at a rate of one Hertz.
But I'm able to toggle between 1 and 0 on the complete high phase of slow_clk. I expected the circuit to only toggle the value of the tmp_reg (dout) on the rising edge of slow_clk. Because these flip-flops should be edge triggered. This behaviour only occurs if I use a BUFGCE. If I just use toggle register instead of a BUFGCE the circuit behaves like expected. (Toggles only on rising edge and have a delay of 2 clocks). This circuit toggles everytime the clock is high (without any delay) Do you have any idea why this happens?
01-03-2020 02:28 PM
Does it work in simulation?
Can you share the rtl code you use to do this?
01-05-2020 05:41 AM