Logic

LogicGate Block

Logic gate selector: AND, OR, NOT, XOR with configurable inputs

Open LogicGate in BlockWerk →

# LogicGate Block Documentation

Overview

The LogicGate block provides 4 fundamental logic operations in a single configurable block:

Inputs

Outputs

Parameters

Operation

Type: Dropdown selector Default: AND Options:

Number of Inputs

Type: Number Default: 2 Range: 1-10 Note: Only used for AND, OR, XOR. NOT always uses 1 input.

Operation Definitions

AND - Logical AND

Truth table (2 inputs): | A | B | Output | |---|---|--------| | 0 | 0 | 0 | | 0 | 1 | 0 | | 1 | 0 | 0 | | 1 | 1 | 1 |

Definition: Output = 1 iff ALL inputs are non-zero

OR - Logical OR

Truth table (2 inputs): | A | B | Output | |---|---|--------| | 0 | 0 | 0 | | 0 | 1 | 1 | | 1 | 0 | 1 | | 1 | 1 | 1 |

Definition: Output = 1 iff ANY input is non-zero

NOT - Logical NOT

Truth table: | Input | Output | |-------|--------| | 0 | 1 | | ≠ 0 | 0 |

Definition: Output = 1 iff input = 0 (inverts signal)

XOR - Exclusive OR

Truth table (2 inputs): | A | B | Output | |---|---|--------| | 0 | 0 | 0 | | 0 | 1 | 1 | | 1 | 0 | 1 | | 1 | 1 | 0 |

Definition: Output = 1 iff ODD NUMBER of inputs are non-zero

Examples

Example 1: AND Gate (Dual Threshold)

Signal → Comparator(> 0.5) ⟶┐
                              ├→ LogicGate(AND) → Action
Signal → Comparator(> -0.5) ⟶┘

Output triggers only when BOTH conditions met simultaneously.

Example 2: OR Gate (Fault Detection)

Sensor1_Error ⟶┐
Sensor2_Error ├→ LogicGate(OR) → Alarm
Sensor3_Error ⟶┘

Output triggers if ANY sensor reports an error.

Example 3: NOT Gate (Signal Inversion)

Enable_Signal → LogicGate(NOT) → Disable_Signal

Inverts boolean state.

Example 4: XOR Gate (Parity Check)

Bit1 ⟶┐
Bit2 ├→ LogicGate(XOR, 3 inputs) → Odd_Parity_Check
Bit3 ⟶┘

Output = 1 if odd number of bits are set (error detection).

Common Use Cases

1. Condition checking: AND for all conditions must be true 2. Fault detection: OR for any error triggers alarm 3. Signal inversion: NOT to flip boolean logic 4. Parity checking: XOR for error detection in data 5. State machines: Combine gates to build complex logic 6. Safety interlocks: AND gate for multiple safety conditions 7. Redundancy: OR gate for multiple independent triggers

Behavior Notes

Number of Inputs Configuration

Edge Cases

De Morgan's Laws

Useful for logic simplification:

Can be implemented by combining LogicGate blocks.

Comparison with Comparator

Remarks

See Also