我不知道怎么准确地描述它,但也许是这样的?
void monitor_thread(void)
{
for(;;){
if (data==10){
data=0;
data2++;
}
}
}对我来说,在VHDL中,我会意识到这一点:
signal data,data2:std_logic_vector(3 downto 0);
...
process(data)
begin
case data is:
when "0101" => data2<=data2+1;
when others =>
end case;
end process;但是在quartus II编译时会引起警告,我认为这不是正确的方法。有什么建议吗?
警告:
Warning (10492): VHDL Process Statement warning at xxx: signal "data2" is read inside the Process Statement but isn't in the Process Statement's sensitivity list
Warning (10631): VHDL Process Statement warning at xxx: inferring latch(es) for signal or variable "data", which holds its previous value in one or more paths through the process发布于 2016-04-04 07:20:54
让我们首先假设,data是在时钟clock的上升边缘更新的寄存器。然后,data每时钟周期只更改一次,因此,我们需要它与目标值进行比较,而且每个时钟周期也只有一次。这是通过另一个时钟进程来实现的,它将data2同步递增到clock。
process (clock)
begin
if rising_edge (clock) then
if data = x"0101" then
data2 <= data2 + 1; -- data2 of type unsigned, signed, or integer
end if;
end if;
end process;如果data是某些组合逻辑的输出,其中该组合逻辑的输入被clock锁定,那么data在时钟周期内可能会改变几次。但是,您实际上只能依赖已确定的值,因为中间值依赖于硬件中的实际延迟,因此不是确定性的。对于监视,您可以使用与上面相同的进程。
如果data依赖于某些异步输入,那么您必须首先使用公共时钟来同步这些输入。这样就可以应用上述的解决方案了。
https://stackoverflow.com/questions/34586265
复制相似问题