process(a, b) is
begin
if a'transaction'event then
report "Transaction on a";
end if;
if b'transaction'event then
report "Transaction on b";
end if;
end process;
您还可以使用 not <signal name>'quiet(0 ns) 确定自上一个时间步骤以来灵敏度列表中的哪些信号发生了事务:
process(a, b) is
begin
if not a'quiet(0 ns) then
report "Transaction on a";
end if;
if not b'quiet(0 ns) then
report "Transaction on b";
end if;
end process;
alfa: process (a, b) is
begin
report "Process alfa was resumed";
if a'event then
report "- Event on a";
end if;
if b'event then
report "- Event on b";
end if;
end process;
bravo: process (a'transaction, b'transaction) is
begin
report "Process bravo was resumed";
if a'active then
report "- Transaction on a";
end if;
if a'event then
report "- Event on a";
end if;
if b'active then
report "- Transaction on b";
end if;
if b'event then
report "- Event on b";
end if;
end process;
行为可以通过测试平台过程显示,产生刺激:
process is
begin
a <= 0; -- Declared as natural
b <= 0; -- --||--
wait for 1 ns;
a <= 1; -- Both transaction and event @ 1 ns 1 delta
wait for 0 sec; -- Delta delay
a <= 1; -- Only transaction, but no event @ 1 ns 2 delta
wait for 0 sec; -- Delta delay
b <= 2; -- Both transaction and event @ 1 ns 3 delta
wait for 0 sec; -- Delta delay
a <= 3; -- Both transaction and event @ 1 ns 4 delta
b <= 3; -- Both transaction and event @ 1 ns 4 delta
wait for 1 ns;
wait;
end process;
这将驱动信号,如下所示 . 请注意,ModelSims“Expanded Time Deltas Mode”已用于显示增量周期期间的信号变化:
来自进程alfa的报告输出(初始运行0 ps除外)是:
Time: 1 ns Iteration: 1 Instance: /tb # ** Note: Process alfa was resumed
Time: 1 ns Iteration: 1 Instance: /tb # ** Note: - Event on a
Time: 1 ns Iteration: 3 Instance: /tb # ** Note: Process alfa was resumed
Time: 1 ns Iteration: 3 Instance: /tb # ** Note: - Event on b
Time: 1 ns Iteration: 4 Instance: /tb # ** Note: Process alfa was resumed
Time: 1 ns Iteration: 4 Instance: /tb # ** Note: - Event on a
Time: 1 ns Iteration: 4 Instance: /tb # ** Note: - Event on b
进程bravo的报告输出(初始运行0 ps除外)是:
Time: 1 ns Iteration: 1 Instance: /tb # ** Note: Process bravo was resumed
Time: 1 ns Iteration: 1 Instance: /tb # ** Note: - Transaction on a
Time: 1 ns Iteration: 1 Instance: /tb # ** Note: - Event on a
Time: 1 ns Iteration: 2 Instance: /tb # ** Note: Process bravo was resumed
Time: 1 ns Iteration: 2 Instance: /tb # ** Note: - Transaction on a
Time: 1 ns Iteration: 3 Instance: /tb # ** Note: Process bravo was resumed
Time: 1 ns Iteration: 3 Instance: /tb # ** Note: - Transaction on b
Time: 1 ns Iteration: 3 Instance: /tb # ** Note: - Event on b
Time: 1 ns Iteration: 4 Instance: /tb # ** Note: Process bravo was resumed
Time: 1 ns Iteration: 4 Instance: /tb # ** Note: - Transaction on a
Time: 1 ns Iteration: 4 Instance: /tb # ** Note: - Event on a
Time: 1 ns Iteration: 4 Instance: /tb # ** Note: - Transaction on b
Time: 1 ns Iteration: 4 Instance: /tb # ** Note: - Event on b
3 回答
您可以将
'transaction
属性与'event
结合使用,以确定哪些信号在当前增量周期中有事务:'transaction
属性创建一个bit类型的新信号,用于切换每个事务 . 该信号上的'event
属性标识父信号上发生任何事务的时间 .您还可以使用
not <signal name>'quiet(0 ns)
确定自上一个时间步骤以来灵敏度列表中的哪些信号发生了事务:如果您不想处理在不同delta周期发生的事件的排序,后者可能会更有用 .
这里有两个VHDL概念:
Transaction :在模拟周期(时间和增量周期)为信号赋值
Event :导致信号值发生变化的事务(赋值)
因此,在每次分配给该信号时,信号上都会发生事务,但只有当该分配实际上改变了信号的值时才会发生偶数 .
VHDL具有以下相关属性:
S'active :布尔值如果在模拟周期中发生了事务,则为TRUE
S'event :如果在当前模拟周期中发生iff事件,则为布尔值为TRUE
在灵敏度列表中的任何信号的事件处恢复过程,因此为了确定导致恢复过程的哪个(哪些)信号,可以使用以下代码:
如果为
a
或b
分配了当前值,则甚至不会发生 .但是,VHDL有一个属性可以生成一个隐含的信号,该信号在每个事务处都会发生变化,从而有效地将事务转换为事件,从而可以恢复进程:
因此,可以通过以下方式在
a
或b
上通过事务恢复的进程:行为可以通过测试平台过程显示,产生刺激:
这将驱动信号,如下所示 . 请注意,ModelSims“Expanded Time Deltas Mode”已用于显示增量周期期间的信号变化:
来自进程alfa的报告输出(初始运行0 ps除外)是:
进程bravo的报告输出(初始运行0 ps除外)是:
因此,可以看出,仅在事务检查过程中,仅在事务检查中报告了仅在事务检查中报告的事务信号变化,并且没有与此相关的事件 .
@Morten, So using events and transaction I can even capture the instance that I send the same value to a signal in succession. As in the example:
a <= 0; - 宣布为自然
b <= 0;
等待1 ns;
a <= 1; - 事务和事件@ 1 ns 1 delta
等待0秒; - 达美延迟
a <= 1; - 只有事务,但没有事件@ 1 ns 2 delta
等待0秒; - 达美延迟
In this line where you assign the same value to signal 'a'
a <= 1; - 只有事务,但没有事件@ 1 ns 2 delta
我的假设是你可以捕获事务,其中transaction = 1,event = 0 .
这很好,但是,当在FPGA中合成时,情况仍然如此吗?