| OR gate | |
| ID | 43 |
|---|---|
| Category | Signal-i2o1 |
| Sublayer width | 14 |
Outputs 1 when at least one of its input is 0.
The OR gate is a binary device. If any input is 1, output 1. Otherwise output 0. Since this is a binary device, the input value is rounded so any value ≥0.5 is equal to 1.
Essentially, it acts as a reverse Y-splitter and can combine two inputs into one.
| IN0 | IN1 | OUT0 |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 1 | 1 |
local in0 = this:read(0)
local in1 = this:read(1)
if in0 >= 0.5 or in1 >= 0.5 then
this:write(0, 1)
else
this:write(0, 0)
end
IN0: Value AIN1: Value BOUT0: A OR B