Пример #1
0
        public My_Port(EntityDrawningCore core, PortType type, bool Inverse)
            : base(core)
        {
            this.Inverse = Inverse;
            this.type    = type;
            Name         = "New_Port";

            TextLabel       = new My_Text(core, Name, new Point(0, 0));
            TextLabel.Owner = this;

            vhdPort = new vhdPort();

            draw       = Draw;
            mouse_move = MouseMoveCreateNew;
            mouse_down = MouseDownCreateNew;
            mouse_up   = MouseUpCreateNew;
        }
Пример #2
0
        public My_Port(EntityDrawningCore core, String Name, PortType type, bool Inverse, vhdPort vhdPort, Point point1, Point point2)
            : base(core)
        {
            this.Inverse = Inverse;
            this.type    = type;
            this.Name    = Name;
            this.point1  = point1;
            this.point2  = point2;
            this.vhdPort = vhdPort;

            TextLabel       = new My_Text(core, Name, new Point(0, 0));
            TextLabel.Owner = this;

            draw       = Draw;
            mouse_move = MouseMove;
            mouse_down = MouseDown;
            mouse_up   = MouseUp;
        }
Пример #3
0
        public My_Port(My_Port item)
            : base(item)
        {
            point1 = item.point1;
            point2 = item.point2;

            Inverse   = item.Inverse;
            type      = item.type;
            this.Name = item.Name;

            this.vhdPort = item.vhdPort;

            TextLabel       = new My_Text(item.TextLabel);
            TextLabel.Owner = this;

            mouse_move = MouseMove;
            mouse_down = MouseDown;
            mouse_up   = MouseUp;
            draw       = Draw;
        }
Пример #4
0
        public void Parsing(string FileName)
        {
            char[]        razd = { ' ', ';', ',', '(', ')', '-', '+', '=', ':', '\t', '\n', '\r' };
            FileStream    fs   = new FileStream(FileName, FileMode.Open);
            StreamReader  sr   = new StreamReader(fs);
            string        str;
            string        str2;
            string        var_type = "";
            string        bus_size = "";
            string        bus_var  = "";
            vhdEntity     ent;
            vhdPort       port;
            generic       gener;
            string        type = "";
            portInOut     inout;
            bool          bus        = false;
            int           gen_num    = 0;
            int           leftBound  = 0;
            int           rightBound = 0;
            List <string> names      = new List <string>();

            while (!(sr.EndOfStream))
            {
                str = nextWord(fs, sr, razd);
                if (str.CompareTo("entity") == 0)
                {
                    ent      = new vhdEntity();
                    gener    = new generic();
                    ent.name = nextWord(fs, sr, razd);


                    if (nextWord(fs, sr, razd).CompareTo("is") == 0)
                    {
                        str = nextWord(fs, sr, razd);
                        while (str.CompareTo("generic") == 0)
                        {
                            bus_var  = nextWord(fs, sr, razd);
                            var_type = nextWord(fs, sr, razd);
                            var_type = var_type.ToLower();
                            bus_size = nextWord(fs, sr, razd);
                            //str = nextWord(fs,sr,razd);
                            if (var_type == "real" || var_type == "natural" || var_type == "integer")
                            {
                                gen_num           = gen_num + 1;
                                gener.number      = gen_num;
                                gener.var_name    = bus_var;
                                gener.type_of_var = var_type;
                                gener.var_value   = StrToInt(bus_size);
                                ent.gen_cont.Add(new generic(gener));
                            }
                            str = nextWord(fs, sr, razd);
                        }
                        str  = nextWord(fs, sr, razd);
                        str2 = nextWord(fs, sr, razd);
                        while (str.CompareTo("end") != 0)
                        {
                            names.Clear();
                            names.Add(str);
                            while (!(str2.CompareTo("in") == 0 ||
                                     str2.CompareTo("out") == 0 ||
                                     str2.CompareTo("inout") == 0 ||
                                     str2.CompareTo("buffer") == 0))
                            {
                                names.Add(str2);
                                str2 = nextWord(fs, sr, razd);
                            }
                            if (str2.CompareTo("in") == 0)
                            {
                                inout = portInOut.In;
                            }
                            else
                            if (str2.CompareTo("out") == 0)
                            {
                                inout = portInOut.Out;
                            }
                            else
                            {
                                inout = portInOut.InOut;
                            }
                            type       = nextWord(fs, sr, razd);
                            bus        = false;
                            leftBound  = 0;
                            rightBound = 0;
                            str        = nextWord(fs, sr, razd);
                            if (str != "end")
                            {
                                str2 = nextWord(fs, sr, razd);
                            }
                            while (str2.CompareTo("to") == 0 || str2.CompareTo("downto") == 0)
                            {
                                str2 = nextWord(fs, sr, razd);

                                foreach (generic gen in ent.gen_cont)
                                {
                                    //if (str == gen.var_name || str2 == gen.var_name)
                                    //{
                                    if (str == gen.var_name)
                                    {
                                        leftBound  = gen.var_value;
                                        rightBound = StrToInt(str2);
                                    }

                                    /*else
                                     * leftBound = gen.var_value;
                                     * rightBound = StrToInt(str2);*/

                                    if (str2 == gen.var_name)
                                    {
                                        leftBound  = StrToInt(str);
                                        rightBound = gen.var_value;
                                    }

                                    //}
                                }

                                bus = true;
                                //leftBound = StrToInt(str);
                                //rightBound = StrToInt(str2);
                                str  = nextWord(fs, sr, razd);
                                str2 = nextWord(fs, sr, razd);
                            }
                            int i;
                            for (i = 0; i < names.Count; i++)
                            {
                                port            = new vhdPort();
                                port.name       = names[i];
                                port.inout      = inout;
                                port.type       = type;
                                port.bus        = bus;
                                port.leftBound  = leftBound;
                                port.rightBound = rightBound;
                                ent.ports.Add(port);
                            }
                        }

                        entities.Add(ent);
                    }
                }
            }
            sr.Close();
        }