0
\$\begingroup\$

I am trying to use an if then clause within a for generate in VHDL but it does not compile:

first_row: for j in 0 to 5*2-2 generate
if (j=5*2-2) then
i_fa_first_row: full_adder_std_logic port map(ai=>sum_ini(j),
                         bi=>zero,
                         ci=>mul(0,j),
                         si=>sum(0+1, j),
                         co=>c(0+1, j+1));
end if;
end generate first_row;

Nonetheless it does compile when I take the conditional clause out of the for generate clause. Does anyone know whether it is possible to do what I am trying to do?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ "does not compile": indicates the errors you get are potentially telling you what is wrong. \$\endgroup\$ Commented Jun 5, 2021 at 11:13
  • \$\begingroup\$ if ... then must be used inside a process (which can be inside a generate). But you probably meant if ... generate \$\endgroup\$
    – user16324
    Commented Jun 5, 2021 at 17:17

1 Answer 1

2
\$\begingroup\$

This is a conditional instance, you need to use if ... generate syntax for that.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.