Re: When is it to generate transparent latch or usual combinationallogic?
On May 28, 8:32*pm, Jacko <jackokr...@gmail.com> wrote:
>'Inferred latches for signal' is quite a
> strange phrase, maybe 'possible forgotten signal assignment' would be
> better. It only seems to be if ... then ... else ... end if; which
> generates inferred latches. case and if ... then ... end if; does not
> seem to. I guess this is because no else is definite latch/register,
> and case can contain many places of non assignment and so could flood
> the message display. It's not that strange really.
I agree, it is not that strange...
But it really has nothing to do with missing "else" statements. It
only has to do with missed assignments. Complex if/elsif or case
statements just make it much easier to miss an assignment.
Unfortunately, simply adding an "else" for every "if" is not
guaranteed to catch every missed assignment.
If combinatorial processes are needed/desired, the best coding
mechanism to ensure a latch-free implementation is to include a
default assignment for every driven signal, right up front in the
process. This is the simplest coding method to write, review, audit
and maintain, because then it simply does not matter whether you have
an "else" for every "if", or an assignment in every branch of a case
statement.
Andy
|