From f86cecafda65e63da711f3062f3887fe8a79130f Mon Sep 17 00:00:00 2001 From: xingchen <1098756313@qq.com> Date: Fri, 25 Sep 2026 11:57:27 +0800 Subject: [PATCH] feat: add rtl/parity_accumulator.sv --- rtl/parity_accumulator.sv | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 rtl/parity_accumulator.sv diff --git a/rtl/parity_accumulator.sv b/rtl/parity_accumulator.sv new file mode 100644 index 0000000..eea364a --- /dev/null +++ b/rtl/parity_accumulator.sv @@ -0,0 +1,11 @@ +module parity_accumulator ( + input logic clk, rst_n, clear, enable, + input logic [7:0] data, + output logic parity +); + always_ff @(posedge clk or negedge rst_n) begin + if (!rst_n) parity <= 1'b0; + else if (clear) parity <= 1'b0; + else if (enable) parity <= parity ^ (^data); + end +endmodule