예제 #1
0
 /// <summary>
 /// Adds a new input wire to the circuit.
 /// </summary>
 /// <returns>Input wire.</returns>
 public Wire Input()
 {
     return(Wire.FromGate(new InputGate(_nextGateId++, _nextInputIndex++)));
 }
예제 #2
0
 /// <summary>
 /// Constructs the equivalent of an OR gate from an AND gate and negated input and
 /// output wires.
 /// </summary>
 /// <param name="leftInput">Left input wire.</param>
 /// <param name="rightInput">Right input wire.</param>
 /// <returns>A wire representing the logical OR of both inputs.</returns>
 public Wire Or(Wire leftInput, Wire rightInput)
 {
     return(Not(And(Not(leftInput), Not(rightInput))));
 }