芯路恒电子技术论坛

 找回密码
 立即注册
热搜: 合集
查看: 3672|回复: 0

这个vhdl程序运行不出来结果是怎么回事

[复制链接]
  • TA的每日心情
    难过
    2020-6-29 12:52
  • 1

    主题

    2

    帖子

    10

    积分

    新手入门

    Rank: 1

    积分
    10
    发表于 2020-6-29 13:16:27 | 显示全部楼层 |阅读模式
    我查了说是时钟对那个逻辑不起作用,但是怎么改啊
    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.std_logic_arith.all;
    use ieee.std_logic_unsigned.all;
    entity lk_lc is
    port(CLK,LP,LR,cnt_1,cnt_2,cnt_3:in std_logic;
          LEDLut std_logic_vector(2 downto 0));
    end;
    architecture behave of lk_lc is
    signal cnt:std_logic_vector(24 downto 0);
    signal cnt_1 : std_logic;
    signal cnt_2 : std_logic;
    signal cnt_set : std_logic;
    begin
    process(CLK,LP,LR)
    variable count : integer range 0 to 2 := 0;
    begin
    if LP = '0' then  
    LEDL<= (others=>'0');
    count := 0;
       elsif CLK'event and CLK='1' then
        if cnt_set = '1' then  
      case count is   
          when 0 =>     LEDL <= "001";   
        when 1 =>     LEDL <= "010";   
        when 2 =>      LEDL <= "100";   
        when others=>     null;  
      end case;     
      if count = 2 then   
              count := 0;   
        else    count := count + 1;   
         end if;   
       end if;
    end if;
    end process;
    process(LP,clk)
    begin
    if LP = '0' then  
      cnt <= (others=>'0');  
      cnt_1 <= '0';  cnt_2 <= '0';  cnt_set <= '0';
      elsif clk'event and clk = '1' then  
         if cnt_2 = '0' and cnt_1 = '1' and cnt(23)='1' then  
          cnt_set <= '1';  
       else   cnt_set <= '0';
       end if;  
       cnt <= cnt + 1;  cnt_2 <= cnt_1;  cnt_1 <= cnt(23);
    end if;
    end process;
    end behave;

    回复

    使用道具 举报

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

    本版积分规则

    QQ|小黑屋|Archiver|芯路恒电子技术论坛 |鄂ICP备2021003648号

    GMT+8, 2024-3-29 02:28 , Processed in 0.103408 second(s), 31 queries .

    Powered by Discuz! X3.4

    © 2001-2017 Comsenz Inc. Template By 【未来科技】【 www.wekei.cn 】

    快速回复 返回顶部 返回列表