NAND Gate (nand)
Outputs 0 only when every input read is above 0.5.
Group: Control · Kind: {"block":"nand","kind":"control"}
When to use it
Use it for an active-low enable or interlock, such as a fault output that goes low only when every condition holds. Use AND Gate for a true output instead.
Pins
| Pin | Domain | Meaning |
|---|---|---|
in1 |
signal | First input; true above 0.5 |
in2 |
signal | Second input; true above 0.5 |
in3 |
signal | Third input, read if n is 3 or 4 |
in4 |
signal | Fourth input, read if n is 4 |
out |
signal | Output, always 0 or 1 |
Common parameters
n: How many inputs the gate has (Default: 2)
Parameters
| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
n |
— | 2 | How many inputs the gate has |
Parameter descriptions are in English in both languages.
Model
The first n inputs are read (n = 2 by default, up to 4). An input is true when it is above 0.5. The output is the inverse of AND: 0 when all n inputs are true and 1 otherwise. The gate is combinational: it has direct feedthrough and follows its inputs at every solver step.
Common mistakes
- An input that is not wired reads 0, so the output stays at 1 and never goes low. Wire every input up to n, and set n to the number of inputs you use, because the default is 2.
- If all inputs are 0, the output is 1 from the start, so a latch or counter fed from it sees a high level from time 0 and does not count that as an edge. A loop made only of gates is refused.
Problems rules: compile.error
Datasheet and sources
There is no datasheet. n is the number of conditions combined. The logic levels come from your interlock or enable logic.
Example
Open the example with the command file.openExample and the name demo:nand.
Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.