public void DFlipFlop() { DFlipFlop ff = new DFlipFlop(c, t, true); Assert.IsTrue(ff[0]); ff.Inputs[0] = f; c.Go(); Assert.IsFalse(ff[0]); c.Go(); Assert.IsFalse(ff[0]); ff.Inputs[0] = t; c.Go(); Assert.IsTrue(ff[0]); }
public void LoopDevice() { var ffs = new DFlipFlop(c, f).Unfold(ff => new DFlipFlop(c, ff), max: 8).ToArray(); ffs[0].Inputs[0] = new Inverter(ffs[ffs.Length - 1]); for (int i = 0; i < 8; i++) { c.Go(); for (int j = 0; j < i; j++) Assert.IsTrue(ffs[j][0]); } for (int i = 0; i < 8; i++) { c.Go(); for (int j = 0; j < i; j++) Assert.IsFalse(ffs[j][0]); } }
public void ShiftRegister() { var ffs = new DFlipFlop(c, f).Unfold(ff => new DFlipFlop(c, ff), max: 8).ToArray(); ffs[0].Inputs[0] = t; for (int i = 0; i < 8; i++) { c.Go(); for (int j = 0; j < i; j++) Assert.IsTrue(ffs[j][0]); } }