(4) block中的被保护赋值
例:
architecture Guarded of and_Gate is
begin
block (EN = '1') -- 保护条件
begin
Y <= guarded -- 保护性赋值语句
'1' after Delay when A='1' and B='1' else
'0' after Delay;
end block;
end Guarded;
等价于
architecture GuardedEquivlent of and_Gate is
begin
block (EN = '1')
--保护条件为真时产生一个隐式信号GUARD
begin
process
begin
if GUARD then -- 只有保护条件为真时,才执行保护性赋值语句
if A='1' and B='1' then
Y<='1' after Delay;
else Y<='0' after Delay;
end if;
end if;
wait on GUARD, A, B;
end process;
end block;
end GuardedEquivlnt;
block的保护性赋值是其独特的功能。只有保护条件为真时,才执行保护性赋值语句,反之,保护性赋值语句不予执行。非保护性赋值语句与保护条件无关,总是要执行。
|