public IEnumerable <Transition> Match(IGate genter, IGate gleave) { var f1 = genter.GetProduct(); var f2 = gleave.GetProduct(); foreach (var f in f1.Factors) { // must exist ... var t = GetTransitions(f.Variable).First(); int[] indexes; if (f.Variable.Type.IsBoolean) { indexes = new int[] { f.Inputs.First().IsInverted ? 0 : 1 }; } else { indexes = f.Inputs.Select(i => i.Address - i.Group).ToArray(); } var q = t.PreStateIndexes.Intersect(indexes); if (!q.Any()) { // transition is not contained yield break; } yield return(t); } }
public override IGate Simplify() { IGate result = this; result = SimplifyNormalize(result); if (result.Type.IsFixed()) { return(result); } if (IsProductOfInputs) { result = SimplifyProductOfInputs(result.GetProduct()); } else { result = SimplifyMultiplicate(result); result = Gate.Simplify(result); } Gate.TraceSimplify(this, result, "simplify AND"); return(result); }