always @(posedge clk ornegedge rst_n) begin if(!rst_n) begin counter_p <= 'b0; endelseif (clk_div_p) begin if (counter_p == DIV_P-1) begin counter_p <= 'b0; endelsebegin counter_p <= counter_p + 1'b1; end endelsebegin if (counter_p == DIV_N-1) begin counter_p <= 'b0; endelsebegin counter_p <= counter_p + 1'b1; end end end
always @(negedge clk ornegedge rst_n) begin if(!rst_n) begin counter_n <= 'b0; endelseif (clk_div_n) begin if (counter_n == DIV_P-1) begin counter_n <= 'b0; endelsebegin counter_n <= counter_n + 1'b1; end endelsebegin if (counter_n == DIV_N-1) begin counter_n <= 'b0; endelsebegin counter_n <= counter_n + 1'b1; end end end
always @(posedge clk ornegedge rst_n) begin if(!rst_n) begin clk_div_p <= 1'b0; endelseif (clk_div_p) begin if (counter_p == DIV_P-1) begin clk_div_p <= 1'b0; end endelsebegin if (counter_p == DIV_N-1) begin clk_div_p <= 1'b1; end end end
always @(negedge clk ornegedge rst_n) begin if(!rst_n) begin clk_div_n <= 1'b0; endelseif (clk_div_n) begin if (counter_n == DIV_P-1) begin clk_div_n <= 1'b0; end endelsebegin if (counter_n == DIV_N-1) begin clk_div_n <= 1'b1; end end end