예제 #1
0
        public void JK_FlipFlop()
        {
            var latch  = ExternalGate.Parse($@"D:\Downloads\nand2tetris\perso\{nameof(JK_FlipFlop)}.hdl");
            var result = latch.Execute(("j", false), ("k", false), ("en", false));

            result = latch.Execute(("j", true), ("en", true));
            Assert.IsTrue(result["out"].Value);
            result = latch.Execute(("j", false), ("en", true));
            Assert.IsTrue(result["out"].Value);
            result = latch.Execute(("j", false), ("en", false));
            Assert.IsTrue(result["out"].Value);
            result = latch.Execute(("j", true), ("en", false));
            Assert.IsTrue(result["out"].Value);
            result = latch.Execute(("j", true), ("en", true));
            Assert.IsTrue(result["out"].Value);
        }
예제 #2
0
 private void LoadGate()
 {
     if ((Keyboard.Modifiers == ModifierKeys.Shift && !string.IsNullOrEmpty(_dialog.FileName)) || (_dialog.ShowDialog(this) ?? false))
     {
         try
         {
             SelectedGate = ExternalGate.Parse(_dialog.FileName);
             AutoExecute  = !ClockCommand.LastExecute;
             Title        = System.IO.Path.GetFileName(_dialog.FileName);
         }
         catch (System.Exception ex)
         {
             MessageBox.Show(ex.Message, $"Can't open {System.IO.Path.GetFileName(_dialog.FileName)}", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }
예제 #3
0
 public void TestXor()
 {
     Xor = ExternalGate.Parse(@"D:\Downloads\nand2tetris\projects\01\Xor.hdl");
     Assert.IsNotNull(Xor);
     Assert.AreEqual("Xor", Xor.Name, false);
 }
예제 #4
0
 public void TestMethodAnd()
 {
     And = ExternalGate.Parse(@"D:\Downloads\nand2tetris\projects\01\And.hdl");
     Assert.IsNotNull(And);
     Assert.AreEqual("And", And.Name, false);
 }
예제 #5
0
 public void TestMethodNot()
 {
     Not = ExternalGate.Parse(@"D:\Downloads\nand2tetris\projects\01\Not.hdl");
     Assert.IsNotNull(Not);
     Assert.AreEqual("Not", Not.Name, false);
 }
 public void Initialize()
 {
     Gate.RegisterGate <Nand>();
     Mux  = ExternalGate.Parse(@"D:\Downloads\nand2tetris\projects\01\Mux.hdl");
     DMux = ExternalGate.Parse(@"D:\Downloads\nand2tetris\projects\01\DMux.hdl");
 }