Logical_XNOR Logical_XNOR Icon

LogicGates.Logical_XNOR

Logical_XNOR(; name, abs_tol=1e-3, target_value=0.0)

A logical XNOR (exclusive NOR) operation component for two real-valued input signals.

Parameters

  • abs_tol: Absolute tolerance for comparing inputs to target value (default: 1e-3)
  • target_value: Reference value for comparison (default: 0.0)

Variables

  • u1(t): First input signal (placement: left side, upper)
  • u2(t): Second input signal (placement: left side, lower)
  • y(t): Output signal (placement: right side)

Description

Performs exclusive NOR operation: output is 0.0 (true) when both inputs have same state (both close or both not close to target), and 1.0 (false) when they differ. Inverse of XOR.

Usage

PrimitiveComponents.LogicGates.Logical_XNOR(abs_tol=1e-3, target_value=0.0)

Parameters:

NameDescriptionUnitsDefault value
abs_tol0.001
target_value0

Connectors

  • u1 - This connector represents a real signal as an input to a component (RealInput)
  • y - This connector represents a real signal as an output from a component (RealOutput)
  • u2 - This connector represents a real signal as an input to a component (RealInput)

Variables

NameDescriptionUnits
c1
c2

Behavior

\[ \begin{align} \mathtt{c1}\left( t \right) &= check\_with\_target\_value\left( \mathtt{u1}\left( t \right), \mathtt{target\_value}, \mathtt{abs\_tol} \right) \\ \mathtt{c2}\left( t \right) &= check\_with\_target\_value\left( \mathtt{u2}\left( t \right), \mathtt{target\_value}, \mathtt{abs\_tol} \right) \\ y\left( t \right) &= ifelse\left( \mathtt{c1}\left( t \right) \wedge \mathtt{c2}\left( t \right) \vee \neg \mathtt{c1}\left( t \right) \wedge \neg \mathtt{c2}\left( t \right), 0, 1 \right) \end{align} \]

Source

"""
    Logical_XNOR(; name, abs_tol=1e-3, target_value=0.0)

A logical XNOR (exclusive NOR) operation component for two real-valued input signals.

# Parameters
- `abs_tol`: Absolute tolerance for comparing inputs to target value (default: 1e-3)
- `target_value`: Reference value for comparison (default: 0.0)

# Variables
- `u1(t)`: First input signal (placement: left side, upper)
- `u2(t)`: Second input signal (placement: left side, lower)
- `y(t)`: Output signal (placement: right side)

# Description
Performs exclusive NOR operation: output is 0.0 (true) when both inputs have same state
(both close or both not close to target), and 1.0 (false) when they differ. Inverse of XOR.
"""
component Logical_XNOR
  u1 = Dyad.RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"x1": -40, "x2": 0, "y1": 250, "y2": 290, "sh": 0.04, "sw": 0.04, "rot": 0},
        "icon": {"x1": -40, "x2": 0, "y1": 250, "y2": 290, "sh": 0.04, "sw": 0.04, "rot": 0}
      }
    }
  }
  y = Dyad.RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 0.04, "sw": 0.04, "rot": 0},
        "icon": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 0.04, "sw": 0.04, "rot": 0}
      }
    }
  }
  u2 = Dyad.RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"x1": -40, "x2": 0, "y1": 700, "y2": 740, "sh": 0.04, "sw": 0.04, "rot": 0},
        "icon": {"x1": -40, "x2": 0, "y1": 700, "y2": 740, "sh": 0.04, "sw": 0.04, "rot": 0}
      }
    }
  }
  parameter abs_tol::Real() = 1e-3
  parameter target_value::Real() = 0.0
  variable c1::Boolean
  variable c2::Boolean
relations
  c1 = check_with_target_value(u1, target_value, abs_tol)
  c2 = check_with_target_value(u2, target_value, abs_tol)
  y = ifelse((c1 and c2) or (!c1 and !c2), float_sym(0.0), float_sym(1.0))
metadata {"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/XNOR.svg"}}}
end
Flattened Source
"""
    Logical_XNOR(; name, abs_tol=1e-3, target_value=0.0)

A logical XNOR (exclusive NOR) operation component for two real-valued input signals.

# Parameters
- `abs_tol`: Absolute tolerance for comparing inputs to target value (default: 1e-3)
- `target_value`: Reference value for comparison (default: 0.0)

# Variables
- `u1(t)`: First input signal (placement: left side, upper)
- `u2(t)`: Second input signal (placement: left side, lower)
- `y(t)`: Output signal (placement: right side)

# Description
Performs exclusive NOR operation: output is 0.0 (true) when both inputs have same state
(both close or both not close to target), and 1.0 (false) when they differ. Inverse of XOR.
"""
component Logical_XNOR
  u1 = Dyad.RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"x1": -40, "x2": 0, "y1": 250, "y2": 290, "sh": 0.04, "sw": 0.04, "rot": 0},
        "icon": {"x1": -40, "x2": 0, "y1": 250, "y2": 290, "sh": 0.04, "sw": 0.04, "rot": 0}
      }
    }
  }
  y = Dyad.RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 0.04, "sw": 0.04, "rot": 0},
        "icon": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 0.04, "sw": 0.04, "rot": 0}
      }
    }
  }
  u2 = Dyad.RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"x1": -40, "x2": 0, "y1": 700, "y2": 740, "sh": 0.04, "sw": 0.04, "rot": 0},
        "icon": {"x1": -40, "x2": 0, "y1": 700, "y2": 740, "sh": 0.04, "sw": 0.04, "rot": 0}
      }
    }
  }
  parameter abs_tol::Real() = 1e-3
  parameter target_value::Real() = 0.0
  variable c1::Boolean
  variable c2::Boolean
relations
  c1 = check_with_target_value(u1, target_value, abs_tol)
  c2 = check_with_target_value(u2, target_value, abs_tol)
  y = ifelse((c1 and c2) or (!c1 and !c2), float_sym(0.0), float_sym(1.0))
metadata {"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/XNOR.svg"}}}
end


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses