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 ...
随机推荐
- Redis 高级实用特性
1.安全性 设置客户端连接后进行任何其他操作前先验证密码. 因为Redis速度相当快,所以在一台比较好的服务器下,一个外部用户可以在一秒钟进行150K次的密码尝试,这意味着需要指定一个非常强大的密码来 ...
- DOCKER 简单操作
docker ps -a 列出所有镜像 docker start docder_name dcoker start docker_id 运行某个镜像 docker restart docker_nam ...
- mysql-用命令导出、导入表结构或数据
1. 导出整个数据库(表结构和数据) mysqldump -u用户名 -p 数据库名 > 导出的文件名 [root@localhost work]# mysqldump -uroot -p m ...
- RPC与HTTP
一.为什么需要RPC,而不是简单的HTTP接口? RPC(即Remote Procedure Call,远程过程调用),主要是基于TCP/IP协议:而HTTP服务主要是基于HTTP协议的.我们都知道H ...
- 使用Homebrew管理你的mac开发包
很多人可能不了解 Homebrew, 其实它相当于开发软件界的 Appstore. 比如,如果我要安装 python 的最新版本,那么传统的做法是 1. 到官方网站下载 python 的最新版本 2. ...
- Guest CPU model configuration in libvirt with QEMU/KVM
每个hypervisor对于guest能看到的cpu model定义都不同,Xen 提供host pass through,所以guest能看到的cpu和host完全相同. QEMU/KVM中gues ...
- js的constructor
js创建一个构造函数,会默认在原型链上添加一个constructor的属性,它保存了构造函数内的代码. 一般情况下我们不需要去改动它,但是有些时候我们会不经意的改写它. 比如下面这个例子: var F ...
- 51nod 1686 二分+离散化
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1686 1686 第K大区间 基准时间限制:1 秒 空间限制:131072 ...
- vue项目组件的全局注册
在vue-cli项目中,我们经常会封装自己的组件,并且要在多个界面中引用它,这个时候就需要全局注册组件. 首先我们会封装自己的组件,比如twoDimensionTable文件夹下的index.vue: ...
- IT从业人员必看的10个论坛(转)
IT方面的论坛太多了,有综合,有专业,有行业,在各个论坛里混了几年,体会颇深,以前是论坛哪里人多,往哪里去,新浪论坛,网易是经常去的,人多啊,好几十万,去了以后才发现没有意思,没有共同的语言,于是逛专 ...