I'm used to writing the following process that will react on the rising edge of the CLK (script 1):
X: PROCESS(CLK)
BEGIN
IF RISING_EDGE(CLK) THEN OUTPUT <= CLK AND VAR;
ELSE NULL;
END IF;
END PROCESS X;
Now I need the process to react on both rising and falling edges of CLK, so according to the device datasheet I wrote this (script 2):
X: PROCESS(CLK)
BEGIN
IF (CLK'EVENT) THEN OUTPUT <= CLK AND VAR;
ELSE NULL;
END IF;
END PROCESS X;
Both cases fit and can be programmed on the device. But it seems like the second case does not really work: the OUTPUT does not change.
I need the OUTPUT to be updated on both edges of the CLK. Would it be functionally equivalent to script 2 if I rewrite the process as the following (script 3)? In other words, do I have to put IF condition, or the process reacts on the rising/falling edge of the CLK regardless?
X: PROCESS(CLK)
BEGIN
OUTPUT <= CLK AND VAR;
END PROCESS X;
EDIT: With script 2 I get the warning that the signal VAR is missing from the sensitivity list. However, I need the OUTPUT to change only with CLK, but be dependent on VAR value.
With Script 4 (below), which I would expect to be equivalent to script 2, the warning is different: WARNING:Xst:2110 - Clock of register OUTPUT seems to be also used in the data or control logic of that element.
X: PROCESS(CLK)
BEGIN
IF (CLK'EVENT) THEN
IF CLK = '1' THEN OUTPUT <= ('1' AND VAR);
ELSE OUTPUT <= '0';
END IF;
ELSE NULL;
END IF;
END PROCESS X;
Here's the fitter report with relevant vars(NICLK is for OUTPUT and SampEn is for VAR):