Untitled
unknown
plain_text
2 years ago
765 B
6
Indexable
//////////////////////////////////////////////////////////////////////////////
//
// author: Stevo Bailey (stevo.bailey@gmail.com)
//
// Parity Checker
//
// Checks parity bit against the data.
//////////////////////////////////////////////////////////////////////////////
module stv_parity_check #(
// input data type
parameter type DTYPE = logic[7:0]
) (
// if 1, generate even parity, otherwise generate odd parity
input logic even,
// input data
input DTYPE data,
// input parity
input logic parity,
// output parity good signal, high if parity check passes, otherwise low
output logic good
);
logic exp_parity;
always_comb begin
exp_parity = even ^ (^data);
good = parity == exp_parity;
end
endmodule : stv_parity_checkEditor is loading...
Leave a Comment