A
Analog_Guy
Guest
Hi,
Any comments about the following code with regard to setting a default
value
of signal 'a'? It appears that they both compile and synthesize fine,
but are there
any comments related to coding style ... or maybe other factors I am
overlooking?
In this process, 'a' is always assigned a default of '0', before the
value of
'b' is checked. If 'b' is '1', then 'a' ends up getting assigned
twice.
PROCESS (resetn, clock)
BEGIN
IF (resetn = '0') THEN
a <= '0';
ELSIF (clock = '1' AND clock'EVENT) THEN
a <= '0';
IF (b = '1') THEN
a <= '1';
END IF;
END IF;
END PROCESS;
In this process, 'a' is only assigned once, depending on the value of
'b'.
PROCESS (resetn, clock)
BEGIN
IF (resetn = '0') THEN
a <= '0';
ELSIF (clock = '1' AND clock'EVENT) THEN
IF (b = '1') THEN
a <= '1';
ELSE
a <= '0';
END IF;
END IF;
END PROCESS;
Any comments about the following code with regard to setting a default
value
of signal 'a'? It appears that they both compile and synthesize fine,
but are there
any comments related to coding style ... or maybe other factors I am
overlooking?
In this process, 'a' is always assigned a default of '0', before the
value of
'b' is checked. If 'b' is '1', then 'a' ends up getting assigned
twice.
PROCESS (resetn, clock)
BEGIN
IF (resetn = '0') THEN
a <= '0';
ELSIF (clock = '1' AND clock'EVENT) THEN
a <= '0';
IF (b = '1') THEN
a <= '1';
END IF;
END IF;
END PROCESS;
In this process, 'a' is only assigned once, depending on the value of
'b'.
PROCESS (resetn, clock)
BEGIN
IF (resetn = '0') THEN
a <= '0';
ELSIF (clock = '1' AND clock'EVENT) THEN
IF (b = '1') THEN
a <= '1';
ELSE
a <= '0';
END IF;
END IF;
END PROCESS;