0

我想创建一组具有不同周期和执行时间的周期性任务,在verilog模块中,该任务将创建,因此将执行某种操作并应在特定周期后执行......

所以,在像c这样的高级语言中

func()
{
for(;;)
}
and sleep()

我想,我会使用那个 func() 作为操作,并且在 sleep() 之后......这个 func() 应该再次被调用......这是在 verilog 中这样做的正确方法吗?并且我还可以测量测试台中的执行时间和周期吗...在模拟之后..任何建议都会非常有帮助

问候

4

1 回答 1

1

就像是...

`timescale 1ns/1ns
always begin
  // do stuff
  # amount of nanoseconds to wait until next execution
end

例如:此周期性任务counter每 1.5 微秒递增一次变量。

`timescale 1ns/1ns
integer counter = 0;
always begin
  counter = counter + 1;
  #1500;
end

`timescale如果您不需要纳秒精度,请使用不同的单位。例如,前一个块可以写成这样:

`timescale 1us/1ns
integer counter = 0;
always begin
  counter = counter + 1;
  #1.5;
end

编辑

重要的是要明确,用 表示的模拟延迟#{insert_delay}不能合成。它们只能在测试台上用于模拟来自驱动程序的延迟。因此,您的func()并且sleep()不在测试台中,它们将需要建模为某种计数器,然后重置然后计算x时钟脉冲的数量。

于 2013-12-28T14:08:23.107 回答