Пример #1
0
        /// <summary>
        /// Creates a SIGNED(width - 1 DOWNTO 0) subtype indication.
        /// </summary>
        /// <param name="width">the width</param>
        /// <returns>the subtype indication</returns>
        public static SubtypeIndication Create_SIGNED(Expression width)
        {
            Expression from = new Subtract(width, new DecimalLiteral(1));
            Expression to   = new DecimalLiteral(0);

            return(Create_SIGNED(new Range(from, Range.RangeDirection.DOWNTO, to)));
        }
Пример #2
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(")");
            }
        }
Пример #3
0
 /// <summary>
 /// Creates a case statement.
 /// </summary>
 /// <param name="expression">the expression</param>
 public CaseStatement(Expression expression)
 {
     this.expression = expression;
 }
Пример #4
0
 /// <summary>
 /// Creates a reject inertial delay mechanism.
 /// </summary>
 /// <param name="time">the puls rejection limit</param>
 public RejectInertialImpl(Expression time)
 {
     this.time = time;
 }
Пример #5
0
 /// <summary>
 /// Creates a reject inertial delay mechanism.
 /// </summary>
 /// <param name="time">the pulse rejection limit</param>
 /// <returns>the created delay mechanism.</returns>
 public static DelayMechanism REJECT_INERTIAL(Expression time)
 {
     return(new RejectInertialImpl(time));
 }
Пример #6
0
 /// <summary>
 /// Creates a waveform element with a delay.
 /// </summary>
 /// <param name="value">value the value</param>
 /// <param name="after">after the delay</param>
 public WaveformElement(Expression @value, Expression after)
 {
     this.value = @value;
     this.after = after;
 }
Пример #7
0
 /// <summary>
 /// Creates a waveform element.
 /// </summary>
 /// <param name="value">the value</param>
 public WaveformElement(Expression @value)
 {
     this.value = @value;
 }
Пример #8
0
 /// <summary>
 /// Creates a range.
 /// </summary>
 /// <param name="from">the from expression</param>
 /// <param name="direction">the direction</param>
 /// <param name="to">the to expression</param>
 public Range(Expression from, RangeDirection direction, Expression to)
 {
     this.from      = from;
     this.direction = direction;
     this.to        = to;
 }
Пример #9
0
 public override void visit(Expression expression)
 {
     VhdlOutputHelper.handleAnnotationsBefore(expression, writer);
     base.visit(expression);
     VhdlOutputHelper.handleAnnotationsAfter(expression, writer);
 }
Пример #10
0
 /// <summary>
 /// Sets the to expression.
 /// </summary>
 /// <param name="to">the value of the to expression</param>
 public virtual void setTo(int to)
 {
     this.to = new DecimalLiteral(to);
 }
Пример #11
0
 /// <summary>
 /// Sets the from expression.
 /// </summary>
 /// <param name="from">the value of the from expression</param>
 public virtual void setFrom(int from)
 {
     this.from = new DecimalLiteral(from);
 }
Пример #12
0
 /// <summary>
 /// Creates an association element with a formal and actual part.
 /// </summary>
 /// <param name="formal">the formal part</param>
 /// <param name="actual">the actual part</param>
 public AssociationElement(string formal, Expression actual)
 {
     this.formal = formal;
     this.actual = actual;
 }
Пример #13
0
 /// <summary>
 /// Creates an association element without a formal part.
 /// </summary>
 /// <param name="actual">actual the actual part</param>
 public AssociationElement(Expression actual)
 {
     this.actual = actual;
 }
Пример #14
0
        public static Expression create(ExpressionType type, Expression l, Expression r)
        {
            switch (type)
            {
            case ExpressionType.AND:
                return(new And(l, r));

            case ExpressionType.OR:
                return(new Or(l, r));

            case ExpressionType.NAND:
                return(new Nand(l, r));

            case ExpressionType.NOR:
                return(new Nor(l, r));

            case ExpressionType.XOR:
                return(new Xor(l, r));

            case ExpressionType.XNOR:
                return(new Xnor(l, r));

            case ExpressionType.EQ:
                return(new Equals(l, r));

            case ExpressionType.NEQ:
                return(new NotEquals(l, r));

            case ExpressionType.LT:
                return(new LessThan(l, r));

            case ExpressionType.LE:
                return(new LessEquals(l, r));

            case ExpressionType.GT:
                return(new GreaterThan(l, r));

            case ExpressionType.GE:
                return(new GreaterEquals(l, r));

            case ExpressionType.SLL:
                return(new Sll(l, r));

            case ExpressionType.SRL:
                return(new Srl(l, r));

            case ExpressionType.SLA:
                return(new Sla(l, r));

            case ExpressionType.SRA:
                return(new Sra(l, r));

            case ExpressionType.ROL:
                return(new Rol(l, r));

            case ExpressionType.ROR:
                return(new Ror(l, r));

            case ExpressionType.ADD:
                return(new Add(l, r));

            case ExpressionType.SUB:
                return(new Subtract(l, r));

            case ExpressionType.CONCAT:
                return(new Concatenate(l, r));

            case ExpressionType.MUL:
                return(new Multiply(l, r));

            case ExpressionType.DIV:
                return(new Divide(l, r));

            case ExpressionType.MOD:
                return(new Mod(l, r));

            case ExpressionType.REM:
                return(new Rem(l, r));

            default:
                return(null);
            }
        }