Components / Arithmetic
Negator Component in Logisim
Computes the N-bit two's complement arithmetic negation (-A = ~A + 1) of its input bus.
| Library | Arithmetic |
|---|---|
| Type name | Negator |
| Pins and defaults | in0 A (-40, 0), out0 -A (0, 0), width 4 (1..32) |
How the Negator Works in Logisim
The Negator computes the two's complement additive inverse (-A) of an N-bit input (default width = 4 bits) by inverting every bit and adding 1 (-A = ~A + 1 mod 2^N).
For example, on a 4-bit bus, an input of 0001 (+1) produces 1111 (-1, or 0xF), and 0011 (+3) produces 1101 (-3, or 0xD). Zero (0000) maps to 0000, while the most negative two's complement number (1000 = -8 in 4 bits) wraps back to 1000.
Tip: Use a Negator instead of a NOT Gate when you need true arithmetic negation (-A = ~A + 1) rather than bitwise ones' complement (~A).
Negator Pins & Pinout
| Pin | Direction | Width | Location & Role |
|---|---|---|---|
| in0 (A) | Input (Left edge) | 1–32 bits (default 4) | Offset (-40, 0). N-bit two's complement value to negate. |
| out0 (-A) | Output (Right edge) | 1–32 bits (default 4) | Offset (0, 0). Outputs (-A) mod 2^N = (~A + 1). |
Negator Truth Table & Behavior
| Input A (Binary / Hex) | Signed Value | Output -A (Binary / Hex) | Signed Output |
|---|---|---|---|
| 0000 (0x0) | 0 | 0000 (0x0) | 0 |
| 0001 (0x1) | +1 | 1111 (0xF) | -1 |
| 0011 (0x3) | +3 | 1101 (0xD) | -3 |
| 1110 (0xE) | -2 | 0010 (0x2) | +2 |