⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alarm4.vhd

📁 数字钟的VHDL源程序
💻 VHD
字号:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
ENTITY alarm4 IS
 PORT(settime:      IN STD_LOGIC;
      freq_l:     IN STD_LOGIC;
      ALARM:      OUT STD_LOGIC;                         --dirve signal for the bell
      hourhdis:   IN INTEGER RANGE 0 TO 2;               --time information recieved from module of "clock"
      hourldis:   IN INTEGER RANGE 0 TO 9;
      minhdis:    IN INTEGER RANGE 0 TO 5;
      minldis:    IN INTEGER RANGE 0 TO 9;
      sechdis:    IN INTEGER RANGE 0 TO 5;
      weekdis:    IN INTEGER RANGE 1 TO 7;
      secldis:    IN INTEGER RANGE 0 TO 9);
 END alarm4;
ARCHITECTURE archi OF alarm4 IS
  SIGNAL seclow,minlow,hourlow: INTEGER RANGE 0 TO 9;
  SIGNAL sechigh,minhigh: INTEGER RANGE 0 TO 5;
  SIGNAL hourhigh: INTEGER RANGE 0 TO 2;
  SIGNAL week: INTEGER RANGE 1 TO 7;
   BEGIN
   PROCESS(secldis)
    BEGIN                              --the clock alarm
    IF settime='1' THEN
            seclow<=secldis;
            sechigh<=sechdis;
            minlow<=minldis;
            minhigh<= minhdis;
            hourlow<=hourldis;
            hourhigh<=hourhdis;
            week<=weekdis;
    ELSE
       IF (weekdis=week and hourhdis=hourhigh and hourldis=hourlow and minhdis=minhigh and minldis=minlow ) --or
          --(weekdis=week and hourhdis=hourhigh and hourldis=hourlow and minhdis=minhigh and minldis=minlow and sechdis=1 ) or
          --(weekdis=week and hourhdis=hourhigh and hourldis=hourlow and minhdis=minhigh and minldis=minlow and sechdis=2 ) then
                    then
                    ALARM<=freq_l;
    ELSE  ALARM<='0';
    END IF;
END IF;
     END PROCESS;
END archi;



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -