Ejemplo n.º 1
0
 public FSM_Options(VHDL_Module module)
 {
     this.vhdl_module = module;
     this.language    = Schematix.FSM.FSM_Language.VHDL;
     Options          = new FSM_OptionsHelper();
     InitializeComponent();
 }
Ejemplo n.º 2
0
        internal static Schematix.ProjectExplorer.FSM_File CreateWizardFSM(string p, VHDL_Module vHDL_Module, FSM_OptionsHelper fSM_OptionsHelper, SchematixCore core, ProjectExplorer.ProjectFolder projectFolder)
        {
            string           path = System.IO.Path.Combine(projectFolder.Path, string.Concat(p, ".fsm"));
            Constructor_Core cc   = new Constructor_Core(null);

            Schematix.Windows.FSM.FSM_Utils.InitVHDLData(fSM_OptionsHelper, vHDL_Module, cc);
            cc.SaveToFile(path);

            Schematix.ProjectExplorer.FSM_File fsm = new ProjectExplorer.FSM_File(path, projectFolder);
            projectFolder.AddElement(fsm);

            core.SaveSolution();
            core.UpdateExplorerPanel();
            return(fsm);
        }
Ejemplo n.º 3
0
        private void ButtonOk_Click(object sender, EventArgs e)
        {
            string sArch   = ArchName.Text;
            string sEntity = EntityName.Text;

            if (string.IsNullOrEmpty(EntityName.Text) == true)
            {
                sEntity = FileName.Text;
            }
            if (string.IsNullOrEmpty(ArchName.Text) == true)
            {
                sArch = FileName.Text;
            }

            VHDLModule = new VHDL_Module();
            VHDLModule.ArchitectureName = sArch;
            VHDLModule.EntityName       = sEntity;
            VHDLModule.PortList         = PortList;

            DialogResult = System.Windows.Forms.DialogResult.OK;

            Close();
        }
Ejemplo n.º 4
0
 public VHDL_VizardCodeGenerator(VHDL_Module module)
 {
     this.EntityName       = module.EntityName;
     this.ArchitectureName = module.ArchitectureName;
     this.PortList         = module.PortList;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Иницализация данных при зоздании FSM с языком VHDL
        /// </summary>
        /// <param name="options"></param>
        /// <param name="vhdl_module"></param>
        public static void InitVHDLData(
            FSM_OptionsHelper options,
            VHDL_Module vhdl_module,
            Constructor_Core core

            )
        {
            //загружаем данные VHDL
            //Добавляем порты
            List <My_Port> NewPortsFSM = new List <My_Port>();
            Point          pt          = new Point(50, 50);

            foreach (VHDL_Port p in vhdl_module.PortList)
            {
                My_Port new_port = CreatePort(p, pt, core);
                NewPortsFSM.Add(new_port);
                pt.Y += 40;
            }
            core.Graph.AddFigureRange(NewPortsFSM);
            //-----------------------------

            core.Graph.VHDLModule = vhdl_module;

            //добавляем состояния
            if (options.NumberOfStates != 0)
            {
                #region Add States
                switch (options.StatesLayout)
                {
                case FSM_OptionsHelper.FSMStatesLayout.LinearHorisontal:
                {
                    pt = new Point(100, 70);
                    System.Drawing.Size size = new System.Drawing.Size(40, 40);
                    int Distance             = 100;
                    for (int i = 0; i < options.NumberOfStates; i++)
                    {
                        My_State state = new My_State(core, new Rectangle(pt, size), true);
                        state.name = string.Format("S{0}", i);
                        core.Graph.AddFigure(state);
                        pt.X += Distance;
                    }
                }
                break;

                case FSM_OptionsHelper.FSMStatesLayout.LinearVertical:
                {
                    pt = new Point(100, 70);
                    System.Drawing.Size size = new System.Drawing.Size(40, 40);
                    int Distance             = 100;
                    for (int i = 0; i < options.NumberOfStates; i++)
                    {
                        My_State state = new My_State(core, new Rectangle(pt, size), true);
                        state.name = string.Format("S{0}", i);
                        core.Graph.AddFigure(state);
                        pt.Y += Distance;
                    }
                }
                break;

                case FSM_OptionsHelper.FSMStatesLayout.Circular:
                {
                    Point Start_Point        = new Point(100, 70);
                    System.Drawing.Size size = new System.Drawing.Size(40, 40);
                    double angle             = 0;
                    int    Radius            = (options.NumberOfStates / 4 + 1) * 50;
                    for (int i = 0; i < options.NumberOfStates; i++)
                    {
                        pt.X = (int)(Radius * Math.Cos(angle)) + Radius + Start_Point.X;
                        pt.Y = (int)(Radius * Math.Sin(angle)) + Radius + Start_Point.Y;

                        My_State state = new My_State(core, new Rectangle(pt, size), true);
                        state.name = string.Format("S{0}", i);
                        core.Graph.AddFigure(state);

                        angle += (2 * Math.PI / (double)options.NumberOfStates);
                    }
                }
                break;

                default:
                    break;
                }
                #endregion ;

                #region Add Transitions
                switch (options.Transition)
                {
                case FSM_OptionsHelper.FSMTransition.None:
                { }
                break;

                case FSM_OptionsHelper.FSMTransition.Forward:
                {
                    for (int i = 0; i < options.NumberOfStates; i++)
                    {
                        My_State s1 = core.Graph.States[i];
                        My_State s2 = (i < (options.NumberOfStates - 1)) ? core.Graph.States[i + 1] : core.Graph.States[0];

                        My_Line line = new My_Line(s1, s2, string.Format("L{0}", i), "", core);
                        core.Graph.AddFigure(line);
                    }
                }
                break;

                case FSM_OptionsHelper.FSMTransition.Backward:
                {
                    for (int i = 0; i < options.NumberOfStates; i++)
                    {
                        My_State s2 = core.Graph.States[i];
                        My_State s1 = (i < (options.NumberOfStates - 1)) ? core.Graph.States[i + 1] : core.Graph.States[0];

                        My_Line line = new My_Line(s1, s2, string.Format("L{0}", i), "", core);
                        core.Graph.AddFigure(line);
                    }
                }
                break;

                case FSM_OptionsHelper.FSMTransition.Both:
                {
                    for (int i = 0; i < options.NumberOfStates; i++)
                    {
                        My_State s1 = core.Graph.States[i];
                        My_State s2 = (i < (options.NumberOfStates - 1)) ? core.Graph.States[i + 1] : core.Graph.States[0];

                        My_Line line1 = new My_Line(s1, s2, string.Format("L{0}", 2 * i), "", core);
                        core.Graph.AddFigure(line1);
                        My_Line line2 = new My_Line(s2, s1, string.Format("L{0}", 2 * i + 1), "", core);
                        core.Graph.AddFigure(line2);
                        core.Graph.UpdateLinesAggle(s1, s2);
                    }
                }
                break;

                default:
                    break;
                }
                #endregion

                #region AddReset
                #endregion
            }
            //-----------------------------
        }