1 // 2 // Copyright (c) 2010-2025 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 Antmicro.Renode.Utilities; 9 10 namespace Antmicro.Renode.Core 11 { 12 public 13 #if NET 14 readonly 15 #endif 16 struct StateMask 17 { StateMaskAntmicro.Renode.Core.StateMask18 public StateMask(ulong state, ulong mask) 19 { 20 State = state; 21 Mask = mask; 22 } 23 HasMaskBitAntmicro.Renode.Core.StateMask24 public bool HasMaskBit(int position) 25 { 26 return BitHelper.IsBitSet(Mask, (byte)position); 27 } 28 WithBitValueAntmicro.Renode.Core.StateMask29 public StateMask WithBitValue(int position, bool value) 30 { 31 var bit = (ulong)BitHelper.Bit((byte)position); 32 return new StateMask(State | (value ? bit : 0), Mask | bit); 33 } 34 35 public readonly ulong State; 36 public readonly ulong Mask; 37 38 public static readonly StateMask AllAccess = new StateMask(0, 0); 39 } 40 } 41