コード例 #1
0
        public TIME_VALUE(PhysicalLiteral literal)
            : base(Standard.TIME)
        {
            //if (literal.GetPhysicalType() == VHDL.builtin.Standard.TIME)
            //{
            UInt64 multiplyer = 0;

            switch (literal.Unit)
            {
            case "s": multiplyer = (ulong)1e15; break;

            case "ms": multiplyer = (ulong)1e12; break;

            case "us": multiplyer = (ulong)1e9; break;

            case "ns": multiplyer = (ulong)1e6; break;

            case "ps": multiplyer = (ulong)1e3; break;

            case "fs": multiplyer = (ulong)1; break;
            }
            UInt64 value = UInt64.Parse(literal.Value.ToString());

            DoubleValue = value * multiplyer;
            //}
            //else
            //{
            //    throw new NotImplementedException();
            //}
        }
コード例 #2
0
        public static string GetPhysicalLiteralOperand(PhysicalLiteral expression, VHDLCompilerInterface compiler)
        {
            string unitName = string.Format("\"{0}\"", expression.Unit);
            Int64  val      = (expression.Value as IntegerLiteral).IntegerValue;
            string physType = compiler.TypeDictionary[expression.GetPhysicalType()];
            NewStatementTemplate template = new NewStatementTemplate(physType, val, unitName);

            return(template.TransformText());
        }
コード例 #3
0
 public void visit(PhysicalLiteral literal)
 {
     baseInfer.AnalyzeType(literal.Type);
 }
コード例 #4
0
 public static string GetPhysicalLiteralExpresstionType(PhysicalLiteral expression, VHDLCompilerInterface compiler)
 {
     return(compiler.TypeDictionary[expression.Type]);
 }
コード例 #5
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="type"></param>
 public PhysicalValue(VHDL.type.PhysicalType type, PhysicalLiteral physicalValue)
     : base(type)
 {
     this._value = physicalValue;
 }
コード例 #6
0
 public AbstractValue Evaluate(PhysicalLiteral expr)
 {
     //if (expr.GetPhysicalType().Equals(VHDL.builtin.Standard.TIME))
     return(new TIME_VALUE(expr));
     //return new PhysicalValue(expr.getType() as VHDL.type.PhysicalType, expr);
 }