当前位置:网站首页>【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检测信号上升沿。
也就是说两句赋值语句的顺序并不重要,反过来结果都一样。
边栏推荐
- Is the test cycle compressed? Teach you 9 ways to deal with it
- 微博发布案例
- The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?
- Solution: could not find kf5 (missing: coreaddons dbusaddons doctools xmlgui)
- 图解GPT3的工作原理
- Pytorch parameter initialization
- pytest+allure+jenkins安装问题:pytest: error: unrecognized arguments: --alluredir
- 解决问题:Unable to connect to Redis
- Leetcode-543. Diameter of Binary Tree
- 解决could not find or load the Qt platform plugin “xcb“in ““.
猜你喜欢

L'externalisation a duré trois ans.

The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?

3、 High quality programming and performance tuning practical youth training camp notes

Iterable、Collection、List 的常见方法签名以及含义

Common validation comments

Make a bat file for cleaning system garbage
![[2022 actf] Web Topic recurrence](/img/e4/ab9a1771489d751ee73a79f151d374.png)
[2022 actf] Web Topic recurrence

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

Mysql高低版本切换需要修改的配置5-8(此处以aicode为例)
![[Stanford Jiwang cs144 project] lab4: tcpconnection](/img/fd/704d19287a12290f779cfc223c71c8.png)
[Stanford Jiwang cs144 project] lab4: tcpconnection
随机推荐
科技云报道:从Robot到Cobot,人机共融正在开创一个时代
The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?
IPv4 exercises
How can a 35 year old programmer build a technological moat?
Detailed explanation of uboot image generation process of Hisilicon chip (hi3516dv300)
自定义类加载器加载网络Class
php导出百万数据
buuctf misc USB
【obs】win-capture需要winrt
Codeforces Global Round 19
CentOS7下安装PostgreSQL11数据库
【性能压测】如何做好性能压测?
微博发布案例
@component(““)
Few-Shot Learning && Meta Learning:小样本学习原理和Siamese网络结构(一)
2022-07-06: will the following go language codes be panic? A: Meeting; B: No. package main import “C“ func main() { var ch chan struct
The metauniverse of the platofarm farm continues to expand, with Dao governance as the core
vus. Precautions for SSR requesting data in asyndata function
微信小程序中使用wx.showToast()进行界面交互
图解GPT3的工作原理