LogicGate
LogicThe LogicGate block provides 4 fundamental logic operations in a single configurable block:
- AND - All inputs must be true (non-zero)
- OR - Any input must be true (non-zero)
- NOT - Invert the input (single input)
- XOR - Odd number of inputs must be true
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| → In | in |
Input | number | Required |
| ← Out | out |
Output | boolean | Output |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
operation |
Operation | select | AND |
|
numInputs |
Number of Inputs | number | 2 |
Usage 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).
Remarks & Best Practices
- Boolean convention: Non-zero = TRUE, zero = FALSE; use Comparator to convert analog signals to clean boolean values before logic gates
- Input count: AND, OR, and XOR support 1–10 inputs; NOT always uses exactly one input
- De Morgan's laws: NOT(AND(a,b)) = OR(NOT(a), NOT(b)) — useful for logic simplification and reducing gate count
- Cascading: Chain multiple LogicGate blocks to build complex combinatorial logic
- Single-input edge case: A single-input AND, OR, or XOR acts as a buffer (output = input ≠ 0)
Related Components
Comparator- Convert analog signals to booleanSwitch- Conditional routing based on logicAND,OR,NOT,XOR- Individual gate blocks (if using simpler circuits)