Sorry if my question if very novice. I want to have a simple logic circuitry with two inputs and one output. The state of the output should change if the state of any of the input changes.

enter image description here

The inputs constitute four different states [0, 0], [1, 0], [0, 1] and [1, 1]. The output should change form 0 to 1 (or vice-versa) if the current state of the inputs changes. Thanks for your help in advance.

  • 2
    \$\begingroup\$ You need to clarify the temporal aspects of your question. How often do you check for changes? What's the shortest change in state that we can ignore? Once a change occurs, how long before we no longer consider it a change? \$\endgroup\$ – Elliot Alderson Sep 19 '19 at 0:10

You describe the operation of an XOR gate - readily available as four two-input gates in one IC.


An XOR gate will output True if the outputs are different, and False if the inputs are the same. If the outputs are different, and one of them changes state, the output will also change state. Similarly, if the inputs are the same, and one changes state, the output will also change state.

Thinking harder, if both inputs change state at the same time, the output will not change. If that will happen, then an XOR gate won't meet your requirements.

  • \$\begingroup\$ no, it is not an XOR sir. XOR returns true when only one of the inputs are true. I want the state of the output to change upon any change in the outputs. for example, if the input is [0, 1] and the current state of the output is 1, if the input changes to [1, 1] the output changes to 0. \$\endgroup\$ – Foad Sep 18 '19 at 21:32
  • \$\begingroup\$ @Foad So long as only one input can change at a time (which is the only way your scenario makes sense), the only way to get to 11 (giving a zero out) would be to go through 10 or 01, both of which give a 1 output, so the XOR meets the criteria. Elegant solution! \$\endgroup\$ – Scott Seidman Sep 18 '19 at 21:37
  • \$\begingroup\$ 00 [output 0] can only change to 10[1] or 01[1], so there is an output change for either input change there, too. If this isn't what you want, I suggest you include timing diagrams to show the counter case. \$\endgroup\$ – Scott Seidman Sep 18 '19 at 21:39
  • 3
    \$\begingroup\$ @Foad, for the case of inputs changing from 00 to 11, practically we can't tell the difference between that situation and changing from 00 to 01 (for example) and then very quickly changing to 11, where "very quickly could be measured in fractions of a nanosecond. How much time after inputs change from 00 to 01 do you want to allow them to further change to 11 and still call it one change event rather than two? \$\endgroup\$ – The Photon Sep 18 '19 at 22:09
  • 1
    \$\begingroup\$ @Foad I think there is miscommunication here. The answer suggests an XOR between the current input and some "previous" input, not between the two bits in the current input. \$\endgroup\$ – Elliot Alderson Sep 19 '19 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.