2562|3

77

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

关于VHDL的问题 谢谢大家帮忙看看 急~ [复制链接]

LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
----------------------------------------

ENTITY zuoye IS
PORT( cp,reset : in std_logic;
      Data,cc  : in std_logic_vector(3 downto 0);
       q       : buffer std_logic;
       count   : buffer integer range 7 downto 0;
       Din     : in std_logic_vector(7 downto 0);
       Dout    : out std_logic_vector(7 downto 0));
end;

-------------------------------------------

architecture aa of zuoye is
signal load,en : std_logic;
signal qq      : std_logic_vector(3 downto 0);
signal R,REG   : std_logic_vector(7 downto 0);
TYPE states IS (st0, st1, st2, st3);
signal STA     : states := st0;
BEGIN

process(STA,cp,reset)
      begin
         -- if reset='1' then  STA<=st0;
            if  cp'event and cp='1' then
           CASE  STA IS
            WHEN st0 => en <= '1'; STA <= st1;
            WHEN st1 =>  if count=7 then en<='0'; STA<=st2; end if;
            WHEN st2 => REG <= R xor Din; STA<=st3;
            WHEN others =>Dout <= REG xor Din;STA<=st0;
       end CASE;
       end if;
END process;   
               

process(cp,en)
     begin
      if en='1' then qq<=data;
          elsif cp'event and cp='1'  then  
               qq<=((qq(0) and cc(0)) xor (qq(1) and cc(1)) xor (qq(2) and cc(2)) xor (qq(3) and cc(3)))&qq(3 downto 1);
               count<=count+1;
      end if;
     R(count)<=qq(0);           
END process;     
end aa;   
            



这个程序编译时候已经没有问题了 但是时序仿真count只计数一个 还有我是想在 WHEN st1 =>  时候count计数满了就shi en为零 这样第二个process就不工作了 高手帮帮忙啊 仿真图如下    我不会上传仿真图 反正就是count只计数一次

最新回复

呵呵 非常感谢啊   详情 回复 发表于 2010-1-16 09:25
点赞 关注

回复
举报

79

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
关注
 
 

回复

74

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
process(cp,en)
begin
    if en='1' then
        qq <=data;
    elsif cp'event and cp='1' then  
        qq <=((qq(0) and cc(0)) xor (qq(1) and cc(1)) xor (qq(2) and cc(2)) xor (qq(3) and cc(3)))&qq(3 downto 1);
        count <=count+1;
    end if;
    R(count) <=qq(0);         
END process;

你这个进程的逻辑是en为'1'时,qq载入数据;en为'0'时,时钟驱动计数器计数。这和你描述的逻辑不一样啊。按照你说的逻辑代码应该是:
process(cp,en)
begin
    if en='1' then
        if cp'event and cp='1' then  
            qq <=((qq(0) and cc(0)) xor (qq(1) and cc(1)) xor (qq(2) and cc(2)) xor (qq(3) and cc(3)))&qq(3 downto 1);
            count <=count+1;
        end if;
    else
       qq <=data;
    end if;
    R(count) <=qq(0);         
END process;
 
 
 

回复

60

帖子

0

TA的资源

一粒金砂(初级)

4
 
呵呵 非常感谢啊
 
 
 

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

查找数据手册?

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
快速回复 返回顶部 返回列表