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