3240|3

9

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

各位高手,帮我解决一下程序问题吧 [复制链接]

本程序试图在输入信号去抖动后转换为程序中中的复位、开启信号,en信号合适,但是reset信号转换后一直是高电平,不合适,望高手不吝赐教,在下感激不尽
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

entity key_test is
    port(start_stop,reset,clk,en:in std_logic;
         rst:out std_logic;
         eno:out std_logic);
end key_test;

architecture behav of key_test is
signal station1:std_logic_vector(1 downto 0):="00";
signal station2:std_logic_vector(1 downto 0):="00";
signal sum_tmp:std_logic_vector(3 downto 0);
signal co_tmp:std_logic;
signal rst_tmp:std_logic:='1';
signal eno_tmp:std_logic:='0';
component cnt10_test
    port(reset,en,clk:in std_logic;
         sum:out std_logic_vector(3 downto 0);
         co:out std_logic);
end component;
begin
    u0:cnt10_test port map(reset,en,clk,sum_tmp,co_tmp);
   
    process(reset,co_tmp) is
    begin
        if(reset='0') then
            if(co_tmp'event and co_tmp='1') then
                case station1 is
                    when "00"=>station1<="01";
                    when "01"=>station1<="10";
                    when "10"=>station1<="11";
                    when "11"=>station1<="11";
                    when others=>station1<="00";
                end case;
            end if;
        else
            station1<="00";
        end if;
        if(start_stop'event and start_stop='1') then
            if(station2="11") then
                rst_tmp<='0';
            end if;
        end if;
    end process;
   
    process(start_stop,co_tmp) is
    begin
        if(start_stop='1') then
            if(co_tmp'event and co_tmp='1') then
                case station2 is
                    when "00"=>station2<="01";
                    when "01"=>station2<="10";
                    when "10"=>station2<="11";
                    when "11"=>station2<="11";
                    when others=>station2<="00";
                end case;
            end if;
        else
            station2<="00";
        end if;
        if(start_stop'event and start_stop='0') then
            if(station2="11") then
                eno_tmp<=not eno_tmp;
            end if;
        end if;
    end process;

    eno<=eno_tmp;
    rst<=rst_tmp;
end behav;
此帖出自FPGA/CPLD论坛

最新回复

支持楼上兄弟的说法。其实VHDL编程很简单。标准写法正如楼上兄弟所说。 因为硬件电路编程,所以编程都是符合硬件电路特性,否则出来效果,不知道所云。  详情 回复 发表于 2011-11-10 09:17
点赞 关注
 

回复
举报

7230

帖子

195

TA的资源

五彩晶圆(高级)

沙发
 
可以用文本编辑注释 添加都里面来的 不然看起来费劲
此帖出自FPGA/CPLD论坛
 
 

回复

198

帖子

0

TA的资源

纯净的硅(初级)

板凳
 
个人认为楼主还没有入门:
1.用非时钟信号作为DFF的clk输入,例如:
“if(co_tmp'event and co_tmp='1') then”
2.敏感列表中的东西不对
3.还没有VHDL编程的思路
这是非常不合理的。一般的写法是:
process(clk, reset)
begin
if reset='0' then

elsif rising_edge(clk) then

end if;
end process;
多看看别人的代码是怎么写的,起步阶段都是依葫芦画瓢,别总自己想当然的乱写一气
此帖出自FPGA/CPLD论坛
 
 
 

回复

6892

帖子

0

TA的资源

五彩晶圆(高级)

4
 

支持楼上兄弟的说法。其实VHDL编程很简单。标准写法正如楼上兄弟所说。

因为硬件电路编程,所以编程都是符合硬件电路特性,否则出来效果,不知道所云。

此帖出自FPGA/CPLD论坛
个人签名一个为理想不懈前进的人,一个永不言败人!
http://shop57496282.taobao.com/
欢迎光临网上店铺!
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/9 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表