public MuxGate() { ControlInput = new Wire(); //Init the variables m_gAnd1 = new AndGate(); m_gAnd2 = new AndGate(); m_gAnd3 = new AndGate(); m_gNot = new NotGate(); m_gmOr = new MultiBitOrGate(3); m_ws = new WireSet(3); //Connect the wires m_gNot.ConnectInput(ControlInput); m_gAnd1.ConnectInput1(Input1); m_gAnd1.ConnectInput2(Input2); m_gAnd2.ConnectInput1(Input2); m_gAnd2.ConnectInput2(ControlInput); m_gAnd3.ConnectInput1(Input1); m_gAnd3.ConnectInput2(m_gNot.Output); m_ws[0].ConnectInput(m_gAnd1.Output); m_ws[1].ConnectInput(m_gAnd2.Output); m_ws[2].ConnectInput(m_gAnd3.Output); m_gmOr.ConnectInput(m_ws); Output = m_gmOr.Output; }
public Demux() { Input = new Wire(); Control = new Wire(); Output1 = new Wire(); Output2 = new Wire(); //your code here m_gAnd1 = new AndGate(); m_gAnd2 = new AndGate(); m_gNot = new NotGate(); Output1.Value = 0; Output2.Value = 0; m_gNot.ConnectInput(Control); m_gAnd1.ConnectInput1(Input); m_gAnd1.ConnectInput2(m_gNot.Output); m_gAnd2.ConnectInput1(Input); m_gAnd2.ConnectInput2(Control); Output1 = m_gAnd1.Output; Output2 = m_gAnd2.Output; }
public MuxGate() {//init ControlInput = new Wire(); Wire a = new Wire(); Wire b = new Wire(); and1 = new AndGate(); and2 = new AndGate(); or = new OrGate(); not = new NotGate(); //connect or.ConnectInput1(and1.Output); or.ConnectInput2(and2.Output); and1.ConnectInput1(ControlInput); and1.ConnectInput2(b); and2.ConnectInput1(not.Output); not.ConnectInput(ControlInput); and2.ConnectInput2(a); /* or.ConnectInput1(and1.Output); * or.ConnectInput2(and2.Output); * and1.ConnectInput1(ControlInput); * and1.ConnectInput1(b); * not.ConnectInput(ControlInput); * and2.ConnectInput1(not.Output); * and2.ConnectInput2(a); */ //input\output Input1 = a; Input2 = b; Output = or.Output; }
// accoplish using 2 "AND" and "NOT" gates, // first connect input and "NOT" control bit to "AND" gate 1, then connect input and control bit to "AND" gate 2 // lastly connect the outputs public Demux() { Input = new Wire(); Control = new Wire(); Output1 = new Wire(); Output2 = new Wire(); // initilaize the gates and_output1 = new AndGate(); and_output2 = new AndGate(); not_contolinput_input1 = new NotGate(); //step 1 not_contolinput_input1.ConnectInput(Control); and_output1.ConnectInput1(Input); and_output1.ConnectInput2(not_contolinput_input1.Output); //step 2 and_output2.ConnectInput1(Input); and_output2.ConnectInput2(Control); //step 3 Output1 = and_output1.Output; Output2 = and_output2.Output; }
public XorGate() { //init the gates Wire wire1 = new Wire(); //for A, first side Wire wire2 = new Wire(); //for B, second side m_gNot1 = new NotGate(); //for B, first side m_gNot2 = new NotGate(); //for A, second side m_gAnd1 = new AndGate(); //first side m_gAnd2 = new AndGate(); //second side m_gOr = new OrGate(); //connect the gates m_gOr.ConnectInput1(m_gAnd1.Output); m_gOr.ConnectInput2(m_gAnd2.Output); m_gAnd1.ConnectInput1(wire1); m_gNot1.ConnectInput(wire2); m_gAnd1.ConnectInput2(m_gNot1.Output); m_gNot2.ConnectInput(wire1); m_gAnd2.ConnectInput1(m_gNot2.Output); m_gAnd2.ConnectInput2(wire2); //set the inputs and the output of the or gate Output = m_gOr.Output; Input1 = wire1; Input2 = wire2; }
public AAndNotBGate() { m_gNot = new NotGate(); m_gAnd = new AndGate(); m_gNot.ConnectInput(Input2); m_gAnd.ConnectInput1(Input1); m_gAnd.ConnectInput2(m_gNot.Output); Output = m_gAnd.Output; }
//nand gate is defines as not-AND gate, the procedure is completed using the AND,NOT gates. public NAndGate() { and_input = new AndGate(); not_output = new NotGate(); and_input.ConnectInput1(Input1); and_input.ConnectInput2(Input2); not_output.ConnectInput(and_input.Output); Output = not_output.Output; }
public OrGate() { //your code here m_gNotA = new NotGate(); m_gNotB = new NotGate(); m_gNand = new NAndGate(); m_gNand.ConnectInput1(m_gNotA.Output); m_gNand.ConnectInput2(m_gNotB.Output); Input1 = m_gNotA.Input; Input2 = m_gNotB.Input; Output = m_gNand.Output; }
public AndGate() { //init the gates m_gNand = new NAndGate(); m_gNot = new NotGate(); //wire the output of the nand gate to the input of the not m_gNot.ConnectInput(m_gNand.Output); //set the inputs and the output of the and gate Output = m_gNot.Output; Input1 = m_gNand.Input1; Input2 = m_gNand.Input2; }
public OrGate() { var mGNand = new NAndGate(); var mGNot = new NotGate(); var mGNot2 = new NotGate(); mGNand.ConnectInput1(mGNot.Output); mGNand.ConnectInput2(mGNot2.Output); Input1 = mGNot.Input; Input2 = mGNot2.Input; Output = mGNand.Output; }
//iterating each bit of the input and using the "NOT" gate to reverse the bit. public BitwiseNotGate(int iSize) { Size = iSize; Input = new WireSet(Size); Output = new WireSet(Size); for (int bit = 0; bit < iSize; bit++) { not_gate_operation = new NotGate(); not_gate_operation.ConnectInput(Input[bit]); Output[bit].ConnectInput(not_gate_operation.Output); } }
public BitwiseNotGate(int iSize) { Size = iSize; Input = new WireSet(Size); Output = new WireSet(Size); not = new NotGate(); for (int i = 0; i < Size; i++) { not.ConnectInput(Input[i]); Output[i].ConnectInput(not.Output); not = new NotGate(); } }
public OrGate() { m_gNand = new NAndGate(); m_gNotX = new NotGate(); m_gNotY = new NotGate(); m_gNand.ConnectInput1(m_gNotX.Output); m_gNand.ConnectInput2(m_gNotY.Output); Input1 = m_gNotX.Input; Input2 = m_gNotY.Input; Output = m_gNand.Output; }
public BitwiseNotGate(int iSize) { Size = iSize; Input = new WireSet(Size); Output = new WireSet(Size); m_gNot = new NotGate[Size]; for (int i = 0; i < Size; i++) { m_gNot[i] = new NotGate(); m_gNot[i].ConnectInput(Input[i]); Output[i].ConnectInput(m_gNot[i].Output); } }
public BitwiseNotGate(int iSize) { Size = iSize; Input = new WireSet(Size); Output = new WireSet(Size); //your code here not = new NotGate[Size]; for (int i = 0; i < Size; i++) { not[i] = new NotGate(); not[i].ConnectInput(Input[i]); Output[i].ConnectInput(not[i].Output); } }
public OrGate() { //init the gates m_gNand = new NAndGate(); m_gNot1 = new NotGate(); m_gNot2 = new NotGate(); //wire the output of the NOT gates to the inputs of the NAND m_gNand.ConnectInput1(m_gNot1.Output); m_gNand.ConnectInput2(m_gNot2.Output); //set the inputs and the output of the OR gate Output = m_gNand.Output; Input1 = m_gNot1.Input; Input2 = m_gNot2.Input; }
//your code here public BitwiseNotGate(int iSize) { Input = new WireSet(iSize); Output = new WireSet(iSize); NotGate[] mgNot = new NotGate[iSize]; for (int i = 0; i < iSize; i++) { mgNot[i] = new NotGate(); } for (int i = 0; i < iSize; i++) { mgNot[i].ConnectInput(Input[i]); Output[i].ConnectInput(mgNot[i].Output); } }
public OrGate() { //init the gates m_gNand = new NAndGate(); m_gNot = new NotGate(); m_gNot2 = new NotGate(); //wire the output of the nand gate to the input of the not m_gNand.ConnectInput1(m_gNot.Output); m_gNand.ConnectInput2(m_gNot2.Output); //set the inputs and the output of the and gate Input1 = m_gNot.Input; Input2 = m_gNot2.Input; Output = m_gNand.Output; }
public OrGate() { //init the gates. not1 = new NotGate(); not2 = new NotGate(); Nand = new NAndGate(); Nand.ConnectInput1(not1.Output); Nand.ConnectInput2(not2.Output); Output = Nand.Output; Input1 = not1.Input; Input2 = not2.Input; }
public OrGate() { //init the gates m_gNot1 = new NotGate(); //outside the parentheses m_gNot2 = new NotGate(); //a m_gNot3 = new NotGate(); //b m_gAnd = new AndGate(); //connect the gates m_gAnd.ConnectInput1(m_gNot2.Output); m_gAnd.ConnectInput2(m_gNot3.Output); m_gNot1.ConnectInput(m_gAnd.Output); //set the inputs and the output of the or gate Output = m_gNot1.Output; Input1 = m_gNot2.Input; Input2 = m_gNot3.Input; }
public BitwiseNotGate(int iSize) { Size = iSize; Input = new WireSet(Size); Output = new WireSet(Size); //your code here m_gates = new NotGate[iSize]; for (int i = 0; i < iSize; i++) { var gate = new NotGate(); m_gates[i] = gate; gate.ConnectInput(Input[i]); Output[i].ConnectInput(gate.Output); } }
public MuxGate() { ControlInput = new Wire(); m_gNot = new NotGate(); m_gAnd1 = new AndGate(); m_gAnd2 = new AndGate(); m_gOr = new OrGate(); m_gAnd1.ConnectInput1(m_gNot.Output); m_gOr.ConnectInput1(m_gAnd1.Output); m_gOr.ConnectInput2(m_gAnd2.Output); m_gNot.ConnectInput(ControlInput); m_gAnd2.ConnectInput1(ControlInput); Input1 = m_gAnd1.Input2; Input2 = m_gAnd2.Input2; Output = m_gOr.Output; }
public AndGate() { //init the gates m_gOR = new OrGate(); m_gNotInput1 = new NotGate(); m_gNotInput2 = new NotGate(); m_gNotOutput = new NotGate(); //wire the inputs to the not gates m_gNotInput1.ConnectInput(Input1); m_gNotInput2.ConnectInput(Input2); //connect the or gate m_gOR.ConnectInput1(m_gNotInput1.Output); m_gOR.ConnectInput2(m_gNotInput2.Output); //connect the not on the output m_gNotOutput.ConnectInput(m_gOR.Output); //set the output of the and gate Output = m_gNotOutput.Output; }
//your code here public Demux() { Input = new Wire(); Control = new Wire(); //init AndGate and1 = new AndGate(); AndGate and2 = new AndGate(); NotGate not = new NotGate(); and1.ConnectInput1(Input); and2.ConnectInput2(Input); not.ConnectInput(Control); and1.ConnectInput2(not.Output); and2.ConnectInput1(Control); Output1 = and1.Output; Output2 = and2.Output; }
public BitwiseNotGate(int iSize) { Size = iSize; Input = new WireSet(Size); Output = new WireSet(Size); //your code here m_gNotGate = new NotGate[iSize]; WireSet ws_resault = new WireSet(iSize); for (int i = 0; i < iSize; i++) { m_gNotGate[i] = new NotGate(); m_gNotGate[i].ConnectInput(Input[i]); ws_resault[i].ConnectInput(m_gNotGate[i].Output); } Output.ConnectInput(ws_resault); }
public Demux() { Input = new Wire(); Control = new Wire(); m_gAnd1 = new AndGate(); m_gAnd2 = new AndGate(); m_gNot = new NotGate(); m_gNot.ConnectInput(Control); m_gAnd1.ConnectInput1(m_gNot.Output); m_gAnd1.ConnectInput2(Input); m_gAnd2.ConnectInput1(Control); m_gAnd2.ConnectInput2(Input); Output1 = m_gAnd1.Output; Output2 = m_gAnd2.Output; }
public MuxGate() { ControlInput = new Wire(); m_gAndX = new AndGate(); m_gAndY = new AndGate(); m_gOr = new OrGate(); m_gNotC = new NotGate(); m_gAndY.ConnectInput1(ControlInput); m_gAndY.ConnectInput2(Input2); m_gNotC.ConnectInput(ControlInput); m_gAndX.ConnectInput2(m_gNotC.Output); m_gAndX.ConnectInput1(Input1); m_gOr.ConnectInput1(m_gAndX.Output); m_gOr.ConnectInput2(m_gAndY.Output); Output = m_gOr.Output; }
//your code here public Demux() { Input = new Wire(); var mGAnd1 = new AndGate(); var mGAnd2 = new AndGate(); var mGNot1 = new NotGate(); Control = new Wire(); mGNot1.ConnectInput(Control); mGAnd2.ConnectInput1(Input); mGAnd2.ConnectInput2(Control); mGAnd1.ConnectInput1(Input); mGAnd1.ConnectInput2(mGNot1.Output); Output1 = mGAnd1.Output; Output2 = mGAnd2.Output; }
public MuxGate() { var mGAnd1 = new AndGate(); var mGAnd2 = new AndGate(); var mGNot1 = new NotGate(); var mGOr = new OrGate(); ControlInput = new Wire(); mGNot1.ConnectInput(ControlInput); mGAnd2.ConnectInput1(Input2); mGAnd2.ConnectInput2(ControlInput); mGAnd1.ConnectInput1(Input1); mGAnd1.ConnectInput2(mGNot1.Output); mGOr.ConnectInput1(mGAnd1.Output); mGOr.ConnectInput2(mGAnd2.Output); Output = mGOr.Output; }
//A XOR B = (A ^ ~B)U(~A ^ B) public XorGate() { //init the gates var mGNot1 = new NotGate(); var mGNot2 = new NotGate(); var mGAnd1 = new AndGate(); var mGAnd2 = new AndGate(); var mGOr = new OrGate(); //wire mGAnd1.ConnectInput1(mGNot1.Output); mGAnd1.ConnectInput2(mGNot2.Input); mGAnd2.ConnectInput1(mGNot1.Input); mGAnd2.ConnectInput2(mGNot2.Output); mGOr.ConnectInput1(mGAnd1.Output); mGOr.ConnectInput2(mGAnd2.Output); //set the inputs and the output of the xor gate Output = mGOr.Output; Input1 = mGNot1.Input; Input2 = mGNot2.Input; }