用VHDL设计的任意频率分频器
Sometimes I need to generate a clock at a lower frequency than the main clock driving the FPGA. If the ratio of the frequencies is a power of 2, the logic is easy. If the ratio is an integer N, then a divide-by-N counter is only a little harder. But if the ratio isn"t an integer, a little (and I mean a little) math is required. Note that the new clock will have lots of jitter: there"s no escaping that. But it will have no drift, and for some applications that"s what counts. If you have a clock A at frequency a, and want to make a clock B at some lower frequency b (that is, b a), then something like: d = 0; forever { Wait for clock A. if (d 1) { d += (b/a); } else { d += (b/a) - 1; /* getting here means tick for clock B */ } } but comparison against zero is easier, so subtract 1 from d: d = 0; forever { Wait for clock A. if (d 0) { d += (b/a); } else { d += (b/a) - 1; /* getting here means tick for clock B */ } } want an integer representation, so multiply everything by a: d = 0; forever { Wait for clock A. if (d 0) { d += b; } else { d += b - a; /* getting here means tick for clock B */ } } For example. I just bought a bargain batch of 14.1523MHz oscillators from BG but I need to generate a 24Hz clock. So a=14152300 and b=24: d = 0; forever { Wait for clock A. if (d 0) { d += 24; } else { d += 24 - 14152300; /* getting here means tick for clock B */ } } For a hardware implementation I need to know how many bits are needed for d: here it"s 24 bits to hold the largest value (-14152300) plus one more bit for the sign. In VHDL this looks like: signal d, dInc, dN : std_logic_vector(24 downto 0); process (d) begin if (d(24) = "1") then dInc = 0000000000000000000011000; -- (24) else dInc = 1001010000000110110101100; -- (24 - 14152300) end if; end process; dN = d + dInc; process begin wait until A"event and A = "1"; d = dN; -- clock B tick whenever d(24) is zero end process;
关键词: VHDL任意频率分频器
您可能也感兴趣:
为您推荐
厦门开展银行保险业消保教育宣传周活动 促进行业数字化创新
友邦保险去年业绩亮眼 新业务价值上升18%至33.66亿美元
陕西省将加大财政投入力度 推动农业保险持续“扩面”
排行
最近更新
- 用VHDL设计的任意频率分频器
- 光纤光缆及其器件基础概括
- ICE将从指数中删除所有俄罗斯和白俄罗斯债券
- 隐性债务监管高压态势不变 强调防范“处置风险的风险”
- 数据:交易所以太坊流出量达到2022年峰值
- “国潮”风暴下,李宁营收首破两百亿
- 你家肖战代言这一年,李宁猛赚40亿,一双袜子要卖110元
- 哪些肢体接触算超出暧昧
- 互联网医院线上义诊
- 4月1日起 昆明将门诊费用纳入职工医保统筹基金支
- 事发石家庄!36岁男子不胖也不常喝酒,却查出脂肪肝!咋回事?
- 教授病危,百名师生涌向献血车!后续来了……
- 肿瘤患者吃膏方需要注意些什么?
- 良之隆·2022第十届中国食材电商节6月8日-10日复展通知
- 一份凉皮相当于几碗米饭
- 凉面和凉皮的热量哪个低
- 凉皮和凉面哪个容易胖
- 接触性出血是什么原因造成的
- 开滦总医院肝胆外科团队29小时内连做4台腹腔镜下胰十二指肠切除术
- 3月18日上海各区确诊病例、无症状感染者居住地信息公布
- 中国睡眠研究报告:仅35%国人睡够8小时
- 中山大学附属口腔医院许跃“触网”科普,守护口腔健康
- 力量训练或许比跑步更有助睡眠
- 修手机、办卡的时候,您可得长个心眼儿
- 直播吸粉无底线,线下公安局里见!
- 公安机关严厉打击偷拍偷窥黑色产业链条
- 网安女警的下班业余
- 言归“证”传,上“警快办” | 驾驶证业务办理看过来
- 反诈小课堂 | 在吗?我出事了,要借钱!
- 我为群众办实事 | 善意会接力!被民警帮助过的人再次找到了...