Initial commit
This commit is contained in:
30
C#/DigiSim/Logic/Gates/XnorGate.cs
Normal file
30
C#/DigiSim/Logic/Gates/XnorGate.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace DigiSim.Logic.Gates {
|
||||
public class XnorGate : Gate {
|
||||
public XnorGate(double x, double y) : base(x, y, 50, 50) { }
|
||||
protected override void InternalSetup(Canvas canvas) {
|
||||
TruthTable.Add(false, false, true);
|
||||
TruthTable.Add(false, true, false);
|
||||
TruthTable.Add(true, false, false);
|
||||
TruthTable.Add(true, true, true);
|
||||
|
||||
Shape = new Rectangle();
|
||||
SetInputs(2);
|
||||
SetOutputs(1);
|
||||
CreateConnections();
|
||||
|
||||
Text = "!=1";
|
||||
|
||||
Instantiate();
|
||||
}
|
||||
|
||||
public override void Update(Gate source) {
|
||||
ConnectedOutputs[0].IsPowered = TruthTable[ConnectedInputs[0].IsPowered, ConnectedInputs[1].IsPowered];
|
||||
|
||||
UpdateShapes();
|
||||
UpdateConnectedGates(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user