完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
我一直在试验如何在Vivado中“解释”简单计数器上的异步与同步复位。
这是我的(10位)计数器模板: 图书馆IEEE; 使用IEEE.STD_LOGIC_1164.ALL; 使用IEEE.NUMERIC_STD.ALL; 实体counter_universal是 港口 ( 时钟:STD_LOGIC; reset:在STD_LOGIC中; clear_count:在STD_LOGIC中; enable:在STD_LOGIC中; counter_out:输出STD_LOGIC_VECTOR(9 downto 0) ); end counter_universal; 建筑反行为的行为是 signal s_count:unsigned(9 downto 0); - :=(其他=>'0'); 开始 过程(时钟,重置) 开始 如果reset ='1'则 - async reset - >将'reset'置于灵敏度列表中 s_count'0'); elsif rising_edge(时钟)然后 如果clear_count ='1'则 - (synchr)清除计数优先于启用 s_count'0'); elsif enable ='1'然后 S_COUNT 所以,如果我是正确的,复位在这里是异步的(因此必须在灵敏度列表中),而clear是异步的。 如果我打开精心设计的原理图,则确认 - 请参见第一个附件:复位线进入FF的'RST'输入,如果我是正确的则是异步输入。 'clear'行最终通过'D'输入上的逻辑结束,因此它被同步解释为清晰。 但是我尝试了一个略有不同版本的计数器过程: - 同步'重置'和'清除' 处理(时钟) 开始 如果rising_edge(时钟)那么 if(reset ='1')或(clear_count ='1')然后 s_count'0'); elsif enable ='1'然后 S_COUNT 所以现在我希望'reset'和'clear_count'都是同步输入。 一世 然而,当我打开详细的原理图 - 参见附件2时,现在'reset'和'clear'都连接到DFF的async'RST'引脚...... 我无法解释为什么......这是因为每个FF至少需要一个异步复位,而且由于我没有指定它,Vivado会使它异步,虽然它在过程中被描述为同步? 注意:必须承认看起来我可以忍受1次重置,我可以,但是我想连接(不是AXIRESETN)到'重置','clear'输入将来自其他模块/信号,到 保持清醒。 **如果答案是有帮助的话,那就是kudo。 如果您的问题得到解答,请接受解决方案 以上来自于谷歌翻译 以下为原文 I've been experimenting on how a asynchronous vs synchronous reset on a simple counter is 'interpreted' in Vivado. Here's my (10 bit) counter template : library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.NUMERIC_STD.ALL;entity counter_universal isport ( clock : in STD_LOGIC; reset : in STD_LOGIC; clear_count : in STD_LOGIC; enable : in STD_LOGIC; counter_out : out STD_LOGIC_VECTOR (9 downto 0));end counter_universal;architecture Behavioral of counter_universal is signal s_count : unsigned(9 downto 0); -- := (others => '0'); begin process(clock, reset) begin if reset = '1' then -- async reset -> put 'reset in sensitivity list s_count <= (others => '0'); elsif rising_edge(clock) then if clear_count = '1' then -- (synchr) clear count takes precedence over enable s_count <= (others => '0'); elsif enable = '1' then s_count <= s_count + 1; end if; end if; end process; -- connect internal signal to output counter_out <= std_logic_vector(s_count);end Behavioral;so if I'm correct, reset is asynchronous here (and hence must be in the sensitivity list), and clear is asynchronous. If I open the elaborated schematic, this is confirmed - see first attachment : the reset line goes to the FF's 'RST' input, which if I'm correct is the asynchronous input. The 'clear' line finally ends up through logic on the 'D' input, hence it's syncronously interpreted as a clear. however I experimented with a slightly different version of the counter process : -- sync 'reset' and 'clear' process(clock) begin if rising_edge(clock) then if (reset = '1') or (clear_count = '1') then s_count <= (others => '0'); elsif enable = '1' then s_count <= s_count + 1; end if; end if; end process;so now I would expect both 'reset' and 'clear_count' would be synchronous inputs. I However when I open the elaborated schematic - see attachment 2 , now both 'reset' and 'clear' are connected to the async 'RST' pin of the DFF ... I cannot explain why .. is this because at least an async reset is needed for each FF, and since I'm not specifying it, Vivado makes it async, although it's described as synchronous in the process? note : must admit it looks like I could live with 1 reset, and I could, however I'd like to connect (not AXIRESETN) to 'reset', and the 'clear' input would come from some other module/signal, to keep things clear. ** kudo if the answer was helpfull. Accept as solution if your question is answered ** |
|
相关推荐
16个回答
|
|
我认为你需要注意推断的翻牌类型。
在第一张图片中,您有一个“rtl_reg_async”,在第二张图片中有“rtl_reg_sync”,这正是您对所发布代码的期望。 - 如果提供的信息有用,请将答案标记为“接受为解决方案”。给予您认为有用且回复的帖子。 在原帖中查看解决方案 以上来自于谷歌翻译 以下为原文 I think you need to pay attention to the type of the flops inferred. In the first picture you have a "rtl_reg_async" and in the second one "rtl_reg_sync" which is exactly what one expects from the code you posted. - Please mark the Answer as "Accept as solution" if information provided is helpful. Give Kudos to a post which you think is helpful and reply oriented.View solution in original post |
|
|
|
查看此博客http://www.eetimes.com/document.asp?doc_id=1278998
谢谢和RegardsBalkrishan ----------------------------------------------- ---------------------------------------------请将帖子标记为 一个答案“接受为解决方案”,以防它有助于解决您的查询。如果一个帖子引导到解决方案,请给予赞誉。 以上来自于谷歌翻译 以下为原文 check this blog http://www.eetimes.com/document.asp?doc_id=1278998Thanks and Regards Balkrishan -------------------------------------------------------------------------------------------- Please mark the post as an answer "Accept as solution" in case it helped resolve your query. Give kudos in case a post in case it guided to the solution. |
|
|
|
我认为你需要注意推断的翻牌类型。
在第一张图片中,您有一个“rtl_reg_async”,在第二张图片中有“rtl_reg_sync”,这正是您对所发布代码的期望。 - 如果提供的信息有用,请将答案标记为“接受为解决方案”。给予您认为有用且回复的帖子。 以上来自于谷歌翻译 以下为原文 I think you need to pay attention to the type of the flops inferred. In the first picture you have a "rtl_reg_async" and in the second one "rtl_reg_sync" which is exactly what one expects from the code you posted. - Please mark the Answer as "Accept as solution" if information provided is helpful. Give Kudos to a post which you think is helpful and reply oriented. |
|
|
|
谢谢@ muzaffer,这很酷......我从未见过那个'细节'......我一直盯着图表:-)
我想给3个工作人员:-) 是否优先考虑在Zynq设备中编码异步或同步复位? 我的hdl代码大部分时间是自定义AXI IP的一部分,所以输入复位是AXI_ARESETN - 我从处理器复位块得到 - 所以如果我是正确的,这个信号本质上是同步的。 因此,如果我的计数器进程将重置定义为同步或异步,则可能无关紧要? **如果答案是有帮助的话,那就是kudo。 如果您的问题得到解答,请接受解决方案 以上来自于谷歌翻译 以下为原文 thanks @muzaffer, that's cool ... I never saw that 'detail' ... I've been staring a long time at the diagram :-) I'd like to give 3 kudo's for that :-) is it a matter of preference to code async or sync resets in Zynq devices? My hdl code is most of the time part of a custom AXI IP, so the incoming reset is AXI_ARESETN - which I derive from a processor reset block - so if I'm correct this signal is inherently synchronous. So it probably doesn't matter if my counter process defines the reset to be sync or async? ** kudo if the answer was helpfull. Accept as solution if your question is answered ** |
|
|
|
检查FDCE和FDRE翻牌细节。
触发器的类型决定了电路是同步还是同步。 请查看详细信息http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_1/7series_scm.pdf 谢谢和RegardsBalkrishan ----------------------------------------------- ---------------------------------------------请将帖子标记为 一个答案“接受为解决方案”,以防它有助于解决您的查询。如果一个帖子引导到解决方案,请给予赞誉。 以上来自于谷歌翻译 以下为原文 check the FDCE and FDRE flop details . The type of flop decides the circuit whether async or sync . Check details here http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_1/7series_scm.pdfThanks and Regards Balkrishan -------------------------------------------------------------------------------------------- Please mark the post as an answer "Accept as solution" in case it helped resolve your query. Give kudos in case a post in case it guided to the solution. |
|
|
|
嗨@ ronnywebers,
您也可以浏览语言模板。 谢谢,Arpan ----------------------------------------------- - - - - - - - - - - - - - - - - - - - - - - - -请注意- 如果提供的信息有用,请将答案标记为“接受为解决方案”。给予您认为有用且回复的帖子。感谢Kudos .-------------------- -------------------------------------------------- ------------------------ 以上来自于谷歌翻译 以下为原文 Hi @ronnywebers, You can go through language templates also. Thanks, Arpan ---------------------------------------------------------------------------------------------- Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful. Give Kudos to a post which you think is helpful and reply oriented. ---------------------------------------------------------------------------------------------- |
|
|
|
为了完整性,我也尝试了这个:
- 没有重置 处理(时钟) 开始 如果rising_edge(时钟)那么 如果enable ='1'那么 S_COUNT 在不重置的情况下推断RTL_REG **如果答案是有帮助的话,那就是kudo。 如果您的问题得到解答,请接受解决方案 以上来自于谷歌翻译 以下为原文 for completeness, I tried this too : -- no reset process(clock) begin if rising_edge(clock) then if enable = '1' then s_count <= s_count + 1; end if; end if; end process;that infers RTL_REG without a reset ** kudo if the answer was helpfull. Accept as solution if your question is answered ** |
|
|
|
然后我尝试了相同的过程,所以没有重置,但给信号默认值为“1010101010”。
signal s_count:unsigned(9 downto 0):=“1010101010”; 有趣的是,如果我在精心设计和合成的原理图中正确地看到它,那么与省略默认值不会产生任何不同。 问:我可以从中得出结论,给信号一个默认值对异步或同步设置/预设没有影响吗? 那么这个默认值的用途是什么呢? 我能看到的唯一区别是,使用默认值,我的模拟器现在立即显示计数器的“已知”输出值,甚至在它收到重置之前。 如果省略默认值,则在波形信号从橙色变为绿色之前需要复位。 **如果答案是有帮助的话,那就是kudo。 如果您的问题得到解答,请接受解决方案 以上来自于谷歌翻译 以下为原文 then I tried the same process, so without reset, but with giving the signal a default value of "1010101010". signal s_count : unsigned(9 downto 0) := "1010101010"; Interestingly enough, if I see it correcly in the elaborated and synthesized schematics, this doesn't produce anything different from omitting a default value. Q : can I conclude from this that giving a signal a default value has no impact on an async or sync set/preset? So what is the use of this default value then? The only difference I can see is that with a default value, my simulator now immediately shows a 'known' output value for the counter, even before it receives a reset. If I omit the default value, it needs a reset before the waveform signals turn from orange to green. ** kudo if the answer was helpfull. Accept as solution if your question is answered ** |
|
|
|
是的,这是真的,它不会影响异步和同步重置。
合成工具将绑定到gnd或vcco依赖于值或推断LUT来存储此值。 谢谢和RegardsBalkrishan ----------------------------------------------- ---------------------------------------------请将帖子标记为 一个答案“接受为解决方案”,以防它有助于解决您的查询。如果一个帖子引导到解决方案,请给予赞誉。 以上来自于谷歌翻译 以下为原文 yes thats true it will not impact async and sync reset . synthesis tool will just tied to gnd or vcco depends upon value or infer LUTs to store this value .Thanks and Regards Balkrishan -------------------------------------------------------------------------------------------- Please mark the post as an answer "Accept as solution" in case it helped resolve your query. Give kudos in case a post in case it guided to the solution. |
|
|
|
谢谢@balkris
好的 - 所以'默认值'确实以比特流的方式结束 - 在我读过的一些论坛帖子中它只用于模拟......所以这是完全错误的。 在模拟中,我可以看到省略默认值会显示橙色线,直到计数器收到复位 - 猜测是因为模拟器想要在开机后指示没有定义的信号? 但是在硬件中,如果省略默认值,这可能默认为“零”? 我只是试图得出结论,我应该让它成为一个习惯,让我的'寄存器信号'的默认值为(其他=>'0')或不。 **如果答案是有帮助的话,那就是kudo。 如果您的问题得到解答,请接受解决方案 以上来自于谷歌翻译 以下为原文 thanks @balkris ok - so the 'default value' does end up in the bitstream that way - in some forum posts I read it was only of use for simulation ... so that was plain wrong. In the simulation I can see that omitting a default value shows orange lines until the counter receives a reset - guess because the simulator wants to indicate on purpose that there's no defined signal after power-on? However in hardware this probably defaults to 'zero' when if a default value is omitted? I'm just trying to conclude wether I should make it a habbit to give my 'register signals' a default value of (others => '0') or not. ** kudo if the answer was helpfull. Accept as solution if your question is answered ** |
|
|
|
嗨@ ronnywebers,
默认情况下,对于FF,INIT值或初始值为“0”。 但是如果要分配一些初始值,则相应地更改这些INIT值。 即使你可以使用set_property INIT 1'b1 [get_cells]初始化翻牌值。 谢谢,Arpan ----------------------------------------------- - - - - - - - - - - - - - - - - - - - - - - - -请注意- 如果提供的信息有用,请将答案标记为“接受为解决方案”。给予您认为有用且回复的帖子。感谢Kudos .-------------------- -------------------------------------------------- ------------------------ 以上来自于谷歌翻译 以下为原文 Hi @ronnywebers, By default INIT values or initial values are taken as '0' for FFs. But if you are assigning some initial value then these INIT values are changed accordingly. Even you can use set_property INIT 1'b1 [get_cells Thanks, Arpan ---------------------------------------------------------------------------------------------- Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful. Give Kudos to a post which you think is helpful and reply oriented. ---------------------------------------------------------------------------------------------- |
|
|
|
所以'默认值'确实以比特流的方式结束
是。 信号的默认值将影响触发器的INIT值,这是FPGA配置完成后的值。 “reset”(同步或异步)是一个“用户”函数 - 当你断言这个信号时,触发器会取一个值。 信号的“初始化”是一个FPGA函数,它确定寄存器的值“一旦FPGA的配置完成”(对于这种情况发生时,有一个更正式和有些复杂的定义......)。 因此,在复位被置位之前,该值将在FF中(即使从未置位复位)。 有关重置和初始化值之间的区别,请参阅此文章。 Avrum 以上来自于谷歌翻译 以下为原文 so the 'default value' does end up in the bitstream that way Yes. The default value of a signal will affect the flip-flop's INIT value, which is the value it has after the configuration of the FPGA is complete. The "reset" (be it synchronous or asynchronous) is a "user" function - when you assert this signal, the flip-flop will take a value. The "initialization" of a signal is an FPGA function, it determines the value of the register "as soon as configuration of the FPGA is complete" (there is a more formal and somewhat complex definition of when this happens...). So, this value will be in the FF before the reset is asserted (and even if the reset is never asserted). See this post on the difference between resets and initialization values. Avrum |
|
|
|
快速说明一下。
在查看Elaborated Design(或RTL Analysis)时要小心。 这是设计的“通用威廉希尔官方网站 ”视图,而不是实际在FPGA中实现的视图 - 它仅仅是一种中间表示。 如果你真的想看看如何实现,你必须看看合成设计。 在合成设计中,使用的单元是存在于FPGA器件上的实际单元(与精心设计中的单元相对,实际上并不存在 - 没有RTL_REG_ASYNC这样的东西;实现时,这可能最终 作为FDPE或FDCE ...) Avrum 以上来自于谷歌翻译 以下为原文 Just a quick note. Be careful when looking at the Elaborated Design (or the RTL Analysis). This is a "generic technology" view of the design, and is not what actually gets implemented in the FPGA - it is merely an intermediate representation. If you really want to see how things are implemented you must look at the synthesized design. In the synthesized design, the cells used are actual cells that exist on the FPGA device (as opposed to the cells in the elaborated design, which don't actually exist - there is no such thing as RTL_REG_ASYNC; when implemented, this could end up as an FDPE or FDCE...) Avrum |
|
|
|
它取决于使用情况。
初始化仅在模拟期间使用。 这样就可以纠正默认值,如时间和物理值,仅用于模拟您在RTL中分配的值就像在硬件中一样,它将在硬件中 谢谢和RegardsBalkrishan ----------------------------------------------- ---------------------------------------------请将帖子标记为 一个答案“接受为解决方案”,以防它有助于解决您的查询。如果一个帖子引导到解决方案,请给予赞誉。 以上来自于谷歌翻译 以下为原文 Its depends upon usage. Initialization only uses during simulation . so thats correct the default value like time and physical value just for simulation The value which you are assign in RTL like constant it will in hardwareThanks and Regards Balkrishan -------------------------------------------------------------------------------------------- Please mark the post as an answer "Accept as solution" in case it helped resolve your query. Give kudos in case a post in case it guided to the solution. |
|
|
|
@balkrissorry我对你的上一个答案感到有点困惑:代码:
signal s_count:unsigned(9 downto 0):=“1010101010”; 对合成产生影响? 换句话说,例如,是否将常量“1010101010”置于某些LUT中,那么计数器会以此初始值“启动”? **如果答案是有帮助的话,那就是kudo。 如果您的问题得到解答,请接受解决方案 以上来自于谷歌翻译 以下为原文 @balkris sorry I'm a bit confused by your last answer : does the code : signal s_count : unsigned(9 downto 0) := "1010101010"; have an impact on synthesis? in other words, is the constant "1010101010" put in some LUT for example, so the counter 'boots up' with this initial value? ** kudo if the answer was helpfull. Accept as solution if your question is answered ** |
|
|
|
它不会存储在LUT中,它将连接到vcc和gnd
对不起 - 这是错误的(或至少非常令人困惑)...... @ronnywebers的原帖是专门讨论VHDL信号的初始化,最终成为触发器。 在这种情况下,这会影响触发器的INIT值,正如我在上一篇文章中所描述的那样。 @balkris描述了一种不同的情况,你将触发器的输入连接到一个常数,这可以(但并不总是)导致触发器被优化掉并被直接连接到逻辑1和逻辑 但这不是@ronnywebers所要求的...... Avrum 以上来自于谷歌翻译 以下为原文 it will not store in LUT it will connect to vcc and gnd I am sorry - this is just wrong (or at least very confusing)... The original post by @ronnywebers is specifically talking about the initialization of a VHDL signal which ultimately becomes a flip-flop. In which case, this affects the INIT value of the flip-flops as I described in my previous answer to this post. @balkris is describing a different situation, where you tie the inputs to a flip-flop to a constant, which can (but doesn't always) result in the flip-flop being optimized away and replaced with direct connections to logic 1 and logic 0. But this is not what @ronnywebers asked... Avrum |
|
|
|
只有小组成员才能发言,加入小组>>
2446 浏览 7 评论
2845 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2308 浏览 9 评论
3390 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
2485 浏览 15 评论
有输入,但是LVDS_25的FPGA内部接收不到数据,为什么?
1748浏览 1评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
621浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
483浏览 1评论
2036浏览 0评论
760浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-1-12 04:18 , Processed in 1.886861 second(s), Total 107, Slave 91 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号