///
Um dispositivo programável deve implementar um contador crescente e decrescente. Num determinado trecho de código VHDL, tem-se:
process (CLK)
begin
if (CLK'event and CLK = '1') then
if (LOAD = '0') then CONT <= D;
elsif (EN = '1' and UP = '1') then
CONT <= CONT + "0001";
elsif (EN = '1' and UP = '0') then
CONT <= CONT - "0001";
end if;
end if;
end process;Para a economia de transistores durante a síntese do circuito, sugeriu-se trocar o código por:
process (CLK)
begin
if (CLK'event and CLK = '1') then
if (LOAD = '0') then CONT <= D;
elsif (EN = '1') then
CONT <= CONT + parcela ;
end if;
end if;
end process;O código a ser inserido no local indicado como “parcela” deve ser: