AND gate | |
ID | 44 |
---|---|
Category | Signal-i2o1 |
Sublayer width | 14 |
Outputs 1 when both of its inputs are 1.
The AND gate is a binary device. If both IN0
and IN1
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.
IN0 | IN1 | OUT0 |
---|---|---|
0 | 0 | 0 |
1 | 0 | 0 |
0 | 1 | 0 |
1 | 1 | 1 |
local in0 = this:read(0)
local in1 = this:read(1)
if in0 >= 0.5 and in1 >= 0.5 then
this:write(0, 1)
else
this:write(0, 0)
end
IN0
: Value AIN1
: Value BOUT0
: A AND B