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. gst-rtsp-server编译测试

    最近在做dm368的开发,打算在368上移植个gst-rtsp-server.先在电脑上折腾了一天,终于是可以运行了. 我的虚拟机上早先已经安装了gstreamer-0.10(gstreamer版本太 ...

  2. Linux 基础一---操作系统&常用命令

    UNIX是一个计算机操作系统,一个用来协调.管理和控制计算机硬件和软件资源的控制程序. 1.UNIX操作系统的特点:多用户和多任务: a) 多用户表示在同一时刻可以有多个用户同时使用UNIX操作系统而 ...

  3. HNOI2019梦游记

    \(Day_0\) 十点半开始睡觉,开始了八个小时的不眠之夜,整晚都没睡着,这状态明天肯定挂了 \(Day_1\) 开局一条鱼,计算几何只会\(20\) 还是\(T2\)的\(20\)纯暴力好打,\( ...

  4. Go 外部排序-网络版

    目录结果 main.go package main import ( "NetworkSort/pipeline" "fmt" "os" & ...

  5. Maven webapp index.jsp报错

    javax.servlet javax.servlet-api 3.1.0

  6. RabbitMQ解决分布式事务

    案例:经典案例,以目前流行点外卖的案例,用户下单后,调用订单服务,让后订单服务调用派单系统通知送外卖人员送单,这时候订单系统与派单系统采用MQ异步通讯. RabbitMQ解决分布式事务原理: 采用最终 ...

  7. Spark常用算子-value数据类型的算子

    package com.test; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; im ...

  8. SQl查询基础

    SQL语言是一门简单易学却又功能强大的语言,他让你快速上手并写出比较复杂的查询语句,但对于大多数开发者来书,使用SQL查询数据库并没有一个抽象的过程和一个合理的步骤,这很可能会是在写一些特定的查询语句 ...

  9. js备忘录模式

    备忘录(Memento):在不破坏封装的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态.这样以后就可将该对象恢复到原先保存的状态. 备忘录模式比较适用于功能比较复杂的,但需要维护或记录属性 ...

  10. Git在mac中和远程仓库建立连接

    1.下载git http://git-scm.com/download/ 2. 安装git 按照文字提示即可 3. 验证是否成功,输入命令行.输出git版本表示git安装成功. git --versi ...