From 111859312b06f3c546a2dac2f9b52c304ed97ff8 Mon Sep 17 00:00:00 2001 From: xingchen <1098756313@qq.com> Date: Fri, 25 Sep 2026 11:57:26 +0800 Subject: [PATCH] feat: add rtl/error_counters.sv --- rtl/error_counters.sv | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 rtl/error_counters.sv diff --git a/rtl/error_counters.sv b/rtl/error_counters.sv new file mode 100644 index 0000000..037f4d7 --- /dev/null +++ b/rtl/error_counters.sv @@ -0,0 +1,12 @@ +module error_counters ( + input logic clk, rst_n, length_error, parity_error, + output logic [15:0] length_count, parity_count +); + always_ff @(posedge clk or negedge rst_n) begin + if (!rst_n) begin length_count <= '0; parity_count <= '0; end + else begin + if (length_error && length_count != 16'hffff) length_count <= length_count + 1'b1; + if (parity_error && parity_count != 16'hffff) parity_count <= parity_count + 1'b1; + end + end +endmodule