Beispiel #1
0
        Boolean implementCongfiguration(ExtractedInterface interfaceInstance, string insertionPoint, StringBuilder sbText)
        {
            Boolean configOccured = false;
            string  line          = "";
            string  if_name       = interfaceInstance.Name.Trim();
            string  ip            = insertionPoint.Trim();

            if (configPath == "")
            {
                return(false);
            }
            using (var reader = new System.IO.StreamReader(configPath)) {
                while ((line = reader.ReadLine()) != null)
                {
                    if (line == "begin " + if_name)
                    {
                        while ((line = reader.ReadLine()) != "end " + if_name)
                        {
                            if (line == ip)
                            {
                                configOccured = true;
                                line          = reader.ReadLine();
                                while (!string.IsNullOrWhiteSpace(line))
                                {
                                    sbText.AppendLine(line);
                                    line = reader.ReadLine();
                                }
                            }
                        }
                    }
                }
            }
            return(configOccured);
        }
Beispiel #2
0
        void configureTB(string configPath)
        {
            string line = "";

            using (var reader = new System.IO.StreamReader(configPath)) {
                while ((line = reader.ReadLine()) != null)
                {
                    string        InterfaceName         = "";
                    string        InterfaceType         = "";
                    string        InterfaceDirection    = "";
                    List <string> SignalNames           = new List <string> ();
                    List <PortInterfaceElement> Signals = new List <PortInterfaceElement> ();
                    if (line == "InterfaceConfiguration:")
                    {
                        while ((line = reader.ReadLine().Trim()) != ("end " + InterfaceName))
                        {
                            if (line.Equals("InterfaceName:"))
                            {
                                line          = reader.ReadLine().Trim();
                                InterfaceName = line;
                            }
                            if (line.Equals("InterfaceType:"))
                            {
                                line          = reader.ReadLine().Trim();
                                InterfaceType = line;
                            }
                            if (line.Equals("InterfaceDirection:"))
                            {
                                line = reader.ReadLine().Trim();
                                InterfaceDirection = line;
                            }
                            if (line.Equals("Signals:"))
                            {
                                line = reader.ReadLine().Trim();
                                while (!string.IsNullOrWhiteSpace(line))
                                {
                                    SignalNames.Add(line);
                                    line = reader.ReadLine().Trim();
                                }
                            }
                        }

                        if (InterfaceName != null && InterfaceType != null && SignalNames != null)
                        {
                            //The actual signals are now extract from port map using the names specified in the config file.
                            //The signals added must now also be removed from the not in interface list.
                            foreach (PortInterfaceElement Element in Source.Portmap.Expressions)
                            {
                                if (SignalNames.Contains(Element.Name))
                                {
                                    Signals.Add(Element);
                                    Source.Portmap.NotInInterface.Remove(Element);
                                }
                            }

                            ExtractedInterface extracted = new ExtractedInterface(InterfaceName, InterfaceType, Signals, new PortInterfaceElement("", InterfaceDirection, "", new nullType(), false), new PortInterfaceElement("", InterfaceDirection, "", new nullType(), false), new PortInterfaceElement("", InterfaceDirection, "", new nullType(), false), new PortInterfaceElement("", InterfaceDirection, "", new nullType(), false), false);
                            configuredInterfaces.Add(extracted);
                            Source.Portmap.InterfaceList.Add(extracted);
                        }
                        else
                        {
                            throw new ParserException("Not all parameters have been specified in the config.sv file for interface: " + InterfaceName);
                        }
                    }
                }
            }
        }