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

📄 key.v

📁 键扫描 处理程序 verilog 使用时钟为50Hz // 低电平为按下,高电平为断开 // 输出状态,1为键入,0为无键
💻 V
字号:
//------------------------------------------------------------------
//文件名    :key.v
//作者      :LL
//日期      :20061202
//版本      :0.1
//功能描述  :TPY-XUE单个普通键键扫,键值维持一个时钟周期,必须在这个时间内响应
//备注	    : 使用时钟为50Hz
//	      低电平为按下,高电平为断开
//	      输出状态,1为键入,0为无键
//
//修改记录  :
//------------------------------------------------------------------
//  时间(年/月/日)  版本   修改说明
//------------------------------------------------------------------  
//  2006/12/02       0.1   原始版本
//  
//------------------------------------------------------------------


module key
	(
		 CLK                                 	//CLK
		,nRST                               	//复位
		,Key_In					//键入
		,Key_Out                                //键扫输出
	);
//CLK
	input	CLK;
	input	nRST;
	
//控制接口
	input	Key_In;

//信号输出
	output	Key_Out;


// Wire Declaration
	wire	Key_Input;

// REG    
	reg	Key_Temp,Key_Ready,Key_Store;


// Integer Declaration

	
// Concurrent Assignment
	assign	Key_Out=Key_Ready & (~Key_Store);
	assign	Key_Input=~Key_In;

// Always Construct
	always @ (posedge CLK or negedge nRST)
	   	if(!nRST)
			begin
				Key_Temp<=0;
				Key_Ready<=0;
				Key_Store<=0;
			end
		else
			begin
	   			Key_Temp<=Key_Input;
	   			if(Key_Input==Key_Temp)	Key_Ready<=Key_Temp;
	   			Key_Store<=Key_Ready;
			end
			
endmodule

⌨️ 快捷键说明

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