当前位置:网站首页>【VHDL 并行语句执行】
【VHDL 并行语句执行】
2022-07-07 04:29:00 【又菜又爱玩_】
VHDL 判断信号上升沿的一种方式
一般的检测时钟上升沿
方法一:rising_edge 是非常严格的上升沿,必须从0到1 ,
方法二:(clk’event and clk=‘1’) 可以从 X 到 1
两种方式很好理解
/
问题
由于最近才接触FPGA,学习VHDL语言,碰到了一个初学者可能都会碰到的问题
clk10khz_d1 <= clk10khz;
clk10khz_d2 <= clk10khz_d1;
if key_cs='1' and clk10khz_d1='1' and clk10khz_d2='0' then --(判断上升沿)
.......
end if;
看到这里,clk10khz 的值给 clk10khz_d1 , clk10khz_d1的值再给clk10khz_d2,
这样一来clk10khz ,clk10khz_b1 ,clk10khz_b2 不应该是一样? 是不是错了?
后来看了很多检测上升沿的代码,都是这样,也没有解释。
其实就是 非阻塞赋值 和 阻塞赋值 的区别 , 资深的VHDL玩家就会觉得这个问题太基础不过了。
什么是非阻塞赋值?
非阻塞赋值操作符用小于等于号(即<=)表示。
为在赋值操作时刻开始时计算非阻塞赋值符的RHS表达式,赋值操作时刻结束时更新LHS。在计算非阻塞赋值的RHS表达式和更新LHS期间,其他的语句,包括其他的非阻塞赋值语句都能同时计算RHS表达式和更新LHS。非阻塞赋值允许其他的语句同时进行操作。
非阻塞赋值是由时钟节拍决定,在时钟上升到来时,执行赋值语句右边,然后将begin-end之间的所有赋值语句同时赋值到赋值语句的左边,注意:是begin—end之间的所有语句,一起执行,且一个时钟只执行一次。
两种不同的赋值方式结果是不同的,非阻塞赋值b<=a;c<=b;两条语句是同时执行的,而阻塞赋值b=a;c=b;两条语句先执行b=a后执行c=b。
为什么能检测上升沿?
知道了什么是非阻塞赋值,那就很容易理解检测上升沿的方法了
clk10khz_d1 <= clk10khz;
clk10khz_d2 <= clk10khz_d1;
两句语句一起执行,假设clk10khz状态为 …01… (上升沿时)
在低电平时 clk10khz_d1 , clk10khz_d2 都被赋为了0 ,
在上升沿的顺间,同时执行两句语句时 clk10khz_d2 还是 被之前 clk10khz_d1存的值赋为了0;
此时clk10khz上升为1 , clk10khz_d1 被赋值为1.
由此通过clk10khz_d1='1' and clk10khz_d2='0检测信号上升沿。
也就是说两句赋值语句的顺序并不重要,反过来结果都一样。
边栏推荐
- misc ez_ usb
- A concurrent rule verification implementation
- 解决问题:Unable to connect to Redis
- Tongda injection 0day
- Leetcode-206. Reverse Linked List
- Operation suggestions for today's spot Silver
- [UTCTF2020]file header
- Leetcode-226. Invert Binary Tree
- Solution: could not find kf5 (missing: coreaddons dbusaddons doctools xmlgui)
- Six methods of flattening arrays with JS
猜你喜欢

MobaXterm

leetcode:105. Constructing binary trees from preorder and inorder traversal sequences
![[2022 ACTF]web题目复现](/img/e4/ab9a1771489d751ee73a79f151d374.png)
[2022 ACTF]web题目复现
![[webrtc] M98 screen and window acquisition](/img/b1/1ca13b6d3fdbf18ff5205ed5584eef.png)
[webrtc] M98 screen and window acquisition
![[ANSYS] learning experience of APDL finite element analysis](/img/bc/dc0742c308816553a80d50d1a990e3.jpg)
[ANSYS] learning experience of APDL finite element analysis

Flutter riverpod is comprehensively and deeply analyzed. Why is it officially recommended?
![[SUCTF 2019]Game](/img/9c/362117a4bf3a1435ececa288112dfc.png)
[SUCTF 2019]Game

通信设备商,到底有哪些岗位?

buuctf misc USB

A bit of knowledge - about Apple Certified MFI
随机推荐
3、 High quality programming and performance tuning practical youth training camp notes
Simple example of ros2 planning system plansys2
About some details of final, I have something to say - learn about final CSDN creation clock out from the memory model
Determining the full type of a variable
【Unity】物体做圆周运动的几个思路
Tongda injection 0day
ASEMI整流桥RS210参数,RS210规格,RS210封装
UWB learning 1
nacos
【斯坦福计网CS144项目】Lab3: TCPSender
After the interview, the interviewer roast in the circle of friends
Interviewer: what development models do you know?
毕设-基于SSM大学生兼职平台系统
Mysql高低版本切换需要修改的配置5-8(此处以aicode为例)
Value sequence (subsequence contribution problem)
Pytest+allure+jenkins environment -- completion of pit filling
[OBS] win capture requires winrt
Kbu1510-asemi power supply special 15A rectifier bridge kbu1510
Weibo publishing cases
Common method signatures and meanings of Iterable, collection and list