Prepare the Renode models for changing the PeripheralRegister underlying type As the `PeripheralRegister` underlying value type is about to change from `ulong` to `uint` all models have to be adjusted accordingly. This change is compatible with both the upcoming change and with the current master/nightly. Change-Id: I7422ae92a2767288cbc899602a8a3b7a45080f3c
diff --git a/shodan_infrastructure/DoubleBufferDMA.cs b/shodan_infrastructure/DoubleBufferDMA.cs index 4034335..8f41019 100644 --- a/shodan_infrastructure/DoubleBufferDMA.cs +++ b/shodan_infrastructure/DoubleBufferDMA.cs
@@ -58,7 +58,7 @@ // Restore bottom 3 bits of address. var addr1 = rxBuffer1Address.Value << 3; - if(data.Length != size) + if((ulong)data.Length != size) { this.Log(LogLevel.Warning, "Received {0} bytes from the device, but RX DMA stream is configured for {1} bytes. This might indicate problems in the driver", data.Length, size); }
diff --git a/shodan_infrastructure/SpringbokRiscV32.cs b/shodan_infrastructure/SpringbokRiscV32.cs index b7a5c08..cc52b19 100644 --- a/shodan_infrastructure/SpringbokRiscV32.cs +++ b/shodan_infrastructure/SpringbokRiscV32.cs
@@ -340,11 +340,12 @@ // If valid, do the memory clear. if (val) { + var dataPageMask = ~((ulong)(DataPageSize - 1)); InitStatusPending.Value = true; InitStatusDone.Value = false; Machine.LocalTimeSource.ExecuteInNearestSyncedState( __ => { - for(long writeAddress = InitStartAddress.Value & ~(DataPageSize - 1); - writeAddress < ((InitEndAddress.Value + DataPageSize - 1) & ~(DataPageSize - 1)); + for(ulong writeAddress = InitStartAddress.Value & dataPageMask; + writeAddress < ((InitEndAddress.Value + DataPageSize - 1) & dataPageMask); writeAddress += DataPageSize) { Machine.SystemBus.WriteBytes(DataErasePattern, mmuRangeStart + (ulong)writeAddress, (uint)DataPageSize, true);