private void appendBlockConfiguration(AbstractBlockConfiguration block, string blockSpecification)
        {
            writer.Append(KeywordEnum.FOR.ToString()).Append(' ');
            writer.Append(blockSpecification);
            writer.NewLine().Indent();

            foreach (UseClause useClause in block.UseClauses)
            {
                output.writeLibraryUnit(useClause);
            }
            visit(block.ConfigurationItems);

            writer.Dedent().Append(KeywordEnum.END.ToString()).Append(KeywordEnum.FOR.ToString()).Append(";").NewLine();
        }
 //TODO: add mode
 public static void variableInterfaceSuffix(Variable variable, VhdlWriter writer, OutputModule output)
 {
     output.writeSubtypeIndication(variable.Type);
     if (variable.DefaultValue != null)
     {
         writer.Append(" := ");
         output.writeExpression(variable.DefaultValue);
     }
 }
 public static void constantInterfaceSuffix(Constant constant, VhdlWriter writer, OutputModule output)
 {
     output.writeSubtypeIndication(constant.Type);
     if (constant.DefaultValue != null)
     {
         writer.Append(" := ");
         output.writeExpression(constant.DefaultValue);
     }
 }
        //TODO: write BUS keyword
        public static void signalInterfaceSuffix(Signal signal, VhdlWriter writer, OutputModule output)
        {
            output.writeSubtypeIndication(signal.Type);

            if (signal.Kind == Signal.KindEnum.BUS)
            {
                writer.Append(' ').Append(signal.Kind.ToString());
            }
            else if (signal.Kind == Signal.KindEnum.REGISTER)
            {
                throw new Exception("Signal kind register isn't allowed in an interface declaration");
            }

            if (signal.DefaultValue != null)
            {
                writer.Append(" := ");
                output.writeExpression(signal.DefaultValue);
            }
        }
Пример #5
0
        public static void handleAnnotationsAfter(VhdlElement element, VhdlWriter writer)
        {
            if (element == null)
            {
                return;
            }

            foreach (string comment in Comments.GetCommentsAfter(element))
            {
                writer.Append("--").Append(comment).NewLine();
            }
        }
 private void appendLabel(ConcurrentStatement statement)
 {
     if (statement.Label != null)
     {
         writer.Append(statement.Label).Append(" : ");
     }
 }
 public void delayMechanism(DelayMechanism delayMechanism)
 {
     if (delayMechanism == DelayMechanism.INERTIAL)
     {
         writer.Append(KeywordEnum.INERTIAL.ToString());
     }
     else if (delayMechanism == DelayMechanism.TRANSPORT)
     {
         writer.Append(KeywordEnum.TRANSPORT.ToString());
     }
     else
     {
         writer.Append(KeywordEnum.REJECT.ToString()).Append(' ');
         output.writeExpression(delayMechanism.PulseRejectionLimit);
         writer.Append(' ').Append(KeywordEnum.INERTIAL.ToString());
     }
 }
Пример #8
0
        private void appendProcedureParameters(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];

                    if (isOutputObjectClassProcedure(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(")");
            }
        }
Пример #9
0
        private void appendExpression(Expression expression, int precedence)
        {
            if (expression == null)
            {
                writer.Append("null");
                return;
            }

            bool writeParenthesis = expression.Precedence < precedence;

            if (writeParenthesis)
            {
                writer.Append("(");
            }
            visit(expression);
            if (writeParenthesis)
            {
                writer.Append(")");
            }
        }
Пример #10
0
 private void appendLabel(SequentialStatement statement)
 {
     if (statement.Label != null)
     {
         writer.Append(statement.Label).Append(" : ");
     }
 }
 protected override void visitArchitecture(Architecture architecture)
 {
     writer.Append(KeywordEnum.ARCHITECTURE.ToString()).Append(' ');
     writer.AppendIdentifier(architecture).Append(' ');
     writer.Append(KeywordEnum.OF.ToString()).Append(' ');
     writer.AppendIdentifier(architecture.Entity).Append(' ');
     writer.Append(KeywordEnum.IS.ToString()).NewLine().Indent();
     output.writeDeclarationMarkers(architecture.Declarations);
     writer.Dedent().Append(KeywordEnum.BEGIN.ToString()).NewLine().Indent();
     output.writeConcurrentStatements(architecture.Statements);
     writer.Dedent().Append(KeywordEnum.END.ToString()).Append(";").NewLine();
 }
Пример #12
0
 private void appendTypePrefix(Type declaration)
 {
     writer.Append(KeywordEnum.TYPE.ToString()).Append(' ');
     writer.AppendIdentifier(declaration).Append(' ').Append(KeywordEnum.IS.ToString());
 }
Пример #13
0
        public void visit(IndexedName name)
        {
            output.writeExpression(name.Prefix);
            writer.Append('(');
            bool first = true;

            foreach (Expression index in name.Indices)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    writer.Append(", ");
                }
                output.writeExpression(index);
            }
            writer.Append(')');
        }