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

📄 alarm_state_machine.vhd

📁 design compile synthesis user guide
💻 VHD
字号:
entity ALARM_STATE_MACHINE is    port (ALARM_BUTTON, HOURS_BUTTON, MINUTES_BUTTON, CLK: in BIT;          HOURS, MINS: out BIT);end;architecture BEHAVIOR of ALARM_STATE_MACHINE is    type STATE_TYPE is (IDLE,SET_HOURS,SET_MINUTES);    signal CURRENT_STATE, NEXT_STATE: STATE_TYPE;begin  COMBIN: process(CURRENT_STATE, ALARM_BUTTON, HOURS_BUTTON, MINUTES_BUTTON)  begin    NEXT_STATE <= CURRENT_STATE;    HOURS <= '0';    MINS <= '0';    case CURRENT_STATE is      when IDLE =>	if (ALARM_BUTTON  = '1' and HOURS_BUTTON  = '1' and MINUTES_BUTTON = '0') then	   NEXT_STATE <= SET_HOURS;	   HOURS <= '1';	elsif (ALARM_BUTTON  = '1' and MINUTES_BUTTON  = '1' and HOURS_BUTTON = '0') then	   NEXT_STATE <= SET_MINUTES;	   MINS <= '1';	else	   NEXT_STATE <= IDLE;	end if;      when SET_HOURS =>	if (ALARM_BUTTON  = '1' and HOURS_BUTTON  = '1'  and MINUTES_BUTTON = '0')then	   NEXT_STATE <= SET_HOURS;	   HOURS <= '0';	else	   NEXT_STATE <= IDLE;	end if;      when SET_MINUTES =>	if (ALARM_BUTTON  = '1' and MINUTES_BUTTON  = '1'  and HOURS_BUTTON = '0') then	   NEXT_STATE <= SET_MINUTES;	   MINS <= '0';	else	   NEXT_STATE <= IDLE;	end if;     end case;   end process;   SYNCH: process   begin     wait until CLK'event and CLK = '1';     CURRENT_STATE <= NEXT_STATE;   end process;end BEHAVIOR;           

⌨️ 快捷键说明

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