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

📄 statmach.v

📁 12MCS-51单片机原理与应用实例. 下一篇: 可编程控制器技术及应用(三菱系列). 上一篇: C51单片机应用与C语言程序设计--基于机器人工程对象的项目实践. Tags标签 ... www.r
💻 V
字号:
// MAX+plus II Verilog Example
// State Machine
// Copyright (c) 1997 Altera Corporation

module statmach(clk, in, reset, out);
   input clk, in, reset;
   output out;

   reg out;
   reg state;

   parameter s0 = 0, s1 = 1;

   always @(state) 
   begin
	case (state)
		s0:
			out = 0;
		s1:
			out = 1;
		default:
			out = 0;
	endcase
   end

   always @(posedge clk or posedge reset)
   begin
	if (reset)
		state = s0;
	else
		case (state)
			s0:
				state = s1;
			s1:
				if (in)
					state = s0;
				else
					state = s1;
		endcase
   end

endmodule

⌨️ 快捷键说明

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