private void LoadProgram(Module module)
        {
            CreateProgramCtrl fm = new CreateProgramCtrl(false);

            if (fm.ShowDialog() == DialogResult.OK)
            {
                string moduleName = CommonHelper.GetEnumDescription(typeof(Module), module);

                var flow = ProgramFlow.Load($"{PathDefine.sPathProgram}{moduleName}//{fm.ProgramName}.json");

                if (flow == null)
                {
                    MessageBox.Show($"导入[{fm.ProgramName}]程式失败!!!");
                    return;
                }

                if (flow.Module != module)
                {
                    MessageBox.Show("导入程式与所属模组不对应!!!");
                    return;
                }

                string rtn = SystemEntiy.Instance.FlowMachine[module].InstallProgram(flow);
                if (!string.IsNullOrEmpty(rtn))
                {
                    MessageBox.Show($"{moduleName} 导入 [{fm.ProgramName}] 失败【{rtn}】");
                }
                else
                {
                    MessageBox.Show($"{moduleName} 导入 [{fm.ProgramName}] 成功");
                }
            }
        }
Exemplo n.º 2
0
        private async void Computation()
        {
            await Tick;

            while (true)
            {
                ProgramFlow.DoNotUnroll();
                ProgramFlow.IOBarrier();
                Rdy.Next = '0';
                int i = 0;
                int j = 0;
                while (i++ < 10)
                {
                    ProgramFlow.DoNotUnroll();
                    j += i;
                    if (j < 8)
                    {
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
                Z.Next = StdLogicVector.FromInt(j, 32);
                await 63.Ticks();
                ProgramFlow.IOBarrier();
                Rdy.Next = '1';
                ProgramFlow.IOBarrier();
                await Tick;
            }
        }
Exemplo n.º 3
0
        private async void Computation()
        {
            await Tick;

            while (true)
            {
                ProgramFlow.DoNotUnroll();

                Rdy.Next = '0';
                ProgramFlow.IOBarrier();

                // y^('')-mu(1-y^2)y^'+y=0.
                double dt = Dt.Cur.ToDouble();
                double mu = Mu.Cur.ToDouble();
                _y[2]  = mu * (1 - _y[0] * _y[0]) * _y[1] - _y[0];
                _y[0] += _y[1] * dt;
                _y[1] += _y[2] * dt;
                await 39.Ticks();
                Y.Next       = _y[0].ToSLV();
                Ydot.Next    = _y[1].ToSLV();
                Ydotdot.Next = _y[2].ToSLV();
                ProgramFlow.IOBarrier();
                Rdy.Next = '1';
                await Tick;
                ProgramFlow.IOBarrier();
            }
        }
Exemplo n.º 4
0
        private void bNewProgram_Click(object sender, EventArgs e)
        {
            CreateProgramCtrl ctrl = new CreateProgramCtrl();

            ctrl.ShowDialog();
            if (ctrl.DialogResult == DialogResult.OK)
            {
                string module = CommonHelper.GetEnumDescription(typeof(Module), ctrl.Module);
                if (ProgramFlow.Exist(ctrl.Module, ctrl.ProductName))
                {
                    MessageBox.Show($"{module}:贴附信息[{ctrl.ProgramName}]已存在!!");
                    return;
                }
                else if (ctrl.ProgramName == string.Empty)
                {
                    MessageBox.Show("请正确输入程序名!!!");
                    return;
                }

                this.lModule.Text        = module;
                this.lProgram.Text       = ctrl.ProgramName;
                this.Flow                = new ProgramFlow(ctrl.ProgramName);
                this.Flow.Module         = ctrl.Module;
                this.Module              = ctrl.Module;
                this.programTree.Enabled = true;
                this.RefreshTree();
            }
        }
Exemplo n.º 5
0
        private async void Computation()
        {
            await Tick;

            Rdy.Next = '0';
            while (true)
            {
                ProgramFlow.DoNotUnroll();
                int a    = A.Cur.IntValue;
                int b    = B.Cur.IntValue;
                int sum  = a + b;
                int diff = a - b;
                int prod = a * b;
                int quot = a / b;
                ProgramFlow.IOBarrier();
                Rdy.Next  = '1';
                Sum.Next  = StdLogicVector.FromInt(sum, 32);
                Diff.Next = StdLogicVector.FromInt(diff, 32);
                Prod.Next = StdLogicVector.FromInt(prod, 32);
                Quot.Next = StdLogicVector.FromInt(quot, 32);
                await Tick;
                ProgramFlow.IOBarrier();
                Rdy.Next = '0';
                await Tick;
            }
        }
Exemplo n.º 6
0
        private void bSaveProgram_Click(object sender, EventArgs e)
        {
            this.Flow.NzUsed.Clear();
            this.Flow.NzOffset.Clear();
            this.Flow.NzUOffset.Clear();
            this.Flow.NzUsed.Add(Nozzle.Nz1, this.bUsedNz1.Checked);
            this.Flow.NzUsed.Add(Nozzle.Nz2, this.bUsedNz2.Checked);
            this.Flow.NzUsed.Add(Nozzle.Nz3, this.bUsedNz3.Checked);
            this.Flow.NzUsed.Add(Nozzle.Nz4, this.bUsedNz4.Checked);
            this.Flow.NzOffset.Add(Nozzle.Nz1, new PointF((float)this.nz1OffsetX.Value,
                                                          (float)this.nz1OffsetY.Value));
            this.Flow.NzOffset.Add(Nozzle.Nz2, new PointF((float)this.nz2OffsetX.Value,
                                                          (float)this.nz2OffsetY.Value));
            this.Flow.NzOffset.Add(Nozzle.Nz3, new PointF((float)this.nz3OffsetX.Value,
                                                          (float)this.nz3OffsetY.Value));
            this.Flow.NzOffset.Add(Nozzle.Nz4, new PointF((float)this.nz4OffsetX.Value,
                                                          (float)this.nz4OffsetY.Value));

            this.Flow.NzUOffset.Add(Nozzle.Nz1, (double)this.nz1ROffset.Value);
            this.Flow.NzUOffset.Add(Nozzle.Nz2, (double)this.nz2ROffset.Value);
            this.Flow.NzUOffset.Add(Nozzle.Nz3, (double)this.nz3ROffset.Value);
            this.Flow.NzUOffset.Add(Nozzle.Nz4, (double)this.nz4ROffset.Value);

            if (ProgramFlow.Save(this.Flow))
            {
                MessageBox.Show("保存成功!!");
            }
            else
            {
                MessageBox.Show("保存失敗!!");
            }
        }
 private void tModule_SelectedIndexChanged_1(object sender, EventArgs e)
 {
     if (!isCreate)
     {
         this.tProgramName.Items.Clear();
         this.tProgramName.Items.AddRange(ProgramFlow.GetProgramList((Module)this.tModule.SelectedIndex));
     }
 }
Exemplo n.º 8
0
 private void bUpdateToFlow_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show($"是否保存程式? Y/N", "警告", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         if (ProgramFlow.Save(this.Flow))
         {
             MessageBox.Show("检验保存成功,请清理重新导入程式!!!");
         }
     }
 }
Exemplo n.º 9
0
        private async void Computation()
        {
            await Tick;

            while (true)
            {
                ProgramFlow.DoNotUnroll();
                DOut.Next = DIn.Cur;
                await Tick;
            }
        }
Exemplo n.º 10
0
        public override void Execute()
        {
            ProgramFlow flow = new ProgramFlow(TestName, SourceDirectory)
            {
                CanAssemblyMetadata = false
            };

            flow.Combine(program);

            string filename = flow.Save();

            OpenEditor(filename);
        }
Exemplo n.º 11
0
        private async void Computation()
        {
            await Tick;

            while (true)
            {
                ProgramFlow.DoNotUnroll();
                Sum.Next  = (A.Cur.ToDouble() + B.Cur.ToDouble()).ToSLV();
                Diff.Next = (A.Cur.ToDouble() - B.Cur.ToDouble()).ToSLV();
                Prod.Next = (A.Cur.ToDouble() * B.Cur.ToDouble()).ToSLV();
                Quot.Next = (A.Cur.ToDouble() / B.Cur.ToDouble()).ToSLV();
                Neg.Next  = (-A.Cur.ToDouble()).ToSLV();
                Abs.Next  = Math.Abs(A.Cur.ToDouble()).ToSLV();
                await 30.Ticks();
            }
        }
Exemplo n.º 12
0
        public frmPasteReCheck(Module module)
        {
            InitializeComponent();

            if (SystemEntiy.Instance.FlowMachine.ContainsKey(module) &&
                SystemEntiy.Instance.FlowMachine[module].Program != null)
            {
                this.Module  = module;
                this.RunData = SystemEntiy.Instance.FlowMachine[module].RunData;
                string desr = Common.CommonHelper.GetEnumDescription(module.GetType(), module);
                this.Flow = ProgramFlow.Load($"{PathDefine.sPathProgram}{desr}//{SystemEntiy.Instance.FlowMachine[module].Program.PasteName}.json");
                CameraDefine.Instance.Light(this.Module, Camera.Top, new LightParam()
                {
                    bRed = true, R_Value = 80
                });
            }
        }
Exemplo n.º 13
0
        private async void Computation()
        {
            await Tick;

            while (true)
            {
                ProgramFlow.DoNotUnroll();
                ProgramFlow.IOBarrier();
                Rdy.Next = '0';
                Sin.Next = (Math.Sin(X.Cur.ToDouble())).ToSLV();
                Cos.Next = (Math.Cos(X.Cur.ToDouble())).ToSLV();
                await 63.Ticks();
                ProgramFlow.IOBarrier();
                Rdy.Next = '1';
                ProgramFlow.IOBarrier();
                await Tick;
            }
        }
Exemplo n.º 14
0
        private async void Computation()
        {
            await Tick;

            while (true)
            {
                ProgramFlow.DoNotUnroll();
                ProgramFlow.IOBarrier();
                Rdy.Next = '0';
                var sincos = MathExt.ScSinCos(SFix.FromSigned(X.Cur.SignedValue, _xFracWidth), _yFracWidth);
                Cos.Next = sincos.Item1.SLVValue;
                Sin.Next = sincos.Item2.SLVValue;
                await 12.Ticks();
                ProgramFlow.IOBarrier();
                Rdy.Next = '1';
                ProgramFlow.IOBarrier();
                await Tick;
            }
        }
Exemplo n.º 15
0
        private async void Computation()
        {
            await Tick;

            while (true)
            {
                ProgramFlow.DoNotUnroll();
                ProgramFlow.IOBarrier();
                Rdy.Next   = '0';
                Sqrt1.Next = MathExt.Sqrt(UFix.FromUnsigned(X1.Cur.UnsignedValue, _fracWidth)).SLVValue;
                Sqrt2.Next = MathExt.Sqrt(UFix.FromUnsigned(X2.Cur.UnsignedValue, _fracWidth)).SLVValue;
                await NTicks(63);

                ProgramFlow.IOBarrier();
                Rdy.Next = '1';
                ProgramFlow.IOBarrier();
                await Tick;
            }
        }
Exemplo n.º 16
0
        private async void Computation()
        {
            await Tick;

            while (true)
            {
                ProgramFlow.DoNotUnroll();
                ProgramFlow.IOBarrier();
                Rdy.Next = '0';
                int x = X.Cur.IntValue;
                int y = Y.Cur.IntValue;
                int z;
                if (x == 0)
                {
                    z = y;
                }
                else
                {
                    while (y != 0)
                    {
                        ProgramFlow.DoNotUnroll();

                        if (x > y)
                        {
                            x -= y;
                        }
                        else
                        {
                            y -= x;
                        }
                    }
                    z = x;
                }
                Z.Next = StdLogicVector.FromInt(z, 32);
                await 63.Ticks();
                ProgramFlow.IOBarrier();
                Rdy.Next = '1';
                ProgramFlow.IOBarrier();
                await Tick;
            }
        }
Exemplo n.º 17
0
        private void WriteProcess()
        {
            if (Bus2IP_Clk.RisingEdge())
            {
                if (Bus2IP_Resetn.Cur == '0')
                {
                    for (int i = 0; i < NumWriteSignals; i++)
                    {
                        ProgramFlow.Unroll();
                        GetWriteSignal(i).NextObject = GetWriteSignal(i).InitialValueObject;
                    }
                }
                else
                {
                    for (int reg = 0; reg < NumRegs; reg++)
                    {
                        ProgramFlow.Unroll();

                        if (Bus2IP_WrCE.Cur[NumRegs - reg - 1] == '1')
                        {
                            for (int byteIdx = 0; byteIdx < SLVDWidth / 8; byteIdx++)
                            {
                                ProgramFlow.Unroll();

                                if (Bus2IP_BE.Cur[byteIdx] == '1')
                                {
                                    for (int bitIdx = 0; bitIdx < 8; bitIdx++)
                                    {
                                        ProgramFlow.Unroll();
                                        if (IsWriteBitPresent(reg, byteIdx, bitIdx))
                                        {
                                            GetWriteBit(reg, byteIdx, bitIdx).Next = Bus2IP_Data.Cur[8 * byteIdx + bitIdx];
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 18
0
        private void bLoadProgram_Click(object sender, EventArgs e)
        {
            CreateProgramCtrl fm = new CreateProgramCtrl(false);

            if (fm.ShowDialog() == DialogResult.OK)
            {
                string module = CommonHelper.GetEnumDescription(typeof(Module), fm.Module);

                this.Flow = ProgramFlow.Load($"{PathDefine.sPathProgram}{module}//{fm.ProgramName}.json");

                this.lModule.Text  = module;
                this.lProgram.Text = fm.ProgramName;
                if (this.Flow != null)
                {
                    if (this.Flow.NzUsed.Count > 0 && this.Flow.NzOffset.Count > 0)
                    {
                        this.bUsedNz1.Checked = this.Flow.NzUsed[Nozzle.Nz1];
                        this.bUsedNz2.Checked = this.Flow.NzUsed[Nozzle.Nz2];
                        this.bUsedNz3.Checked = this.Flow.NzUsed[Nozzle.Nz3];
                        this.bUsedNz4.Checked = this.Flow.NzUsed[Nozzle.Nz4];
                        this.nz1OffsetX.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz1].X;
                        this.nz1OffsetY.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz1].Y;
                        this.nz2OffsetX.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz2].X;
                        this.nz2OffsetY.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz2].Y;
                        this.nz3OffsetX.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz3].X;
                        this.nz3OffsetY.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz3].Y;
                        this.nz4OffsetX.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz4].X;
                        this.nz4OffsetY.Value = (decimal)this.Flow.NzOffset[Nozzle.Nz4].Y;
                    }

                    this.SetTree(null, this.Flow.PCB);
                    this.Module = this.Flow.Module;
                    this.programTree.ExpandAll();
                    this.programTree.Enabled = true;
                }
                else
                {
                    this.programTree.Enabled = false;
                }
            }
        }
Exemplo n.º 19
0
        private async void DivideProcess()
        {
            _rdy = true;
            while (true)
            {
                ProgramFlow.DoNotUnroll();

                while (!_nxt)
                {
                    ProgramFlow.DoNotUnroll();
                    await Tick;
                }

                _rdy = false;
                ProgramFlow.Barrier();
                _quotient = _dividend / _divisor;
                ProgramFlow.Barrier();
                await 10.Ticks();
                _rdy = true;
            }
        }
Exemplo n.º 20
0
        private async void Computation()
        {
            await Tick;

            while (true)
            {
                ProgramFlow.IOBarrier();
                Rdy.Next  = '0';
                Sum.Next  = StdLogicVector.FromInt(A.Cur.IntValue + B.Cur.IntValue, 32);
                Diff.Next = StdLogicVector.FromInt(A.Cur.IntValue - B.Cur.IntValue, 32);
                Prod.Next = StdLogicVector.FromInt(A.Cur.IntValue * B.Cur.IntValue, 32);
                Quot.Next = StdLogicVector.FromInt(B.Cur.IntValue / A.Cur.IntValue, 32);
                Neg.Next  = StdLogicVector.FromInt(-A.Cur.IntValue, 32);
                Abs.Next  = StdLogicVector.FromInt(Math.Abs(A.Cur.IntValue), 32);
                //await 9.Ticks();
                await NTicks(9);

                ProgramFlow.IOBarrier();
                Rdy.Next = '1';
                ProgramFlow.IOBarrier();
                await Tick;
            }
        }
Exemplo n.º 21
0
        protected async void MasterWrite(StdLogicVector addr, StdLogicVector data)
        {
            ip2bus_mstrd_req.Next       = '0';
            ip2bus_mstwr_req.Next       = '1';
            ip2bus_mst_type.Next        = '0';
            ip2bus_mst_addr.Next        = addr;
            ip2bus_mst_be.Next          = StdLogicVector._1s(NativeDataWidth / 8);
            ip2bus_mst_length.Next      = StdLogicVector._0s(LengthWidth);
            ip2bus_mst_lock.Next        = '0';
            ip2bus_mst_reset.Next       = '0';
            ip2bus_mstwr_d.Next         = data;
            ip2bus_mstwr_rem.Next       = StdLogicVector._0s(NativeDataWidth / 8);
            ip2bus_mstwr_sof_n.Next     = '0';
            ip2bus_mstwr_eof_n.Next     = '0';
            ip2bus_mstwr_src_rdy_n.Next = '0';
            ip2bus_mstwr_src_dsc_n.Next = '1';
            do
            {
                await Tick;
            } while (bus2ip_mst_cmdack.Cur != '1');
            do
            {
                ip2bus_mstwr_req.Next = '0';
                if (bus2ip_mstwr_dst_rdy_n.Cur == '0')
                {
                    break;
                }
                await Tick;
            } while (true);
            ip2bus_mstwr_src_rdy_n.Next = '1';
            ip2bus_mstwr_sof_n.Next     = '1';
            ip2bus_mstwr_eof_n.Next     = '1';
            await Tick;

            ProgramFlow.IOBarrier();
        }
Exemplo n.º 22
0
        private void ReadProcess()
        {
            StdLogicVector result = StdLogicVector._0s(SLVDWidth);

            for (int reg = 0; reg < NumRegs; reg++)
            {
                ProgramFlow.Unroll();

                if (Bus2IP_RdCE.Cur[NumRegs - reg - 1] == '1')
                {
                    for (int bit = 0; bit < SLVDWidth; bit++)
                    {
                        ProgramFlow.Unroll();

                        if (IsReadBitPresent(reg, bit))
                        {
                            result[bit] |= GetReadBit(reg, bit).Cur;
                        }
                    }
                }
            }

            IP2Bus_Data.Next = result;
        }
Exemplo n.º 23
0
    static void Main(string[] args)
    {
        ProgramFlow programFlow = new ProgramFlow();

        Console.ReadKey();
    }
 public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
 {
     return(new StandardValuesCollection(ProgramFlow.GetNodeList(typeof(BadmarkListNode))));
 }
Exemplo n.º 25
0
 public void Setup()
 {
     consoleInteraction = new ConsoleMock();
     programFlow        = new ProgramFlow(consoleInteraction);
 }