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();
        }
Beispiel #2
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(")");
            }
        }