1 Verilog描述
module bjq3_casex(
input a,
input b,
input c,
output reg out
);
always@(a or b or c)begin
casex({a,b,c
3'b00x: out = 1'b0; //有2个0,不需要考虑第三个
3'b01x: out = c; //有1个1和1个0,表决结果取决第三个
3'b10x: out = c;
3'b11x: out = 1'b1;
default: out = 1'bz;
endcase
end
endmodule
2 功能仿真