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

📄 datecontrol.v

📁 一些很好的FPGA设计实例
💻 V
字号:
module datecontrol(clk, //时钟输入
                   Date_EN, //日期显示使能信号
                   EN1,//自动工作模式状态信号
                   auto_month1,auto_month0,auto_day1,auto_day0,//自动工作模式的日期
                   EN2,//设置与调整日期使能信号
                   set_month1,set_month0,set_day1,set_day0,//设置的日期
                   disp_drive,//设置过程中的闪烁显示驱动
                   month1,month0,day1,day0,//需要显示的日期
                   disp_select//显示的位选信号
                   );

output [3:0] month1,month0,day1,day0;
output [5:0] disp_select;
input  clk,Date_EN;
input  EN1,EN2;
input  [3:0] auto_month1,auto_month0,auto_day1,auto_day0;
input  [3:0] set_month1,set_month0,set_day1,set_day0;
input  [1:0] disp_drive;

reg [3:0] month1,month0,day1,day0;
reg [5:0] disp_select;
reg [1:0] auto_disp_drive;//主要是为了分时显示
// 实现日期自动运行模式与日期设置模式的切换控制
always @(posedge clk)
begin
  if((EN1 == 1'b1)&&(Date_EN == 1'b1))
  begin
    month1 <= auto_month1;
    month0 <= auto_month0;
    day1   <= auto_day1;
    day0   <= auto_day0;
    if(auto_disp_drive != 2'b11)
	  auto_disp_drive = auto_disp_drive + 2'b1;
	case(auto_disp_drive)
	  2'b00:   disp_select <= 6'b100000;
	  2'b01:   disp_select <= 6'b010000;
	  2'b10:   disp_select <= 6'b001000;
	  2'b11:   disp_select <= 6'b000100;
	  default: disp_select <= 6'b000000;
	endcase
  end
  else if(EN2 == 1'b1)
  begin
    month1 <= set_month1;
    month0 <= set_month0;
    day1   <= set_day1;
    day0   <= set_day0;
    case(disp_drive)
	  2'b00:   disp_select <= 6'b100000;
	  2'b01:   disp_select <= 6'b010000;
	  2'b10:   disp_select <= 6'b001000;
	  2'b11:   disp_select <= 6'b000100;
	  default: disp_select <= 6'b000000;
	endcase
  end
end
endmodule

⌨️ 快捷键说明

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