예제 #1
0
 void context_OnSignalNoLongerDrivenByPort(object sender, SignalPortIndexEventArgs e)
 {
     _currentSystem.PromoteAsInput(e.Signal);
 }
예제 #2
0
 private void ScanDefineArchitecture()
 {
     tokenizer.Match(TokenTypes.TextIdentifier, "architecture");
     MathIdentifier architectureId = ScanEntityMathIdentifierOrLabel(true);
     MathIdentifier entityId = ScanEntityMathIdentifierOrLabel(true);
     Entity entity = context.Library.LookupEntity(entityId);
     tokenizer.Match("{");
     MathSystem originalSystem = system;
     MathSystem tempSystem = new MathSystem(system.Context);
     system = tempSystem;
     while(tokenizer.LookaheadFistToken.Text != "}")
         NextStatement();
     foreach(string input in entity.InputSignals)
         tempSystem.PromoteAsInput(tempSystem.LookupNamedSignal(input));
     foreach(string output in entity.OutputSignals)
         tempSystem.AddSignalTree(tempSystem.LookupNamedSignal(output), tempSystem.GetAllInputs(), true, false);
     ReadOnlyCollection<Signal> leafs = tempSystem.GetAllLeafSignals();
     foreach(Signal s in leafs)
     {
         Signal so;
         if(originalSystem.TryLookupNamedSignal(s.Label, out so) && so.Value != null)
             s.PostNewValue(so.Value);
     }
     context.Scheduler.SimulateInstant();
     system = originalSystem;
     tokenizer.Match("}");
     tempSystem.RemoveUnusedObjects();
     tempSystem.PublishToLibrary(architectureId, entity.EntityId);
 }
예제 #3
0
 void IObserver.OnPortDrivesSignalNoLonger(Signal signal, Port port, int outputIndex)
 {
     _currentSystem.PromoteAsInput(signal);
 }