This repository has been archived on 2026-04-18. You can view files and clone it, but cannot push or open issues or pull requests.
Virtual-Memory-Demo/Assets/Scripts/Simulation/TlbEntry.cs

30 lines
621 B
C#

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}";
}
}
}