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. Hyperledger Fabric1.0环境搭建

    一.准备CentOS系统,本文使用的是CentOS7.0 二.安装Docker 执行命令 yum -y install docker 验证是否安装成功 docker --version 三.安装Doc ...

  2. Kubernetes 部署Weave Scope监控

    yaml下载地址: https://cloud.weave.works/k8s/scope.yaml?k8s-version=? 目前有以下几个版本: ["v1.4"," ...

  3. Python 条件判断语句(if ,elif, else)

    条件判断可以分: 单分支判断:只有一个if语句 双分支判断:if else 的格式 多分支判断:if elif  else 的格式 条件语句嵌套判断 # 下面是个条件多分支判断 score = 85 ...

  4. 什么是CDN 域名预热

    通常大家理解的预热功能是,缓存预热.将需要预热的资源推送到CDN边缘节点,用户访问时将不需要再回源站,可以直接命中缓存.这样可以加快资源的首次访问,同时缓解突增回源流量给源站造成的压力.这里说的是域名 ...

  5. 闲聊SEO

    SEO 1. SEO 搜索引擎优化 免费(Baidu,Google) SEM 搜索引擎营销 收费 2. IP 独立IP访问的用户 PV 页面的点击量 UV 独立访客数 3. 搜索引擎蜘蛛 权重 去让搜 ...

  6. OpenStack with Opendaylight Part 1: Intro to Pipeline

    Using Vagrant to create vm nodes; devstack to start openstack using Opendaylight as ML2. Openstack w ...

  7. java:IO:file 类

    刷某一目录下的所有文件夹/文件 public class FileDemo2 { public static void main(String args[]) { File file = new Fi ...

  8. nvm工具

    nvm工具 nvm简介 nvm是node version manager的简称,是nodeJs的版本管理器,他可以在一台主机上对node的版本进行方便的切换.我尝试了一下window的,但是不行,你可 ...

  9. file.seek()方法引出的文本文件和二进制文件问题

    问题的起因 菜鸟教程上有一段关于file.seek()方法的讲解,先简短描述一下seek()方法: seek(offset, whence)方法用于移动文件读取指针到指定位置 参数offset--开始 ...

  10. HANA aggregate 数字聚合

    在project 1 里面 具有服务店代码,金额.应该上一层aggregate 就自动聚合了.可是并没有.要自己手工设置一下.在columns 右键变成——convert to  aggregated ...