public static string GenerateFloatingPointType(VHDL.type.RealType typeDeclaration) { string typeName = typeDeclaration.Identifier; double rangeLeft = ((typeDeclaration.Range as VHDL.Range).From as VHDL.literal.RealLiteral).RealValue; double rangeRight = ((typeDeclaration.Range as VHDL.Range).To as VHDL.literal.RealLiteral).RealValue; RangeDirection rangeRirection = ((typeDeclaration.Range as VHDL.Range).Direction == VHDL.Range.RangeDirection.TO) ? RangeDirection.To : RangeDirection.DownTo; return(GenerateFloatingPointType(typeName, rangeLeft, rangeRight, rangeRirection)); }
public override void Observe(VHDLCompilerInterface compiler) { compiler.TypeDictionary.AddItem(type, type.Identifier); if (BuiltInTypesDictionary.ContainsBuiltInType(type)) { return; } if (type is VHDL.type.IntegerType) { VHDL.type.IntegerType intType = type as VHDL.type.IntegerType; ObserveIntegerType(compiler, intType); return; } if (type is VHDL.type.RealType) { VHDL.type.RealType realType = type as VHDL.type.RealType; ObserveFloatingPointType(compiler, realType); return; } if (type is VHDL.type.EnumerationType) { VHDL.type.EnumerationType enumType = type as VHDL.type.EnumerationType; ObserveEnumerationType(compiler, enumType); return; } if (type is VHDL.type.PhysicalType) { VHDL.type.PhysicalType physType = type as VHDL.type.PhysicalType; ObserveEnumerationType(compiler, physType); return; } }
public void ObserveFloatingPointType(VHDLCompilerInterface compiler, VHDL.type.RealType realType) { string code = FloatingPointTypeGeneratorHelper.GenerateFloatingPointType(realType); compiler.SaveCode(code, realType.Identifier); }
/// <summary> /// Конструктор /// </summary> /// <param name="type"></param> public RealValue(VHDL.type.RealType type) : base(type) { this._value = 0; }
/// <summary> /// Конструктор /// </summary> /// <param name="type"></param> public RealValue(VHDL.type.RealType type, double value) : base(type) { this._value = value; }