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.

What makes an inferred latch? how To avoid creating inferred latches? when do you know you need latches?的更多相关文章

  1. Effective Java 05 Avoid creating unnecessary objects

    String s = new String("stringette"); // Don't do this. This will create an object each tim ...

  2. Java之创建对象>5.Avoid creating unnecessary objects

    String s = new String("stringette"); // DON'T DO THIS! The improved version is simply the ...

  3. [20190416]process allocation latch.txt

    [20190416]process allocation latch.txt --//看链接:http://andreynikolaev.wordpress.com/2010/12/16/hidden ...

  4. [20190416]exclusive latch测试脚本.txt

    [20190416]exclusive latch测试脚本.txt --//昨天做了shared latch的测试脚本,今天完善exclusive latch测试脚本,上个星期的测试我是手工执行的.- ...

  5. [20190416]完善shared latch测试脚本2.txt

    [20190416]完善shared latch测试脚本2.txt --//昨天测试shared latch,链接:http://blog.itpub.net/267265/viewspace-264 ...

  6. [20190415]关于shared latch(共享栓锁).txt

    [20190415]关于shared latch(共享栓锁).txt http://andreynikolaev.wordpress.com/2010/11/17/shared-latch-behav ...

  7. Oracle Tuning 基础概述01 - Oracle 常见等待事件

    对Oracle数据库整体性能的优化,首先要关注的是在有性能问题时数据库排名前几位等待事件是哪些.Oracle等待事件众多,随着版本的升级,数量还在不断增加,可以通过v$event_name查到当前数据 ...

  8. Git for Windows v2.11.0 Release Notes

    homepage faq contribute bugs questions Git for Windows v2.11.0 Release Notes Latest update: December ...

  9. oracle_hc.sql

    select event,count(1) from gv$session group by event order by 2;exec dbms_workload_repository.create ...

随机推荐

  1. Why does typeof array with objects return “Object” and not “Array”?

    https://stackoverflow.com/questions/4775722/check-if-object-is-an-array One of the weird behaviour a ...

  2. mac下查看占用端口的进程及杀死进程

    mac lsof -i :9000 kill -9 716

  3. C#反射第二天

    原文:http://blog.csdn.net/zhaoguiqun/article/details/5954720 1.什么是反射Reflection,中文翻译为 反射.     这是.Net中获取 ...

  4. 初探MyBatis之HelloWorld(三)

    三.用SQL映射语句用注解,dataSource用xml(不推荐). 综合上面两节(一个用xml,一个用annotation),发现一个好玩儿的,SQL映射用注解方式,然后还是得有两个xml配置文件. ...

  5. 美化tp5.1跳转提示

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  6. Python中MySQL插入数据

    sql = 'INSERT INTO course(class_name, credit, properties, teacher_name, college_given, classroom) ' ...

  7. neutron routers HA 实验

    测试环境: 5个节点(( controller,2  network,2 compute nodes)) 采用VXLAN+Linux Bridge 1. 确定所有的neutron和nova服务都在运行 ...

  8. java:system根据输入的内容,然后输出(字节流)

    把输入的内容输出来:根据system.in的内容System.out.println输出出来 都是字节流,的形式: //限制读取的字符长度 //字节流 InputStream ips = System ...

  9. ItemsControl 与 ICollectionView

    ItemsControl base class can automatically interact with ICollectionView classes

  10. virualbox andirodx86

    背景 谷歌提供的andriod sdk模拟器在windows平台上很卡,是因为sdk是针对arm处理器架构的(就是嵌入式),而我们的windows系统是 x86架构 或者是 AMD架构,所以安卓模拟器 ...