题解 | #奇偶校验#
奇偶校验
https://www.nowcoder.com/practice/67d4dd382bb44c559a1d0a023857a7a6
`timescale 1ns/1ns
module odd_sel(
input [31:0] bus,
input sel,
output check
);
//*************code***********//
reg check;
always@(*)begin
if(sel)begin check=^bus; end
else begin check=~(^bus); end
end
//*************code***********//
endmodule
if相关的单句命令还是添加``` begin end ```比较好,有些地方可以不加,但是有些地方不加则会报错