用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任意频率分频器
您可能也感兴趣:
为您推荐
一季度社保基金新进14只个股 养老金账户新进9只个股
一季度广东保险业总资产增长9.99% 面向服务业加大风险保障力度
丹东发布工伤保险费率调整方案 将惠及1万多户参保单位
排行
最近更新
- 用VHDL设计的任意频率分频器
- 光纤光缆及其器件基础概括
- 去医院就诊该如何描述自己的病情 要注意这四个方面
- 总脸红心跳可能是得了甲亢 患者该如何治疗
- 重庆市婚姻家庭社会工作“家和计划”项目开展“你好,情绪”...
- 组织进行淫秽表演直播?小伙子你摊上事儿了
- 裸聊1分钟,信息全泄露!
- 说说网站域名那些事儿
- 软件工程师海外进修变“软禁”
- 晚起床不如早睡觉 睡眠质量不好将会影响血糖
- “利润这么高?那我也试试!”
- 同城美女相邀私密约会,你能把持的住吗?
- 山泉汩汩
- 思鸿网校教资面试结构化问答,人际关系篇
- 【家庭账单里的重庆】——小账本起大作用 儿子变得“精打细算”
- 上海发挥互联网医院的作用 向市民提供在线复诊等便民服务
- 一季度武汉固定资产投资增长20% 工业经济新动能效应明显
- 省外“破圈”不易 今世缘屡次提价营收仍未达标
- 真环保还是真赚钱?苹果不送充电器血赚400多亿
- 特斯拉第二工厂太抢手!9城竞夺尘埃未定,珠海称:正洽谈
- 可口可乐Q1营收利润均超预期 疫情和通胀是两大挑战
- 割韭菜能管用?快狗打车四年巨亏28亿,司机转投货拉拉
- 杭州2022年首批集中成交额超820亿 本土房企表现强劲
- 子公司“失控”,科华生物或被实施退市风险警示
- 喜姐炸串再获千万融资,开业门店数存疑、加盟食安难控
- 央行下调外汇存款准备金率,人民币贬值降温
- 中信银行广州分行原行长谢宏儒违规收受礼品、礼金被通报
- 天价慈善活动时隔两年回归:谁将与巴菲特共进最后一次午餐
- 离岸人民币汇率跌破6.6关口,央行再度出手,影响几何
- 浙商银行一季度总资产规模同比增速超20%,资本充足率下滑