Search code examples
vhdlfpgasynthesis

Is the use of records the solution to all latch problems in VHDL


I was recently told that the solution to all (most) problems with unintended latches during VHDL synthesis is to put whatever the problematic signal is in a record.

This seems like it's a little bit too good to be true, but I'm not that experienced with VHDL so there could be something else that I'm not considering.

Should I put all my signals in records?


Solution

  • No, you should not put all your signals in records. This will quickly become very confusing and you will not gain anything by using the record.

    One way that a record may help you avoid latches, is if you register an entire record in a clocked process, you are really registering all of the components of the record. This takes one line of code, instead of possibly tens of lines. In the case where you have many elements which all need to be treated the same, a record can save you "silly mistakes", and possibly save you from creating a latch.

    As stated by others, a record doesn't have any specific synthesis interpretation. It is simply a group of signals that you are grouping together for coding-convenience.