智能赛道计时器设计
任务分析:
任务要求设计一个智能赛道计时器,基本功能如下:
(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