06-02-2019, 02:00 PM
It is indeed, or alternatively a way of writing a list.
when S1080_60i | S1080_30p | S1080_60p => HMAX_VALUE <= 2200 - HMAXFIX;
could equally be written as:
when S1080_60i => HMAX_VALUE <= 2200 - HMAXFIX;
when S1080_30p => HMAX_VALUE <= 2200 - HMAXFIX;
when S1080_60p => HMAX_VALUE <= 2200 - HMAXFIX;
Purely a matter of style. I think it only works if the argument of the CASE is an integer though I could be wrong. What definitely only works with an integer is saying:
when 1 to 3 => X<=Y;
Saves writing:
when 1 => X<=Y;
when 2 => X<=Y;
when 3 => X<=Y;
It never hurts to remind that you should always put a "when else" clause in a CASE statement. Even if you know for certain that you've enumerated all the possible cases it doesn't hurt. I think the Xilinx tools require it.
Another VHDL reminder:
CASE evaluates all possible values of its argument to give a unique answer. IF/THEN/ELSE is different. The logic is evaluated in the order the lines are written.
So (J, K are boolean):
if J then Q <= '1';
elsif K then Q <= '0';
else Q <= Q; -- not essential but a useful aid to memory
end if;
is different to:
if K then Q <= '0';
elsif J then Q <= '1';
else Q <= Q; -- not essential but a useful aid to memory
end if;
They look similar but if J and K are BOTH true the 2 versions will give different answers. This may or may not matter but you need to be aware.
when S1080_60i | S1080_30p | S1080_60p => HMAX_VALUE <= 2200 - HMAXFIX;
could equally be written as:
when S1080_60i => HMAX_VALUE <= 2200 - HMAXFIX;
when S1080_30p => HMAX_VALUE <= 2200 - HMAXFIX;
when S1080_60p => HMAX_VALUE <= 2200 - HMAXFIX;
Purely a matter of style. I think it only works if the argument of the CASE is an integer though I could be wrong. What definitely only works with an integer is saying:
when 1 to 3 => X<=Y;
Saves writing:
when 1 => X<=Y;
when 2 => X<=Y;
when 3 => X<=Y;
It never hurts to remind that you should always put a "when else" clause in a CASE statement. Even if you know for certain that you've enumerated all the possible cases it doesn't hurt. I think the Xilinx tools require it.
Another VHDL reminder:
CASE evaluates all possible values of its argument to give a unique answer. IF/THEN/ELSE is different. The logic is evaluated in the order the lines are written.
So (J, K are boolean):
if J then Q <= '1';
elsif K then Q <= '0';
else Q <= Q; -- not essential but a useful aid to memory
end if;
is different to:
if K then Q <= '0';
elsif J then Q <= '1';
else Q <= Q; -- not essential but a useful aid to memory
end if;
They look similar but if J and K are BOTH true the 2 versions will give different answers. This may or may not matter but you need to be aware.
www.borinsky.co.uk Jeffrey Borinsky www.becg.tv







