真值表
选择输入输出s1 s0z0 z1 z2 z30 0c 1 1 10 11 c 1 11 01 1 c 11 11 1 1 c代码
module de_selector14(iC,iS1,iS0,oZ0,oZ1,oZ2,oZ3); input iC; input iS1; input iS0; output oZ0; output oZ1; output oZ2; output oZ3; reg oZ0,oZ1,oZ2,oZ3; initial {oZ0,oZ1,oZ2,oZ3}=4'b1111; always@(*) case({iS1,iS0}) 2'b00 : begin oZ0=iC; oZ1=1'b1; oZ2=1'b1; oZ3=1'b1; end 2'b01 : begin oZ0=1'b1; oZ1=iC; oZ2=1'b1; oZ3=1'b1; end 2'b10 : begin oZ0=1'b1; oZ1=1'b1; oZ2=iC; oZ3=1'b1; end 2'b11 : begin oZ0=1'b1; oZ1=1'b1; oZ2=1'b1; oZ3=iC; end endcase endmodule真值表
选择输入输出s1 s0z0 z1 z2 z30 0c 0 0 00 10 c 0 01 00 0 c 01 10 0 0 c代码
module de_selector14(iC,iS1,iS0,oZ0,oZ1,oZ2,oZ3); input iC; input iS1; input iS0; output oZ0; output oZ1; output oZ2; output oZ3; assign oZ0=~iS1 & ~iS0 & iC; assign oZ1=~iS1 & iS0 & iC; assign oZ2= iS1 & ~iS0 & iC; assign oZ3= iS1 & iS0 & iC; endmodule真值表
选择输入输出s1 s0z0 z1 z2 z30 0c x x x0 1x c x x1 0x x c x1 1x x x c代码 此处留白,作思考题。
反思 真值表的不同会影响verilog描述,因此需要认真考虑逻辑表达式,选择正确的结构,满足真值表的要求。