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(); //} }
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()); }
public void visit(PhysicalLiteral literal) { baseInfer.AnalyzeType(literal.Type); }
public static string GetPhysicalLiteralExpresstionType(PhysicalLiteral expression, VHDLCompilerInterface compiler) { return(compiler.TypeDictionary[expression.Type]); }
/// <summary> /// Конструктор /// </summary> /// <param name="type"></param> public PhysicalValue(VHDL.type.PhysicalType type, PhysicalLiteral physicalValue) : base(type) { this._value = physicalValue; }
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); }