Exemplo n.º 1
0
 // Helper Methods:
 private static string ToHadesString(this Component component)
 {
     return(component switch
     {
         ANDGate and =>
         $"hades.models.gatter.And{and.NumberOfInputs} {and.Name} {and.Pos.X * 3}0 {and.Pos.Y * 3}0 @N 1001 1.0E-8",
         INVGate inv =>
         $"hades.models.gatter.Inv {inv.Name} {inv.Pos.X * 3}0 {inv.Pos.Y * 3}0 @N 1001 5.0E-9",
         NANDGate nand =>
         $"hades.models.gatter.Nand{nand.NumberOfInputs} {nand.Name} {nand.Pos.X * 3}0 {nand.Pos.Y * 3}0 @N 1001 1.0E-8",
         NORGate nor =>
         $"hades.models.gatter.Nor{nor.NumberOfInputs} {nor.Name} {nor.Pos.X * 3}0 {nor.Pos.Y * 3}0 @N 1001 1.0E-8",
         ORGate or =>
         $"hades.models.gatter.Or{or.NumberOfInputs} {or.Name} {or.Pos.X * 3}0 {or.Pos.Y * 3}0 @N 1001 1.0E-8",
         XNORGate xnor =>
         $"hades.models.gatter.Xnor{xnor.NumberOfInputs} {xnor.Name} {xnor.Pos.X * 3}0 {xnor.Pos.Y * 3}0 @N 1001 1.0E-8",
         XORGate xor =>
         $"hades.models.gatter.Xor{xor.NumberOfInputs} {xor.Name} {xor.Pos.X * 3}0 {xor.Pos.Y * 3}0 @N 1001 1.0E-8",
         InputPulse ip =>
         $"hades.models.io.PulseSwitch {ip.Name} {ip.Pos.X * 3}0 {ip.Pos.Y * 3}0 @N 1001 0.1 null",
         InputClock ic =>
         $"hades.models.io.ClockGen {ic.Name} {ic.Pos.X * 3}0 {ic.Pos.Y * 3}0 @N 1001 {InputClock.MsToSec()} 0.5 0.0",
         Input i => $"hades.models.io.Ipin {i.Name} {i.Pos.X * 3}0 {i.Pos.Y * 3}0 @N 1001  {i.IsActive}",
         Output o => $"hades.models.io.Opin {o.Name} {o.Pos.X * 3}0 {o.Pos.Y * 3}0 @N 1001 5.0E-9",
         _ => throw new ComponentNotFoundException(component.GetType().ToString())
     });
Exemplo n.º 2
0
        void OnStateSynchronized()
        {
            // If I am the client, we should set my start frame information
            if (!IsServer)
            {
                Simulation.SetStartState(Network.LatestState, Network.StateStartFrame);
                InputClock.StartFrame = Simulation.StartFrame;
            }

            // Start the clocks!
            m_started = true;
            InputClock.Start();
        }