예제 #1
0
파일: NOTX.cs 프로젝트: Last8Exile/Logics
    public NOTX(string parameters) : base(2)
    {
        var size = byte.Parse(parameters);

        IOGroups.Add(Input, new SchemeIOGroup(size, IO.Input));
        IOGroups.Add(Output, new SchemeIOGroup(size, IO.Output));
        IOGroups[Output].IOArray.SetAll(true);
    }
예제 #2
0
    public void AddIOGroup(UIIOGroupBuildInfo ioGroupBuildInfo)
    {
        var ioGroupContainer = new IOGroupContainer(ioGroupBuildInfo, Self);

        IOGroups.Add(ioGroupContainer.BuildInfo.BuildString.Name, ioGroupContainer.IOGroup);
        IOGroupsInfo.Add(ioGroupContainer);

        ioGroupContainer.Design = SchemeDesigner.Instance.CreateSelfIOGroupDesign(ioGroupContainer);
    }
예제 #3
0
    public void DeleteIOGroup(IOGroupContainer container)
    {
        var removedLinks = new List <LinkContainer>();

        switch (container.IOGroup.IO)
        {
        case IO.Input:
            Self.SourceThisLinks.Where(x => x.BuildInfo.SourceGroupName == container.BuildInfo.BuildString.Name).ForEach(x =>
            {
                if (removedLinks.Contains(x))
                {
                    return;
                }
                removedLinks.Add(x);
                x.Link.RemoveLink();
                x.Design.DestroyThis();
                x.TargetScheme.TargetThisLinks.Remove(x);
                Links.Remove(x);
            });
            removedLinks.ForEach(x => Self.SourceThisLinks.Remove(x));
            break;

        case IO.Output:
            Self.TargetThisLinks.Where(x => x.BuildInfo.TargetGroupName == container.BuildInfo.BuildString.Name).ForEach((x) => {
                if (removedLinks.Contains(x))
                {
                    return;
                }
                x.Link.RemoveLink();
                x.Design.DestroyThis();
                x.SourceScheme.SourceThisLinks.Remove(x);
                Links.Remove(x);
            });
            removedLinks.ForEach(x => Self.TargetThisLinks.Remove(x));
            break;
        }
        removedLinks.Clear();
        (container.Design as IOSelfIOGroupDesign).DestroyThis();
        IOGroups.Remove(container.BuildInfo.BuildString.Name);
        IOGroupsInfo.Remove(container);
    }
예제 #4
0
    public RAMX(string parameters) : base(4)
    {
        var sizes       = parameters.Split(' ');
        var valueSize   = byte.Parse(sizes[0]);
        var addressSize = byte.Parse(sizes[1]);
        var valuesTotal = Extensions.Pow(2, addressSize);
        var totalSize   = valuesTotal * valueSize;

        if (totalSize > MaxSize)
        {
            throw new UnityException("Превышен максимальный размер RAM");
        }
        IOGroups.Add(Input, new SchemeIOGroup(valueSize, IO.Input));
        IOGroups.Add(Address, new SchemeIOGroup(addressSize, IO.Input));
        IOGroups.Add(Load, new SchemeIOGroup(1, IO.Input));
        IOGroups.Add(Output, new SchemeIOGroup(valueSize, IO.Output));
        CycleManager.Instance.Tick += OnTick;
        mRam = new BitArray[valuesTotal];
        for (int i = 0; i < valuesTotal; i++)
        {
            mRam[i] = new BitArray(valueSize);
        }
    }
예제 #5
0
 public SimulationStop(bool enabled) : base(1)
 {
     IOGroups.Add(Input, new SchemeIOGroup(1, IO.Input));
     CycleManager.Instance.Tick += OnTick;
     Enabled = enabled;
 }
예제 #6
0
파일: DFF.cs 프로젝트: Last8Exile/Logics
 public DFF() : base(2)
 {
     IOGroups.Add(Input, new SchemeIOGroup(1, IO.Input));
     IOGroups.Add(Output, new SchemeIOGroup(1, IO.Output));
     CycleManager.Instance.Tick += OnTick;
 }
예제 #7
0
 public NumberDisplay(Parameters parameters) : base(1)
 {
     mSchemeParameters = parameters;
     IOGroups.Add(Input, new SchemeIOGroup(mSchemeParameters.Size, IO.Input));
 }
예제 #8
0
 public IntConst(int value) : base(1)
 {
     IOGroups.Add(Output, new SchemeIOGroup(32, IO.Output));
     Number = value;
 }
예제 #9
0
 public CONST() : base(1)
 {
     IOGroups.Add(Output, new SchemeIOGroup(1, IO.Output));
     IOGroups[Output].IOArray[0] = true;
 }
예제 #10
0
 public NAND() : base(2)
 {
     IOGroups.Add(Input, new SchemeIOGroup(2, IO.Input));
     IOGroups.Add(Output, new SchemeIOGroup(1, IO.Output));
     IOGroups[Output].IOArray[0] = true;
 }