What makes an inferred latch?
For combinatorial logic, the output of the circuit is a function of input only and should not contain any memory or internal state (latch).

In Verilog, a variable will keep its previous value if it is not assigned a value in an always block. A latch must be created to store this present value.

An incomplete if-else statement will generate latches. An if-else statement is considered "incomplete" if the output state is not defined for all possible input conditions. The same goes for an incomplete case statement, or a case statement that does not have a default: item.

Why are inferred latches bad?
Inferred latches can serve as a 'warning sign' that the logic design might not be implemented as intended. A crucial if-else or case statement might be missing from the design.

Latches can lead to timing issues and race conditions. They may lead to combinatorial feedback - routing of the output back to the input - which can be unpredictable.

To avoid creating inferred latches:

Include all the branches of an if or case statement
    Assign a value to every output signal in every branch
    Use default assignments at the start of the procedure, so every signal will be assigned.

Some parts paraphrased from "FPGA Prototyping by Verilog Examples" by P. Chu

when do you know you need latches?

Which, as you implied, is a subjective question. Expect more opinion than fact as answers. That being said, here is my opinion:

I, like you, often find better ways to use flip-flops thus avoiding latches. The resulting logic is often more elegant and robust. But there are times where I don't have enough control over the logic to avoid latches. For example, I might be interfacing to a processor bus that requires latches to meet the desired specifications. Since I can't redesign the CPU or the bus, I'm stuck with the latch.

In the past 13+ years, that is the only time I have needed latches.

最新文章

  1. 2012 Multi-University Training Contest 9 / hdu4389
  2. Bootstrap CSS概览代码文字标注篇
  3. viewport ——视区概念,为 自适应网页设计
  4. Codeforces Round #352 (Div. 2) A Summer Camp
  5. Qt 学习资料
  6. OpenStack介绍
  7. 用NOPI将图片二进制流导出到Excel
  8. jquery中判断是否按下回车enter键
  9. 【原创】Kmeans算法 优缺点分析
  10. 如何在python脚本里面连续执行adb shell后面的各种命令
  11. 结束《Java编程思想》(Thinking in Java)自学的读后感(2017.10.15)
  12. python 类的介绍
  13. Python设计模式 - UML - 用例图(Use Case Diagram)
  14. apache geode 试用
  15. 用python写web一定要去破解的异步请求问题.经历web.py和tornado,完破!
  16. django关系类型字段
  17. Jsp基础语法(由简入杂)
  18. 在EF中使用MySQL的方法及常见问题
  19. C++加速程序的全局执行函数
  20. TopJUI | easyui HTML Dialog页面间GET方式数据传递

热门文章

  1. 【转载】iptables、tc和ip命令
  2. HGVS的变异格式
  3. QGIS 编译
  4. centOS最小化安装后网络连接问题
  5. 经典的MapReduce1中的失败
  6. HTTP状态码 304
  7. JProgressBar与Timer的配套使用
  8. foobar2000下播放DSD音乐的插件
  9. mysql 授予远程连接直接访问
  10. DB21019E An error occurred while accessing the directory "/root".