using System;

namespace VMdemo.Simulation
{
    [Serializable]
    public readonly struct TlbEntry
    {
        public TlbEntry(ulong vpn, ulong pfn, bool isValid = true)
        {
            Vpn = vpn;
            Pfn = pfn;
            IsValid = isValid;
        }

        public ulong Vpn { get; }
        public ulong Pfn { get; }
        public bool IsValid { get; }

        public TlbEntry WithPfn(ulong pfn)
        {
            return new TlbEntry(Vpn, pfn, true);
        }

        public override string ToString()
        {
            return $"VPN={Vpn}, PFN={Pfn}, Valid={IsValid}";
        }
    }
}
