always @(posedge clk or negedge rst) begin if (rst) cnt_en <= 1'b0 ; else if (!arm_cs && !arm_wr) begin case (arm_addr) 3'b000 : cnt_en <= arm_data[0] ; 3'b001 : cnt_en <= arm_data[1] ; default : cnt_en <= 1'b0 ; endcase end end
reg [3:0]cnt ; always @(posedge clk or negedge rst) begin if (!rst) cnt <= 3'b000 ; else if (cnt_en) cnt <= cnt + 1 ; end always @(posedge clk or negedge rst) begin if (!rst) test_en <= 1'b0 ; else test_en <= cnt[2] ; end