Ejemplo n.º 1
0
 public void OpenLogicalCircuit(CircuitMap map)
 {
     Tracer.Assert(this.Power);
     this.OpenLogicalCircuit(map.Circuit);
     this.CircuitRunner.VisibleMap = map;
     map.TurnOn();
     map.Redraw(true);
     this.Mainframe.Status = map.Path();
 }
Ejemplo n.º 2
0
        private void CircuitMapPerfTest(string project, string initialCircuit, int maxCount, int maxSeconds)
        {
            CircuitProject circuitProject = ProjectTester.Load(this.TestContext, project, initialCircuit);
            Stopwatch      stopwatch      = new Stopwatch();

            stopwatch.Start();
            for (int i = 0; i < maxCount; i++)
            {
                CircuitMap   circuitMap   = new CircuitMap(circuitProject.ProjectSet.Project.LogicalCircuit);
                CircuitState circuitState = circuitMap.Apply(CircuitRunner.HistorySize);
                Assert.IsNotNull(circuitState);
                circuitMap.TurnOn();
            }
            stopwatch.Stop();
            this.TestContext.WriteLine("{0} CircuitMap(s) created and applied in {1} - {2:N2} sec per each map", maxCount, stopwatch.Elapsed, stopwatch.Elapsed.TotalSeconds / maxCount);
            Assert.IsTrue(stopwatch.Elapsed < new TimeSpan(0, 0, maxSeconds), "CircuitMap was created and applied successfully but too slow");
        }
            public TableChank(LogicalCircuit logicalCircuit)
            {
                this.LogicalCircuit = TableChank.Copy(logicalCircuit);
                this.Plug();

                // Create map and state
                CircuitMap circuitMap = new CircuitMap(this.LogicalCircuit);

                this.CircuitState = circuitMap.Apply(CircuitRunner.HistorySize);

                this.Inputs.ForEach(s => s.Function  = circuitMap.FunctionConstant(s.Symbol));
                this.Outputs.ForEach(s => s.Function = circuitMap.FunctionProbe(s.Symbol));

                this.Inputs.Where(s => s.Function == null).ToList().ForEach(s => this.Inputs.Remove(s));
                this.Outputs.Where(s => s.Function == null).ToList().ForEach(s => this.Outputs.Remove(s));

                Tracer.Assert(this.Inputs.All(s => s.Function != null) && this.Outputs.All(s => s.Function != null));

                this.InputBitCount = this.Inputs.Sum(p => p.Pin.BitWidth);
                this.Count         = BigInteger.One << this.InputBitCount;

                circuitMap.TurnOn();
            }