Forum Discussion

lusant's avatar
lusant
Icon for New Contributor rankNew Contributor
2 years ago
Solved

Quartus 20.1 and warnings about Latches

Hi, I'm starting with VHDL and I read that we should avoid Latches when we can. One way to generate those Latchs is to left open assignments in a process, normally when using IFs clauses. In the...
  • FvM's avatar
    2 years ago

    Hi,

    still some misunderstandings in your latest post.

    First point, you don't need to worry about possible latch generation in clocked processes, neither about additional sensitivity list entries.

    The LEs you have marked in technology map viewer are not part of combinational pathes. All logic pathes start and end at a DFF (or an IO pin).

    The key observation is that bits SpeedLimit(4 downto 0) which are claimed as latches by Quartus don't exist in the design at all. The respective output bits are tied to ground. This happens because SpeedLimit is varied in steps of 100000, which can be factorized as 2^5*5^5. Factor 2^5 corresponds to 5 LSB staying zero. Changing the limits (your first experiment) allows more steps but keeps step size 100000.

    If you change one step to e.g. 100001, register bits SpeedLimit(4 downto 0) are implemented and the latch warning disappears.

    It has been also suggested to change the reset to synchronous to remove the warning, I already rated the suggestion as inappropriate.
    Why?
    1. It's unnecessary. It masks an erroneous warning but doesn't solve a real issue.
    2. It increases resource utilization, e.g. 27 to 35 LE with Cyclone 10 LP implementation. Asynchronous reset is already implemented in registers and "free" in terms of logic resources if you use a global reset signal, synchronous reset need additional logic.
    3. It may have other unwanted effects, depending on the reset scheme of your application.

    As stated, the warning is erroneous and should be corrected by Intel. For the time being, you can disable the warning by a synthesis directive in front of the architecture declaration

    -- altera message_off 10631
    -- altera message_off 10041

    Best regards
    Frank