请问下 为什么我这么改了还是无法计数。。。
/*************************************/
reg [3:0] cs_ge;
reg [3:0] cs_shi;
reg [3:0] cs_bai;
reg [3:0] cs_qian;
always@(posedge clk1)
if (!rst) en=0;
else
if (en==27000000)
en=0;
else
en=en+1;
always@(posedge clk1)
begin
if(cs_ge>9)
cs_ge<=0;
else if (en==0)
cs_ge<=cs_ge+1;
else
cs_ge<=cs_ge;
end
always@(posedge clk1)
begin
if(cs_shi>9)
cs_shi=0;
else if((cs_ge==9)&(en==0))
cs_shi=cs_shi+1;
else
cs_shi=cs_shi;
end
always@(posedge clk1)
begin
if(cs_bai>9)
cs_bai=0;
else if ((cs_ge==9)&(cs_shi==9)&(en==0))
cs_bai=cs_bai+1;
else
cs_bai=cs_bai;
end
always@(posedge clk1)
begin
if (cs_qian==9)cs_qian=0;
else if((cs_ge==9)&(cs_shi==9)&(cs_bai==9)&(en==0))
cs_qian=cs_qian+1;
else
cs_qian=cs_qian;
end
/***************************************/
smg m1(.hex11(hex001),.clkk(clk1),.smg_zhi(cs_qian),.rstt(rst));
smg m2(.hex11(hex002),.clkk(clk1),.smg_zhi(cs_bai),.rstt(rst));
smg m3(.hex11(hex003),.clkk(clk1),.smg_zhi(cs_shi),.rstt(rst));
smg m4(.hex11(hex004),.clkk(clk1),.smg_zhi(cs_ge),.rstt(rst));
/***************************************/
endmodule
module smg(hex11,clkk,smg_zhi,rstt);
input rstt;
output hex11;
wire hex11;
reg [6:0]hex;
input clkk;
assign hex11=hex;
parameter seg0=~7'h3f,
seg1=~7'h06,
seg2=~7'h5b,
seg3=~7'h4f,
seg4=~7'h66,
seg5=~7'h6d,
seg6=~7'h7d,
seg7=~7'h07,
seg8=~7'h7f,
seg9=~7'h6f,
sega=~7'h77,
segb=~7'h7c,
segc=~7'h39,
segd=~7'h5e,
sege=~7'h79,
segf=~7'h71;
input [6:0] smg_zhi;
always @ (posedge clkk or negedge rstt )
if(!rstt) hex<=seg1;
else
case (smg_zhi)
4'd0:hex=seg0;
4'd1:hex=seg1;
4'd2:hex=seg2;
4'd3:hex=seg3;
4'd4:hex=seg4;
4'd5:hex=seg5;
4'd6:hex=seg6;
4'd7:hex=seg7;
4'd8:hex=seg8;
4'd9:hex=seg9;
endcase
endmodule