BusXOR (Bus XOR)
Inputs
| Pin | Type | Description |
|---|---|---|
| A | bus8 | First input bus (8 bits) |
| B | bus8 | Second input bus (8 bits) |
Outputs
| Pin | Type | Description |
|---|---|---|
| Q | bus8 | Bitwise XOR: A ^ B |
How It Works
Each output bit is 1 only if the two corresponding input bits differ. Equal bits produce 0.
| A Bit | B Bit | Q Bit |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Usage
Toggling bits: XOR with 0xFF inverts all bits (same as BusNOT). XOR with a mask where bit N = 1 toggles only bit N.
Equality check: If A ^ B = 0, then A = B. Feed XOR output into a BusZero detector to test equality.
Simple encryption: XOR a value with a secret key to obscure it. XOR again with the same key to restore the original. A ^ K ^ K = A.