public static string GenerateIntegerType(VHDLCompilerInterface compiler, VHDL.type.IntegerType typeDeclaration) { string typeName = typeDeclaration.Identifier; Int64 rangeLeft = ((typeDeclaration.Range as VHDL.Range).From as VHDL.literal.IntegerLiteral).IntegerValue; Int64 rangeRight = ((typeDeclaration.Range as VHDL.Range).To as VHDL.literal.IntegerLiteral).IntegerValue; RangeDirection rangeRirection = ((typeDeclaration.Range as VHDL.Range).Direction == VHDL.Range.RangeDirection.TO) ? RangeDirection.To : RangeDirection.DownTo; IntegerTypeTemplate template = new IntegerTypeTemplate(typeName, rangeLeft, rangeRight, rangeRirection); string text = template.TransformText(); compiler.TypeRangeDictionary.AddItem(typeDeclaration, "IntegerRange", template.RangeLeft, template.RangeRight, template.Direction); return(text); }
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 ObserveIntegerType(VHDLCompilerInterface compiler, VHDL.type.IntegerType intType) { string code = IntegerTypeGeneratorHelper.GenerateIntegerType(compiler, intType); compiler.SaveCode(code, intType.Identifier); }
/// <summary> /// Конструктор /// </summary> /// <param name="type"></param> public IntegerValue(VHDL.type.IntegerType type) : base(type) { this._value = 0; }
/// <summary> /// Конструктор /// </summary> /// <param name="type"></param> public IntegerValue(VHDL.type.IntegerType type, int value) : base(type) { this._value = value; }