开发者

Can this boolean expression be simplified?

(A Or B开发者_JAVA技巧) And Not (A And B)


You're looking for a XOR, depending on the language it may be a single operation.


It is XOR (See table below).

A B (A|B) (A&B) !(A&B) (A|B)&(!(A&B))
T T   T     T      F        F
T F   T     F      T        T
F T   T     F      T        T
F F   F     F      T        F

You can also use not equal operation like (A != B).

Hope this helps.


isn't this just an exclusive or? sometimes indicated by this syntax: A ^ B


If you have Xor or equality in your atomic operations, yes, it is exactly the former or the negation of the latter.


As others have said, this is an XOR. Note that the best ways to solve this are either a logic table as NawaMan used, or with a Karnaugh map. In EE, Karnaugh maps are more common since they lend themselves more readily to complex expressions with multiple inputs.

If you're implementing this in hardware, Karnaugh maps are nearly always the best way to go as they give you the minimum number of gates required to implement the required outputs. Also, unlike in software, you may not have an xor gate available in hardware, but each gate can be expressed as a combination of other gates. AND can be made from NAND, etc, which will increase the number of gates required but can reduce the cost of your device.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜