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

📄 phone.vhd

📁 电话用户信令的控制器源码
💻 VHD
字号:
LIBRARY ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

Entity Phone is
	port(clk,Reset,af,ab:in std_logic;
			 bcc,brc,rc: out std_logic	 
			 );
end Phone;			 
			 
Architecture Arch_Phone of Phone is

type fsm_state is (kongxian,zhujiao,shimang,zhengling,tonghua,dengdai);  --空闲,主叫,示忙,振铃,通话,等待	
signal State:fsm_state;


begin	
	process(clk,Reset)
		begin
			if(Reset='1') then
				bcc<='0';
				brc<='0';
				rc<='0';
				State<=kongxian;

			elsif(clk'event and clk='1' ) then
								
				case State is
					when kongxian => 	--空闲						
						if(ab='1' and af='0') then
							state<=zhujiao;
						elsif(ab='0' and af='0') then
							state<=shimang;
						elsif(ab='0' and af='1') then
							state<=zhengling;
						else state<=kongxian;			
						end if;	
							
						bcc<='0';
						brc<='0';
						rc<='0';		
							
					when zhujiao =>		--主叫	
						if(af='1') then
							state<=kongxian;
						elsif(ab='0') then
							state<=tonghua;
						else state<=zhujiao;	
						end if;						
						brc<='1';
					
					when shimang =>		--示忙
						bcc<='1';
						if(af='1') then
						state<=dengdai;						
						end if;						

					
					when zhengling =>		--振铃	
					if(af='0') then
							state<=tonghua;
					elsif(ab='1') then
							state<=kongxian;		
					end if;								
					rc<='1';						
				
					when tonghua =>		--通话
					if(ab='1') then
						state<=zhujiao;
					elsif(af='1') then
						state<=dengdai;
					end if;
						
					bcc<='0';
					brc<='0';
					rc<='0';	
									
					when dengdai =>		--等待
					if(ab='1') then
						state<=kongxian;		
					end if;
					
					bcc<='0';
					brc<='0';
					rc<='0';				
											
					when others => 
					null;	
				end case;			
			end if;			
			end process;
end Arch_Phone;
	 

⌨️ 快捷键说明

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