完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
大家好!
我写这段代码是为了知道输入'光子'在哪个时刻变高。 但它不起作用。 它指的是输出q,“选择不是恒定的”。 谁能帮我? 谢谢 实体oneclk_memory是 port(clk,photon:in STD_LOGIC; count:buffer integer; q:out STD_LOGIC_VECTOR(7 downto 0)); 结束oneclk_memory; 建筑行为oneclk_memory是 开始进程(clk)如果rising_edge(clk)则开始,然后if(count = 7)然后计数else 算结束如果; 如果photon ='1'则q'1',OTHERS =>'0'); 万一; 万一; 结束过程; 结束行为; 以上来自于谷歌翻译 以下为原文 Hi Everybody! I wrote this code in order to know in which moment the input 'photon' goes high. But it does not work. It says, referring to output q, that "Choice is not constant". Can anyone help me? Thank you entity oneclk_memory is port ( clk,photon: in STD_LOGIC; count: buffer integer; q: out STD_LOGIC_VECTOR(7 downto 0)); end oneclk_memory; architecture Behavioral of oneclk_memory is begin process(clk) begin if rising_edge(clk) then if (count = 7) then count <= 0; else count <= count + 1; end if; if photon = '1' then q <= (count =>'1', OTHERS => '0'); end if; end if; end process; end Behavioral; |
|
相关推荐
6个回答
|
|
嗨,
尝试使用hte将qour赋值替换为q以下两行: q'0'); Q(计数) 您的方法失败,因为列表中的选项必须在编译时是静态的(常量)。 我认为你的问题的原因是这样的: VHDL知道两种变体:globaly static和localy static constants。 第一个需要在编译时知道(就像你的情况一样) 而其他人将首先详细阐述,就像我的解决方案一样。 除了: 真的需要计数作为一个端口吗? 您可以将其定义为信号。 在模拟代码时,您可能会看到q中'1'的位置是预期值后面的一个位置。 要在count的实际值处分配“1”,可以将count定义为进程内的变量。 有一个很好的综合 Eilert 在原帖中查看解决方案 以上来自于谷歌翻译 以下为原文 Hi, try to replace qour assignment to q with hte following two lines: q <= (OTHERS => '0');q(count) <= '1'; Your approach fails because the the choices in the list have to be static (constant) at compile time. I think the reason for your problem is this: VHDL knows two variations: globaly static and localy static constants. The first ones need to be known at compile time (like in your case) while the others will be elaborated first, like in my solution. Besides: Is count really needed as a port? You could define it as a signal. When simulating the code you might see that the position of the '1' in q is one position behind the expected one. To get the '1' assigned at the very actual value of count you can define count as a variable inside the process. Have a nice synthesis Eilert View solution in original post |
|
|
|
重新格式化您生成的代码并使用代码插入按钮导致
实体oneclk_memory是 port(clk,photon:in STD_LOGIC; count:缓冲整数; q:输出STD_LOGIC_VECTOR(7 downto 0)); 结束oneclk_memory; 建筑行为oneclk_memory是 开始 过程(CLK) 开始 如果rising_edge(clk)那么 if(count = 7)然后 count'1',OTHERS =>'0'); 万一; 万一; 结束过程; 结束行为 你究竟想在“q”赋值语句中实现什么? ------您是否尝试在Google中输入问题? 如果没有,你应该在发布之前。太多结果? 尝试添加网站:www.xilinx.com 以上来自于谷歌翻译 以下为原文 Reformating the code that you produced and using the code insertion button results in entity oneclk_memory is port ( clk,photon: in STD_LOGIC; count : buffer integer; q : out STD_LOGIC_VECTOR(7 downto 0) );end oneclk_memory;architecture Behavioral of oneclk_memory i***eginprocess(clk)begin if rising_edge(clk) then if (count = 7) then count <= 0; else count <= count + 1; end if; if photon = '1' then q <= (count =>'1', OTHERS => '0'); end if; end if;end process;end Behavioral What exactly are you trying to achieve in the "q" assignment statement? ------Have you tried typing your question into Google? If not you should before posting. Too many results? Try adding site:www.xilinx.com |
|
|
|
...为什么用端口类型缓冲区声明count?
----------------------------是的,我这样做是为了谋生。 以上来自于谷歌翻译 以下为原文 ... and why is count declared with port type buffer? ----------------------------Yes, I do this for a living. |
|
|
|
因为代码读取和写入都计数。
恕我直言,在设计中不应该避免缓冲类型。 ------您是否尝试在Google中输入问题? 如果没有,你应该在发布之前。太多结果? 尝试添加网站:www.xilinx.com 以上来自于谷歌翻译 以下为原文 Because the code both reads and writes to count. IMHO, the buffer type should not be avoided in designs.------Have you tried typing your question into Google? If not you should before posting. Too many results? Try adding site:www.xilinx.com |
|
|
|
嗨,
尝试使用hte将qour赋值替换为q以下两行: q'0'); Q(计数) 您的方法失败,因为列表中的选项必须在编译时是静态的(常量)。 我认为你的问题的原因是这样的: VHDL知道两种变体:globaly static和localy static constants。 第一个需要在编译时知道(就像你的情况一样) 而其他人将首先详细阐述,就像我的解决方案一样。 除了: 真的需要计数作为一个端口吗? 您可以将其定义为信号。 在模拟代码时,您可能会看到q中'1'的位置是预期值后面的一个位置。 要在count的实际值处分配“1”,可以将count定义为进程内的变量。 有一个很好的综合 Eilert 以上来自于谷歌翻译 以下为原文 Hi, try to replace qour assignment to q with hte following two lines: q <= (OTHERS => '0');q(count) <= '1'; Your approach fails because the the choices in the list have to be static (constant) at compile time. I think the reason for your problem is this: VHDL knows two variations: globaly static and localy static constants. The first ones need to be known at compile time (like in your case) while the others will be elaborated first, like in my solution. Besides: Is count really needed as a port? You could define it as a signal. When simulating the code you might see that the position of the '1' in q is one position behind the expected one. To get the '1' assigned at the very actual value of count you can define count as a variable inside the process. Have a nice synthesis Eilert |
|
|
|
非常感谢,即使是关于模拟行为的解释!
以上来自于谷歌翻译 以下为原文 Thank you VERY MUCH, even for the explanation about the simulation behavior!!! |
|
|
|
只有小组成员才能发言,加入小组>>
2429 浏览 7 评论
2830 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2298 浏览 9 评论
3378 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
2468 浏览 15 评论
有输入,但是LVDS_25的FPGA内部接收不到数据,为什么?
1288浏览 1评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
592浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
455浏览 1评论
2010浏览 0评论
736浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 01:02 , Processed in 1.382907 second(s), Total 91, Slave 74 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号