`timescale 1ns/1ns module odd_sel( input [31:0] bus, input sel, output check ); //*************code***********// assign check = sel ? (^bus) : ~(^bus); //*************code***********// endmodule
先阐述奇偶校验的类型 :
奇校验odd parity : 数据中的1的个数加上校验位之后 , 总数为奇数;
偶校验even parity : 数据中的1的个数加上校验位之后 , 总数为偶数 ;
再看题目的波形示意图 ,
sel =1 , 奇校验 , bus =1 , check为 1..