1 // 2 // Copyright (c) 2010-2018 Antmicro 3 // 4 // This file is licensed under the MIT License. 5 // Full license text is available in 'licenses/MIT.txt'. 6 // 7 8 using System.Collections.Generic; 9 using Sprache; 10 11 namespace Antmicro.Renode.PlatformDescription.Syntax 12 { 13 public sealed class IrqReceiver : IPositionAware<IrqReceiver>, IWithPosition, IVisitable 14 { IrqReceiver(ReferenceValue reference, int? localIndex)15 public IrqReceiver(ReferenceValue reference, int? localIndex) 16 { 17 Reference = reference; 18 LocalIndex = localIndex; 19 } 20 SetPos(Position startPos, int length)21 public IrqReceiver SetPos(Position startPos, int length) 22 { 23 var copy = SerializationProvider.Instance.DeepClone(this); 24 copy.StartPosition = startPos; 25 copy.Length = length; 26 return copy; 27 } 28 ToShortString()29 public string ToShortString() 30 { 31 return Reference.ToShortString() + (LocalIndex != null ? "#" + LocalIndex.ToString() : ""); 32 } 33 Visit()34 public IEnumerable<object> Visit() 35 { 36 return new[] { Reference }; 37 } 38 39 public ReferenceValue Reference { get; private set; } 40 public int? LocalIndex { get; private set; } 41 public Position StartPosition { get; private set; } 42 public int Length { get; private set; } 43 } 44 } 45