使用 if 语句更改进程内的信号 - VHDL [英] change signal inside a process with if statement - VHDL

查看:43
本文介绍了使用 if 语句更改进程内的信号 - VHDL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 VHDL 中有此代码.我想要的是在 sw'event 时第一个上升,然后,第一个是自己下降.但是当我模拟这个时,第一个永远不会下降!

I have this code in VHDL. What I want is to rise rst when sw'event and afterwards, the rst is to fall by itself. But when I simulate this, rst never falls!

process(rst,clk,sw)
    begin
        if (clk'EVENT and clk='1') then
              if (rst='1') then 
                  rst<='0';
              elsif (sw'event) then
                  rst<='1';
              elsif (my_counter="11") then
                  deb_sw<=sw;   
              end if;    
        end if;
end process;

推荐答案

最后我是这样解决的

process(rst,clk,sw)
    begin
        if (clk'EVENT and clk='1') then
              if (rst='1' and rst'last_value='0') then 
                  rst<='0';
              elsif (sw='1') then 
                 rst<='1';
                 deb_sw<=sw;
              elsif (my_counter="1010") then      -- clock cycles=10*f
                  deb_sw<=sw;   
              end if;    
        end if;
end process;    

这篇关于使用 if 语句更改进程内的信号 - VHDL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆