emulation: ticktimer: fix higher bits of ticktimer

The ticktimer wasn't properly adjusting the upper bits, meaning delays
of more than 42 days did not function properly. This was discovered as
part of the libstd tests.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2023-01-30 21:59:30 +08:00
parent b5b22c9119
commit 4133238d8a

View file

@ -100,7 +100,7 @@ namespace Antmicro.Renode.Peripherals.Timers.Betrusted
Registers.MsleepTarget1.Define32(this)
.WithValueField(0, 32, name: "MsleepTarget1", writeCallback: (_, value) =>
{
this.msleepTarget = (this.msleepTarget & 0x00000000ffffffff) | (value << 32);
this.msleepTarget = (this.msleepTarget & 0x00000000ffffffff) | (((ulong)value) << 32);
this.Log(LogLevel.Noisy, "Setting MsleepTarget1: {0}, sleep target now: {1}", value, this.msleepTarget);
},
valueProviderCallback: _ =>
@ -142,7 +142,7 @@ namespace Antmicro.Renode.Peripherals.Timers.Betrusted
public bool paused;
public long tickValue;
ulong msleepTarget;
public ulong msleepTarget;
public GPIO IRQ { get; private set; }
private enum Registers