always @(posedge clk or negedge rst_n)begin
if(rst_n==1'b0)begin
dout <= 0;
end
else if(en1==1 || en2==1)begin
dout <= 1;
end
else if(end_cnt)begin
dout <= 0;
end
end
always @(posedge clk or negedge rst_n)begin
if(rst_n==1'b0)begin
flag_sel <= 0;
end
else if(en2==1)begin
flag_sel <= 1;
end
else if(en1==1)begin
flag_sel <= 0;
end
end
always @(*)begin
if(flag_sel==0)
x = 3;
else
x = 2;
end