new module:Logic()
Members
-
static state :Number
-
Enum for logic states.
States:
offonunknownoscillating
-
static stateList :Array
-
list of all states that can be used in the simulation
This getter iterates over Logic.state and returns an array containing all values of Logic.state's members
Methods
-
static and(a, b) → {Logic.state}
-
Logic AND
Parameters:
Name Type Description aLogic.state first input state
bLogic.state second input state
Returns:
Logic.state -output state
-
static nand(a, b) → {Logic.state}
-
Logic NAND
Parameters:
Name Type Description aLogic.state first input state
bLogic.state second input state
Returns:
Logic.state -output state
-
static nor(a, b) → {Logic.state}
-
Logic NOR
Parameters:
Name Type Description aLogic.state first input state
bLogic.state second input state
Returns:
Logic.state -output state
-
static not(a) → {Logic.state}
-
Logic NOT
Parameters:
Name Type Description aLogic.state first input state
Returns:
Logic.state -output state
-
static or(a, b) → {Logic.state}
-
Logic OR
Parameters:
Name Type Description aLogic.state first input state
bLogic.state second input state
Returns:
Logic.state -output state
-
static runSymmetricRules(a, b, rules) → {Logic.state}
-
Finds the correct rule in the array of rules and returns the corresponding return value. This function expects rules to be symmetric (so
a RULE bshould returns the same value asb RULE a), which allows to cut down on therulesarray quite a bitParameters:
Name Type Description aLogic.state first input state
bLogic.state second input state
rulesArray Array of arrays. Each inner array represents a rule in the format [input1, input2, output]. The function finds an array, where
a === input1andb === input1(ora === input2andb === input1) and returnsoutputfrom this array.Returns:
Logic.state -output state
-
static xnor(a, b) → {Logic.state}
-
Logic XNOR
Parameters:
Name Type Description aLogic.state first input state
bLogic.state second input state
Returns:
Logic.state -output state
-
static xor(a, b) → {Logic.state}
-
Logic XOR
Parameters:
Name Type Description aLogic.state first input state
bLogic.state second input state
Returns:
Logic.state -output state