FPGA课程设计:智能赛道计时器

news/2024/11/22 20:10:24/

智能赛道计时器设计

任务分析:
任务要求设计一个智能赛道计时器,基本功能如下:
(1)分、秒及百分秒(0.01s)计时和显示。
(2)具有启动功能,启动信号有效,开始计时;5个停止计时按键,按下按键即停止相应赛道的计时。
(3)对5个赛道选手排名,并具备成绩显示功能。
(4)具有清零功能,当复位归零信号有效时,显示全部为零。

第一次独立完成一个小设计,代码比较繁杂。

//智能赛道计时器
//智能赛道计时器
module SDJSQ (input clk,            //系统时钟50MHZinput start,          //启动按键input clr,            //复位清零按键input mode,           //显示模式选择input [2:0] key,      //三个赛道output reg [5:0] wei, //数码管位选output reg [7:0] duan //数码管段选);reg clk_key;             //按键时钟reg [4:0]  cnt_key;      //按键延时计数器
reg [12:0] cnt_10ns;     //时钟计数器,满50000为10ns    
reg [18:0] cnt_ms;       //时钟计数器,满500000为1ms
reg [1:0]  cnt_rank;     //完赛计数器reg [1:0]  rank;         //选手排名
reg [1:0]  num;          //选手赛道信号
reg [6:0]  msdata;       //毫秒数据
reg [5:0]  sdata;        //秒数据reg [1:0]  rank_1;         //第一名排名信号
reg [1:0]  num_1;          //选手赛道信号
reg [6:0]  msdata_1;       //1号赛道-毫秒数据
reg [5:0]  sdata_1;        //1号赛道-秒数据reg [1:0]  rank_2;         //第一名排名信号
reg [1:0]  num_2;          //选手赛道信号
reg [6:0]  msdata_2;       //1号赛道-毫秒数据
reg [5:0]  sdata_2;        //1号赛道-秒数据reg [1:0]  rank_3;         //第一名排名信号
reg [1:0]  num_3;          //选手赛道信号
reg [6:0]  msdata_3;       //1号赛道-毫秒数据
reg [5:0]  sdata_3;        //1号赛道-秒数据reg [1:0]  rank_rom;       //排名缓存寄存器
reg [1:0]  num_rom;        //赛道缓存寄存器
reg [6:0]  msdata_rom;     //毫秒寄存器
reg [5:0]  sdata_rom;      //秒寄存器reg [1:0]  dis_num;      //赛道显示
reg [1:0]  dis_rank;     //排名显示reg [2:0]  weixuan;      //数码管位选
reg [3:0]  duanxuan;     //数码管段选reg [2:0] flag_paixu;    //成绩排序标志位
reg [1:0] flag_mode;     //显示模式识别标志
reg flag_time;           //最终时间标志位      
reg flag;                //启动暂停标志位//5毫秒按键消抖模块
always@(posedge clk or negedge clr) beginif (!clr) cnt_key <= 5'b0;else if(cnt_ms == 19'd12499)cnt_key <= cnt_key + 1'b1;else if(cnt_key == 5'd20) begin	clk_key <= ~clk_key;cnt_key <= 5'b0;end
end	//毫秒计时模块
always @(posedge clk or negedge clr ) beginif (!clr)cnt_ms <= 1'b0;else if (cnt_ms == 19'd499999) cnt_ms <= 1'b0;elsecnt_ms <= cnt_ms + 1'b1;
end//纳秒计时模块模块
always @(posedge clk or negedge clr ) beginif (!clr)cnt_10ns <= 1'b0;else if (cnt_10ns == 16'd4999)cnt_10ns <= 1'b0;elsecnt_10ns <= cnt_10ns + 1'b1;
end//计时器模块
always @(posedge clk or negedge clr) beginif (!clr) beginmsdata <= 7'd0;sdata  <= 6'd0;endelse if(cnt_ms == 19'd499999 && flag == 1'b1 && flag_time == 1'b0)msdata <= msdata + 1'b1;else if(msdata == 7'd100) beginmsdata <= 7'd0;sdata <= sdata + 1'b1;endelse if(sdata == 6'd60) sdata <= 6'd0;
end//完赛模块
always @(posedge clk_key or negedge clr) begin if (!clr) begincnt_rank <= 2'd0;num      <= 2'd0;endelse if(key == 3'b011) begin num = 2'd1;		num_1 = 2'd1;case (cnt_rank)2'd0: begin cnt_rank <= 2'd1; rank_1 <= 2'd1; end2'd1: begin cnt_rank <= 2'd2; rank_1 <= 2'd2; end2'd2: begin cnt_rank <= 2'd3; rank_1 <= 2'd3; end2'd3: begin cnt_rank <= 2'd0; rank_1 <= 2'd0; endendcaseendelse if (key == 3'b101) beginnum = 2'd2; num_2 = 2'd2;			case (cnt_rank)2'd0: begin cnt_rank <= 2'd1; rank_2 <= 2'd1; end2'd1: begin cnt_rank <= 2'd2; rank_2 <= 2'd2; end2'd2: begin cnt_rank <= 2'd3; rank_2 <= 2'd3; end2'd3: begin cnt_rank <= 2'd0; rank_2 <= 2'd0; endendcaseendelse if (key == 3'b110) beginnum = 2'd3; num_3 = 2'd3;case (cnt_rank)2'd0: begin cnt_rank <= 2'd1; rank_3 <= 2'd1; end2'd1: begin cnt_rank <= 2'd2; rank_3 <= 2'd2; end2'd2: begin cnt_rank <= 2'd3; rank_3 <= 2'd3; end2'd3: begin cnt_rank <= 2'd0; rank_3 <= 2'd0; endendcaseend
end//数据存储模块
always @(posedge clk_key ) beginif (key == 3'b011) beginmsdata_1 <= msdata;sdata_1  <= sdata;endelse if (key == 3'b101) beginmsdata_2 <= msdata;sdata_2  <= sdata;endelse if (key == 3'b110) beginmsdata_3 <= msdata;sdata_3  <= sdata;end		
end//数据排序模块
always @(posedge clk) beginif      (sdata_1 < sdata_2 && sdata_1 < sdata_3 && sdata_2 < sdata_3) flag_paixu <= 3'd1;else 	if(sdata_1 < sdata_2 && sdata_1 < sdata_3 && sdata_3 < sdata_2) flag_paixu <= 3'd2;else 	if(sdata_2 < sdata_3 && sdata_2 < sdata_1 && sdata_1 < sdata_3) flag_paixu <= 3'd3;else 	if(sdata_2 < sdata_3 && sdata_2 < sdata_1 && sdata_3 < sdata_1) flag_paixu <= 3'd4;else 	if(sdata_3 < sdata_2 && sdata_3 < sdata_1 && sdata_2 < sdata_1) flag_paixu <= 3'd5;else 	if(sdata_3 < sdata_2 && sdata_3 < sdata_1 && sdata_1 < sdata_2) flag_paixu <= 3'd6;
end//模式切换模块
always @(posedge clk_key or negedge clr) beginif (!clr) flag_mode <= 2'd0;else if (mode == 1'b0) begincase (flag_mode)2'd0 : flag_mode <= 2'd1;2'd1 : flag_mode <= 2'd2;2'd2 : flag_mode <= 2'd3;2'd3 : flag_mode <= 2'd1;endcaseend
end//暂停模块
always @(posedge clk) begin if(cnt_rank == 2'd3)flag_time <= 1'b1;else flag_time <= 1'b0;
end//开始及启动模块
always @(negedge start or negedge clr) beginif (!clr)flag <= 1'b0;else if (!start)flag <= 1'b1;
end//数码管位选扫描
always @(posedge clk or negedge clr) beginif (!clr)weixuan <= 3'd0;else if (weixuan == 3'd6)weixuan <= 3'd0;else if(cnt_10ns == 16'd4999 && flag == 1'b1 )weixuan <= weixuan + 3'b1;
end//数码管显示模块
always @(posedge clk) beginif (flag_paixu == 3'd1) beginif (flag_mode == 2'd0)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (cnt_rank[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd1)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_1%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_1%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_1[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_1[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd2)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_2%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_2%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_2[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_2[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd3)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_3%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_3%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_3[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_3[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseendelse if (flag_paixu == 3'd2) beginif (flag_mode == 2'd0)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (cnt_rank[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd1)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_1%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_1%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_1[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_1[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd3)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_2%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_2%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_2[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_2[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd2)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_3%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_3%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_3[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_3[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseendelse if (flag_paixu == 3'd3) beginif (flag_mode == 2'd0)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (cnt_rank[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd2)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_1%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_1%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_1[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_1[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd1)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_2%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_2%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_2[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_2[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd3)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_3%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_3%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_3[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_3[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseendelse if (flag_paixu == 3'd4) beginif (flag_mode == 2'd0)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (cnt_rank[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd2)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_1%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_1%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_1[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_1[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd3)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_2%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_2%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_2[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_2[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd1)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_3%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_3%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_3[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_3[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseendelse if (flag_paixu == 3'd5) begin if (flag_mode == 2'd0)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (cnt_rank[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd3)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_1%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_1%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_1[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_1[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd2)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_2%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_2%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_2[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_2[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd1)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_3%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_3%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_3[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_3[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseendelse if (flag_paixu == 3'd6) beginif (flag_mode == 2'd0)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (cnt_rank[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd3)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_1%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_1%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_1/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_1[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_1[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd1)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_2%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_2%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_2/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_2[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_2[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseelse if (flag_mode == 2'd2)case(weixuan[2:0])3'd0:begin wei <= 6'b011111;	case (msdata_3%10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd1:begin wei <= 6'b101111;	case (msdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend	3'd2:begin wei <= 6'b110111;	case (sdata_3%10)4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		4'd4:duan <= 8'h19;		4'd5:duan <= 8'h12;		 4'd6:duan <= 8'h02;		4'd7:duan <= 8'h78;		4'd8:duan <= 8'h00;		4'd9:duan <= 8'h10;		endcaseend3'd3:begin wei <= 6'b111011;	case (sdata_3/10)4'd0:duan <= 8'hc0;		4'd1:duan <= 8'hf9;	 	4'd2:duan <= 8'ha4;		4'd3:duan <= 8'hb0;		4'd4:duan <= 8'h99;		4'd5:duan <= 8'h92;		 4'd6:duan <= 8'h82;		4'd7:duan <= 8'hf8;		4'd8:duan <= 8'h80;		4'd9:duan <= 8'h90;		endcaseend3'd4:begin wei <= 6'b111101;	case (num_3[1:0])4'd0:duan <= 8'h40;		4'd1:duan <= 8'h79;	 	4'd2:duan <= 8'h24;		4'd3:duan <= 8'h30;		endcaseend	3'd5:begin wei <= 6'b111110;	case (rank_3[1:0])2'd0:duan <= 8'h40;		2'd1:duan <= 8'h79;	 	2'd2:duan <= 8'h24;		2'd3:duan <= 8'h30;		endcaseendendcaseend
endendmodule	

http://www.ppmy.cn/news/546577.html

相关文章

自定义 View 实现扫描效果

演示效果如下&#xff1a; 实现内容&#xff1a; 控制动画是竖向或者横向控制动画初始是从底部/左边开始&#xff0c;或者从上边/右边开始控制动画的时常可以自定义动画素材 具体实现&#xff1a; 自定义属性&#xff1a; <declare-styleable name"ScanView"…

基于FPGA的数字时钟的设计课设(HUAT)

目录 前言 一、数字时钟课设目标 二、部分代码 1.clock.v代码的编写 2.完整代码 3.仿真代码 总结 前言 学校黄老师的FPGA的设计课设&#xff0c;最后的课设为数字时钟&#xff0c;实现分时的计数功能&#xff0c;带有整点报时&#xff0c;按键调节的功能&#xff0c;供电子类学…

Verilog 实现数码管显视驱动【附源码】

目录 1、实验平台2、实验目的2.1、实验内容 3、实验流程3.1、实验原理3.2、系统架构3.3、功能模块划分3.3.1、数据产生模块模块框图信号定义设计文件 3.3.2、数码管驱动模块模块框图信号定义设计文件 3.3.3、顶层文件 3.4、板级验证 4、总结 1、实验平台 软件&#xff1a;PC、…

运行报错:java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:975): can

游戏编译的时候不报错&#xff0c;运行的时候报了如下的错误&#xff1a; &#xff08;主要是Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "rand" referenced by "libgameshared.so"...&#xff09; 10-31 12:35:59.667…

八段数码管动态显示(输入数据为BCD编码)

八段数码管动态显示(输入数据为BCD编码) 一、数码管概述 图1 八段共阴数码管内部等效原理图 图2 八段共阳数码管内部等效原理图 上面两图分别是对应八段共阴、共阳的数码管内部等效图&#xff0c;共阴是将八个LED数码管的阴极连接在一起接低&#xff0c;阳极segment信号只需要…

【接口时序】5、QSPI Flash的原理与QSPI时序的Verilog实现(转载)https://www.cnblogs.com/liujinggang/p/9651170.html

一、 软件平台与硬件平台 软件平台&#xff1a; 1、操作系统&#xff1a;Windows-8.1 2、开发套件&#xff1a;ISE14.7 3、仿真工具&#xff1a;ModelSim-10.4-SE 4、Matlab版本&#xff1a;Matlab2014b/Matlab2016a 硬件平台&#xff1a; 1、 FPGA型号&#xff1a;Xilinx公司的…

【边学边记_10】——8 位7段数码管的动态显示

数码管的驱动设计与验证 一、数码管驱动原理 其中 8 段数码管的结构图如下图所示 由上图可以看出数码管有两种结构&#xff1a;共阴极与共阳极。这两者的区别在于&#xff0c;公共端是连接到地还是高电平&#xff0c;对于共阴数码管需要给对应段以高电平才会使其点亮&#x…

tensorflow安装测试教程【一文读懂】

&#x1f947; 版权: 本文由【墨理学AI】原创首发、各位读者大大、敬请查阅、感谢三连 &#x1f389; 声明: 作为全网 AI 领域 干货最多的博主之一&#xff0c;❤️ 不负光阴不负卿 ❤️ &#x1f34a; 精选专栏&#xff0c;环境搭建&#xff0c;一文读懂&#xff1a; 每篇博文…