1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | always @(posedge clk or negedge rst_n)begin if(rst_n==1'b0)begin shi_ge <= 0 ; end else if(((set_flag == 1'b1 && set_sel == 4)&& (key_vld == 1 && key_num == 4'b0010)) || shi_ge_add)begin if(shi_shi ==2 && shi_ge == 3)begin shi_ge <= 0 ; end else if((shi_shi == 0 || shi_shi ==1) && shi_ge == 9)begin shi_ge <= 0 ; end else begin shi_ge <= shi_ge + 1 ; end end end |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | always @(posedge clk or negedge rst_n)begin if(!rst_n)begin cnt <= 0; end else if(add_cnt)begin if(end_cnt) cnt <= 0; else cnt <= cnt + 1; end end assign add_cnt = ; assign end_cnt = add_cnt && cnt== ; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | always @(posedge clk or negedge rst_n)begin if(!rst_n)begin cnt <= 0; end else if(add_cnt)begin if(end_cnt) cnt <= 0; else cnt <= cnt + 1; end end assign add_cnt =((set_flag == 1'b1 && set_sel == 4)&& (key_vld == 1 && key_num == 4'b0010)) || shi_ge_add ; assign end_cnt = add_cnt && cnt== x-1 ; always @(*)begin if(shi_s == 2) x = 4 ; else x = 10 ; end |