题解 | #奇偶校验#
奇偶校验
http://www.nowcoder.com/practice/67d4dd382bb44c559a1d0a023857a7a6
`timescale 1ns/1ns module odd_sel( input [31:0] bus, input sel, output check ); //*************code***********//coments: //同四选一,输出是wire用assign赋值语句; //采用always就需要找个中间变量 // assign check=sel? (^bus):(~^bus);//assign赋值语句 wire check_temp; assign check_temp=^bus; reg check_reg; always@(*)begin if (sel)begin check_reg=check_temp; end else begin check_reg=~check_temp; end end assign check =check_reg; //*************code***********// endmodule

联想公司福利 1548人发布