题解 | #奇偶校验#
奇偶校验
http://www.nowcoder.com/practice/67d4dd382bb44c559a1d0a023857a7a6
/*答案有问题,是反的。 其次,通过这道题,学习了^的用法:可以利用^A来实现判断A中1的个数的奇偶性。 参考资料:https://blog.csdn.net/Reborn_Lee/article/details/89813335 */
`timescale 1ns/1ns module odd_sel( input [31:0] bus, input sel, output check ); //**code// reg [32:0]reg1; reg check1; always @ (*) begin reg1<={~bus,sel}; check1<=^reg1; end assign check = ~check1; //**code// endmodule