如何理解(clk'event and clk='1')
how to understand (clk'event and clk='1')
由于(clk'event and clk='1')常用来描述clk信号的上升沿事件,我有如下疑问:
(1)如何理解"and"?这是否意味着 "then"?
(2) (clk='1' and clk'event) 怎么样?是不是和上面一样?
谢谢!
"and" 表示逻辑 "and",如 "both of these things should be true for the expression to return true".
是的,这在逻辑上是等价的。
话虽如此,在这种情况下你应该使用的是rising_edge
函数,例如if (rising_edge(clk)) then
。此函数和附带的 falling_edge
函数在更多情况下可以正常工作,并且更具可读性。
由于(clk'event and clk='1')常用来描述clk信号的上升沿事件,我有如下疑问:
(1)如何理解"and"?这是否意味着 "then"?
(2) (clk='1' and clk'event) 怎么样?是不是和上面一样?
谢谢!
"and" 表示逻辑 "and",如 "both of these things should be true for the expression to return true".
是的,这在逻辑上是等价的。
话虽如此,在这种情况下你应该使用的是rising_edge
函数,例如if (rising_edge(clk)) then
。此函数和附带的 falling_edge
函数在更多情况下可以正常工作,并且更具可读性。