What makes an inferred latch? how To avoid creating inferred latches? when do you know you need latches?
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?的更多相关文章
- Effective Java 05 Avoid creating unnecessary objects
String s = new String("stringette"); // Don't do this. This will create an object each tim ...
- Java之创建对象>5.Avoid creating unnecessary objects
String s = new String("stringette"); // DON'T DO THIS! The improved version is simply the ...
- [20190416]process allocation latch.txt
[20190416]process allocation latch.txt --//看链接:http://andreynikolaev.wordpress.com/2010/12/16/hidden ...
- [20190416]exclusive latch测试脚本.txt
[20190416]exclusive latch测试脚本.txt --//昨天做了shared latch的测试脚本,今天完善exclusive latch测试脚本,上个星期的测试我是手工执行的.- ...
- [20190416]完善shared latch测试脚本2.txt
[20190416]完善shared latch测试脚本2.txt --//昨天测试shared latch,链接:http://blog.itpub.net/267265/viewspace-264 ...
- [20190415]关于shared latch(共享栓锁).txt
[20190415]关于shared latch(共享栓锁).txt http://andreynikolaev.wordpress.com/2010/11/17/shared-latch-behav ...
- Oracle Tuning 基础概述01 - Oracle 常见等待事件
对Oracle数据库整体性能的优化,首先要关注的是在有性能问题时数据库排名前几位等待事件是哪些.Oracle等待事件众多,随着版本的升级,数量还在不断增加,可以通过v$event_name查到当前数据 ...
- Git for Windows v2.11.0 Release Notes
homepage faq contribute bugs questions Git for Windows v2.11.0 Release Notes Latest update: December ...
- oracle_hc.sql
select event,count(1) from gv$session group by event order by 2;exec dbms_workload_repository.create ...
随机推荐
- 【Flask】ORM 关系一对一
### 一对一的关系:在sqlalchemy中,如果想要将两个模型映射成一对一的关系,那么应该在父模型中,指定引用的时候,要传递一个`uselist=False`这个参数进去.就是告诉父模型,以后引用 ...
- Docker容器技术-基础与架构
一.什么是容器 容器是对应用程序及其依赖关系的封装. 1.容器的优点 容器与主机的操作系统共享资源,提高了效率,性能损耗低 容器具有可移植性 容器是轻量的,可同时运行数十个容器,模拟分布式系统 不必花 ...
- 20145240 《Java程序设计》第八周学习总结
20145240 <Java程序设计>第八周学习总结 教材学习内容总结 15.1日志 15.1.1日志API简介 java.util.logging包提供了日志功能相关类与接口,不必额外配 ...
- seajs 入门
最近想搞搞JS模块化, 读到了园子里的一篇好文: http://www.cnblogs.com/lvdabao/p/js-modules-develop.html 看里面讲seajs不错, 于是想学 ...
- Windows 端口和所提供的服务
一 .端口大全 端口:0 服务:Reserved 说明:通常用于分析操作系统.这一方法能够工作是因为在一些系统中“0”是无效端口,当你试图使用通常的闭合端口连接它时将产生不同的结果.一种典型的扫描,使 ...
- NCBI
RefSeq: NCBI Reference Sequences GeneBank序列注释说明 利用NCBI查找基因信息 NCBI中RefSeq各种accession说明(一) NCBI中RefSeq ...
- mac下查看占用端口的进程及杀死进程
mac lsof -i :9000 kill -9 716
- 权限【TLCL】
用户帐户 定义在/etc/passwd 文件里面,用户组定义在/etc/group 文件里面. /etc/shadow 包含了关于用户密码的信息 文件属性: 属性 文件类型 - 一个普通文件 d 一个 ...
- OpenStack网络新项目Dragonflow研究
https://www.ustack.com/blog/openstack-dragonflow/ 本文由2015年5月30日举行的OpenStack Meetup北京上的演讲整理而成,演讲者为Uni ...
- NSBundle的理解和mainBundle的基本介绍
一.NSBundle NSBundle是cocoa为bundle提供的一个类,bundle是一个目录,其中包含了程序会使用到的资源. 这些资源包含了如图像.声音.编译好的代码.nib文件.(用户也会把 ...