各位大侠,我在阅读MAXPLUS2的例子时,遇到一个问题.
如下例程中,有一行是这样的: count_reg[].d = count_reg[].q - (0,!at_zero);
请问其中的(0,!at_zero)表示什么意思?
请教我.
附上原例程文件
SUBDESIGN debounce
(
clk : INPUT;
key_pressed : INPUT;
pulse : OUTPUT;
)
VARIABLE
count_reg[7..0] : DFF;
at_zero : NODE;
BEGIN
% Preset to 255 when key bounces or is not %
% pressed. Decrement when key is pressed. %
count_reg[].clk = clk;
count_reg[].prn = key_pressed;
count_reg[].d = count_reg[].q - (0,!at_zero);
如果计数不为零,at_zero = FAULSE, 则计数减一,
如果计数为0,at_zero = TRUE, 则计数不变
(0,!at_zero)是为了同count_reg[]向量(或数组)对应,这样才能通过编译
在数值上仅表示0或1
% Emit single pulse when counter reaches 1. %
pulse = count_reg[].q == h"01";
% Don't let counter decrement below zero. %
at_zero = count_reg[].q == h"00";
END;