完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在构建一个类似于ARINC 429的系统。
我的全局时钟工作频率为16 MHz,Rx和Tx时钟可在12.5 KHz和100 KHz之间选择。 我的问题是,我可以将16 MHz时钟转换为12.5 KHz或100 KHz时钟吗? 我做的是在Rx和Tx中创建一个新时钟: clk_process:进程开始的情况state_machine_clk是当clk_12_5 => if(rate ='1')然后state_machine_clk else null; 万一; clk1等待clk_period / 2; clk1等待clk_period / 2; 当clk_100 => if(rate ='0')时,state_machine_clk为null; 万一; clk1等待clk_period1 / 2; clk1等待clk_period1 / 2; 当其他=> null; 结束案例; 结束过程; 这样好吗? 事情是因为等待声明我无法测试它 HDLParsers:1015 - “C:/Study/state_machine/pts1.vhd”第87行。等待语句不受支持。 非常感谢。 以上来自于谷歌翻译 以下为原文 I'm building a system similar to ARINC 429. I have the global clock which work at 16 MHz, and Rx and Tx clocks which are selectable between 12.5 KHz and 100 KHz. My question is, can I take the 16 MHz clock and turn it into 12.5 KHz or 100 KHz clocks? What I did is to create a new clock inside Rx and Tx: clk_process :process begin case state_machine_clk is when clk_12_5 => if (rate = '1') then state_machine_clk <= clk_100; else null; end if; clk1 <= '0'; wait for clk_period/2; clk1 <= '1'; wait for clk_period/2; when clk_100 => if (rate = '0') then state_machine_clk <= clk_12_5; else null; end if; clk1 <= '0'; wait for clk_period1/2; clk1 <= '1'; wait for clk_period1/2; when others => null; end case; end process; Is that good? The thing is I can't test bench it because of the wait statement HDLParsers:1015 - "C:/Study/state_machine/pts1.vhd" Line 87. Wait for statement unsupported. Thanks a lot. |
|
相关推荐
3个回答
|
|
而不是使用3个时钟,尝试只使用一个时钟。
生成时钟使能匹配100KHz和12.5KHz的目标频率。 这极大地简化了您的设计,尤其是时序分析。 你知道如何使用时钟启用吗? 如果没有,这是一个学习的好时机。 以下是用于生成两个时钟使能的示例(Verilog)代码: reg [7:0] count100K = 0; // 8位计数器将16MHz除以100KHzreg [2:0] count12p5K = 0; // 3位计数器将100KHz除以12.5KHzreg Ena100K = 0; // 100KHz速率时钟使能,单周期pulsereg Ena12p5K = 0; // 12.5KHz速率时钟使能,单周期脉冲通道@(posedge Clk16M)if(count100K == 8'h9F)//将16M除以160d得到100K开始计数100K //复位/包装计数器Ena100K //单周期脉冲, 100K速率时钟使能count12p5K //计数100K速率脉冲,模8如果(count12p5K == 0)Ena12p5K //单周期脉冲,12.5K速率时钟使能结束//正常计数时钟分频器开始count100K //计数时钟周期 Ena100K //取消断言100K速率时钟使能Ena12p5K //取消断言12.5K速率时钟使能结束 这有意义吗? - 鲍勃埃尔金德 签名:新手的自述文件在这里:http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369总结:1。 阅读手册或用户指南。 你读过手册了吗? 你能找到手册吗?2。 搜索论坛(并搜索网页)以寻找类似的主题。 不要在多个论坛上发布相同的问题。 不要在别人的主题上发布新主题或问题,开始新的主题!5。 学生:复制代码与学习设计不同.6“它不起作用”不是一个可以回答的问题。 提供有用的详细信息(请与网页,数据表链接).7。 您的代码中的评论不需要支付额外费用。 我没有支付论坛帖子的费用。 如果我写一篇好文章,那么我一无所获。 在原帖中查看解决方案 以上来自于谷歌翻译 以下为原文 Instead of working with 3 clocks, try working with just one clock. Generate clock enables to match the target frequencies of 100KHz and 12.5KHz. This greatly simplifies your design, especially timing analysis. Do you know how to use clock enables? If not, this is a good time to learn. Here is example (Verilog) code for generating the two clock enables: reg [7:0] count100K = 0; // 8-bit counter to divide 16MHz to 100KHz reg [2:0] count12p5K = 0; // 3-bit counter to divide 100KHz to 12.5KHz reg Ena100K=0; // 100KHz rate clock enable, single cycle pulse reg Ena12p5K=0; // 12.5KHz rate clock enable, single cycle pulse always @(posedge Clk16M) if (count100K == 8'h9F) // divide 16M by 160d to get 100K begin count100K <= 0; // reset/wrap the counter Ena100K <= 1; // single cycle pulse, 100K rate clock enable count12p5K <= count12p5K + 1; // count 100K rate pulses, modulo 8 if (count12p5K == 0) Ena12p5K <= 1; // single cycle pulse, 12.5K rate clock enable end else //normal counting of the clock divider begin count100K <= count100K + 1; // count clock cycles Ena100K <= 0; // de-assert 100K rate clock enable Ena12p5K <= 0; // de-assert 12.5K rate clock enable end Does this make sense? -- Bob Elkind SIGNATURE: README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369 Summary: 1. Read the manual or user guide. Have you read the manual? Can you find the manual? 2. Search the forums (and search the web) for similar topics. 3. Do not post the same question on multiple forums. 4. Do not post a new topic or question on someone else's thread, start a new thread! 5. Students: Copying code is not the same as learning to design. 6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please). 7. You are not charged extra fees for comments in your code. 8. I am not paid for forum posts. If I write a good post, then I have been good for nothing.View solution in original post |
|
|
|
而不是使用3个时钟,尝试只使用一个时钟。
生成时钟使能匹配100KHz和12.5KHz的目标频率。 这极大地简化了您的设计,尤其是时序分析。 你知道如何使用时钟启用吗? 如果没有,这是一个学习的好时机。 以下是用于生成两个时钟使能的示例(Verilog)代码: reg [7:0] count100K = 0; // 8位计数器将16MHz除以100KHzreg [2:0] count12p5K = 0; // 3位计数器将100KHz除以12.5KHzreg Ena100K = 0; // 100KHz速率时钟使能,单周期pulsereg Ena12p5K = 0; // 12.5KHz速率时钟使能,单周期脉冲通道@(posedge Clk16M)if(count100K == 8'h9F)//将16M除以160d得到100K开始计数100K //复位/包装计数器Ena100K //单周期脉冲, 100K速率时钟使能count12p5K //计数100K速率脉冲,模8如果(count12p5K == 0)Ena12p5K //单周期脉冲,12.5K速率时钟使能结束//正常计数时钟分频器开始count100K //计数时钟周期 Ena100K //取消断言100K速率时钟使能Ena12p5K //取消断言12.5K速率时钟使能结束 这有意义吗? - 鲍勃埃尔金德 签名:新手的自述文件在这里:http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369总结:1。 阅读手册或用户指南。 你读过手册了吗? 你能找到手册吗?2。 搜索论坛(并搜索网页)以寻找类似的主题。 不要在多个论坛上发布相同的问题。 不要在别人的主题上发布新主题或问题,开始新的主题!5。 学生:复制代码与学习设计不同.6“它不起作用”不是一个可以回答的问题。 提供有用的详细信息(请与网页,数据表链接).7。 您的代码中的评论不需要支付额外费用。 我没有支付论坛帖子的费用。 如果我写一篇好文章,那么我一无所获。 以上来自于谷歌翻译 以下为原文 Instead of working with 3 clocks, try working with just one clock. Generate clock enables to match the target frequencies of 100KHz and 12.5KHz. This greatly simplifies your design, especially timing analysis. Do you know how to use clock enables? If not, this is a good time to learn. Here is example (Verilog) code for generating the two clock enables: reg [7:0] count100K = 0; // 8-bit counter to divide 16MHz to 100KHz reg [2:0] count12p5K = 0; // 3-bit counter to divide 100KHz to 12.5KHz reg Ena100K=0; // 100KHz rate clock enable, single cycle pulse reg Ena12p5K=0; // 12.5KHz rate clock enable, single cycle pulse always @(posedge Clk16M) if (count100K == 8'h9F) // divide 16M by 160d to get 100K begin count100K <= 0; // reset/wrap the counter Ena100K <= 1; // single cycle pulse, 100K rate clock enable count12p5K <= count12p5K + 1; // count 100K rate pulses, modulo 8 if (count12p5K == 0) Ena12p5K <= 1; // single cycle pulse, 12.5K rate clock enable end else //normal counting of the clock divider begin count100K <= count100K + 1; // count clock cycles Ena100K <= 0; // de-assert 100K rate clock enable Ena12p5K <= 0; // de-assert 12.5K rate clock enable end Does this make sense? -- Bob Elkind SIGNATURE: README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369 Summary: 1. Read the manual or user guide. Have you read the manual? Can you find the manual? 2. Search the forums (and search the web) for similar topics. 3. Do not post the same question on multiple forums. 4. Do not post a new topic or question on someone else's thread, start a new thread! 5. Students: Copying code is not the same as learning to design. 6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please). 7. You are not charged extra fees for comments in your code. 8. I am not paid for forum posts. If I write a good post, then I have been good for nothing. |
|
|
|
听鲍勃!
考虑为什么你的代码片段不起作用也很好。 它可以模拟,但在硬件中你不能做'等待x ns',因为硬件没有任何时间概念(除非你的芯片包含校准的延迟线,或什么)。 您可以做的最好的事情是有一个外部参考时钟(例如您的16 MHz时钟)并计算等待的周期数。 在测试平台中,您当然可以等待clk_period / 2,但在可合成代码中,您将执行以下操作: clk_process:process(clk_16mhz) 开始 if(rising_edge(clk_16mhz))然后 做 以上来自于谷歌翻译 以下为原文 Listen to Bob! It's also good to consider why your code snippet doesn't work. It may simulate, but in hardware you can't do a 'wait for x ns' because the hardware doesn't have any concept of time (unless your chip incorporates calibrated delay lines, or something). The best you can do is have an external reference clock (e.g. your 16 MHz clock) and calculate how many cycles to wait for. In a test bench you can certainly wait for clk_period/2, but in synthesisable code you would do the following: clk_process: process (clk_16mhz)begin if(rising_edge(clk_16mhz)) then do <= something; end if;end process; |
|
|
|
只有小组成员才能发言,加入小组>>
2429 浏览 7 评论
2831 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2298 浏览 9 评论
3378 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
2468 浏览 15 评论
有输入,但是LVDS_25的FPGA内部接收不到数据,为什么?
1334浏览 1评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
595浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
457浏览 1评论
2012浏览 0评论
737浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-28 10:44 , Processed in 1.437677 second(s), Total 80, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号