哪位大侠看看问题出在哪里 只能显示个位 十位显示不出来
module led_display(sys_clk ,
sys_rstn,sm_cs,
sm_db
);
input sys_clk;
input sys_rstn;
output [3:0] sm_cs;
output [6:0] sm_db;
reg [3:0] gewei ;
reg [3:0] shiwei ;
reg [25:0] delay_cnt;
reg [3:0] num;
reg [6:0] sm_dbr;
parameter
seg0 = 7'hc0,
seg1 = 7'hf9,
seg2 = 7'ha4,
seg3 = 7'hb0,
seg4 = 7'h99,
seg5 = 7'h92,
seg6 = 7'h82,
seg7 = 7'hf8,
seg8 = 7'h80,
seg9 = 7'h90;
always@(posedge sys_clk or negedge sys_rstn)
begin
if(!sys_rstn)
delay_cnt<=26'd0;
else
begin
if(delay_cnt==26'd4999999)
delay_cnt<=26'd0;
else
delay_cnt<=delay_cnt+1'b1;
end
end
always@(posedge sys_clk or negedge sys_rstn)
begin
if (!sys_rstn)
gewei<=4'd0;
else
begin
if(delay_cnt==26'd4999999)
gewei<=gewei+1'd1;
else if(gewei==4'd10)
gewei=4'd0;
else
gewei<=gewei;
end
end
always@(posedge sys_clk or negedge sys_rstn)
begin
if (!sys_rstn)
shiwei<=4'd0;
else
begin
if(gewei==4'd10)
shiwei<=shiwei+1'd1;
else if (shiwei==4'd7)
shiwei<=4'd0;
else
shiwei<=shiwei;
end
end
always @(num)
case(num)
4'h0:sm_dbr<=seg0;
4'h1:sm_dbr<=seg1;
4'h2:sm_dbr<=seg2;
4'h3:sm_dbr<=seg3;
4'h4:sm_dbr<=seg4;
4'h5:sm_dbr<=seg5;
4'h6:sm_dbr<=seg6;
4'h7:sm_dbr<=seg7;
4'h8:sm_dbr<=seg8;
4'h9:sm_dbr<=seg9;
default:;
endcase
reg sm_cs1_r;
reg sm_cs2_r;
always @(sys_clk or shiwei or gewei)
begin
if(delay_cnt==26'd10000000)
begin
sm_cs1_r = 0;
sm_cs2_r = 1;
num = shiwei;
end
else
begin
sm_cs1_r = 1;
sm_cs2_r = 0;
num = gewei;
end
end
assign sm_db = sm_dbr;
assign sm_cs[1:0] = 2'b11;
assign sm_cs[3] = sm_cs1_r;
assign sm_cs[2] = sm_cs2_r;
endmodule