Making a clock divider

后端 未结 2 1287
说谎
说谎 2021-01-23 09:27

I found this code in how to make a clock divider. I have a general understanding on how to make a divider using counters but i not sure what this code is doing and why its doing

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-23 10:17

    50MHz/48Hz = 104166.7, so you can't get there exactly.

    If you use a counter which counts up to 104167 at 50MHz, you'll get a single pulse at close to 48 Hz (47.9999846 Hz - which is probably good enough for most purposes).

    Don't use the output of the counter as a clock, use a single pulse when it wraps around as a clock enable - you get much better results that way. A single clock throughout the design with enabled sections is the way to do it.

提交回复
热议问题