Exemple #1
0
 public void RemoveItem(VhdlObject key)
 {
     if (intenalDictionary.Keys.Contains(key) == true)
     {
         intenalDictionary.Remove(key);
     }
 }
Exemple #2
0
 public void AddItem(VhdlObject key, string value)
 {
     if (intenalDictionary.Keys.Contains(key) == false)
     {
         intenalDictionary.Add(key, value);
     }
 }
        private void writeInterfaceList <T1>(IList <T1> list, bool isGeneric) where T1 : VhdlObjectProvider
        {
            writer.BeginAlign();

            bool first = true;

            foreach (VhdlObjectProvider objectProvider in list)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    writer.Append(";").NewLine();
                }

                if (objectProvider is VhdlObjectGroup <VhdlObject> )
                {
                    VhdlObjectGroup <VhdlObject> group = (VhdlObjectGroup <VhdlObject>)objectProvider;
                    VhdlOutputHelper.handleAnnotationsBefore(group, writer);
                }

                //TODO: check for equal types etc.
                VhdlObject obj0 = objectProvider.VhdlObjects[0];

                InterfaceDeclarationFormat format = Annotations.getAnnotation <InterfaceDeclarationFormat>(obj0);

                if (format != null && format.UseObjectClass)
                {
                    writer.Append(obj0.ObjectClass.ToString()).Append(' ');
                }

                writer.AppendIdentifiers(objectProvider.VhdlObjects, ", ");
                writer.Align();

                writer.Append(" : ");

                if (format != null)
                {
                    if (format.UseMode || (obj0.Mode != VhdlObject.ModeEnum.IN))
                    {
                        writer.Append(obj0.Mode.ToString()).Append(' ');
                    }
                }
                else
                {
                    if (!isGeneric || obj0.Mode != VhdlObject.ModeEnum.IN)
                    {
                        writer.Append(obj0.Mode.ToString()).Append(' ');
                    }
                }

                VhdlObjectOutputHelper.interfaceSuffix(obj0, writer, output);
            }

            writer.NewLine().EndAlign();
        }
Exemple #4
0
        private bool isOutputObjectClassFunction(VhdlObject @object)
        {
            InterfaceDeclarationFormat format = Annotations.getAnnotation <InterfaceDeclarationFormat>(@object);

            if (format != null && format.UseObjectClass)
            {
                return(true);
            }

            return(@object.ObjectClass != VhdlObject.ObjectClassEnum.CONSTANT);
        }
Exemple #5
0
 public string this[VhdlObject key]
 {
     get
     {
         if (intenalDictionary.Keys.Contains(key) == false)
         {
             return(null);
         }
         return(intenalDictionary[key]);
     }
 }
Exemple #6
0
        private bool isOutputMode(VhdlObject @object)
        {
            if (@object.Mode == VhdlObject.ModeEnum.NONE)
            {
                return(false);
            }

            InterfaceDeclarationFormat format = Annotations.getAnnotation <InterfaceDeclarationFormat>(@object);

            if (format != null && format.UseMode)
            {
                return(true);
            }

            return(@object.Mode != VhdlObject.ModeEnum.IN);
        }
Exemple #7
0
        private bool isOutputObjectClassProcedure(VhdlObject @object)
        {
            InterfaceDeclarationFormat format = Annotations.getAnnotation <InterfaceDeclarationFormat>(@object);

            if (format != null && format.UseObjectClass)
            {
                return(true);
            }

            switch (@object.ObjectClass)
            {
            case VhdlObject.ObjectClassEnum.CONSTANT:
                return(false);

            case VhdlObject.ObjectClassEnum.VARIABLE:
                return(@object.Mode != Variable.ModeEnum.INOUT && @object.Mode != Variable.ModeEnum.OUT);

            default:
                return(true);
            }
        }
Exemple #8
0
        private void appendFunctionParameters(IList <VhdlObjectProvider> parameters)
        {
            if (parameters.Count != 0)
            {
                writer.Append(" (");
                bool first = true;
                foreach (var provider in parameters)
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        writer.Append("; ");
                    }

                    VhdlObject object0 = provider.VhdlObjects[0];

                    //don't add type if object is a constant
                    if (isOutputObjectClassFunction(object0))
                    {
                        writer.Append(object0.ObjectClass.ToString()).Append(' ');
                    }

                    writer.AppendIdentifiers(provider.VhdlObjects, ", ");

                    writer.Append(" : ");

                    if (isOutputMode(object0))
                    {
                        writer.Append(object0.Mode.ToString()).Append(' ');
                    }

                    VhdlObjectOutputHelper.interfaceSuffix(object0, writer, output);
                }
                writer.Append(")");
            }
        }
 public static void interfaceSuffix(VhdlObject @object, VhdlWriter writer, OutputModule output)
 {
     if (@object is Signal)
     {
         signalInterfaceSuffix((Signal)@object, writer, output);
     }
     else if (@object is Constant)
     {
         constantInterfaceSuffix((Constant)@object, writer, output);
     }
     else if (@object is Variable)
     {
         variableInterfaceSuffix((Variable)@object, writer, output);
     }
     else if (@object is FileObject)
     {
         fileInterfaceSuffix((FileObject)@object, writer, output);
     }
     else
     {
         throw new ArgumentException("Unknown interface element.");
     }
 }
Exemple #10
0
 public static SimpleName reference(VhdlObject obj)
 {
     return(new SimpleName(obj));
 }