├── .gitattributes ├── src ├── Emulator │ ├── Cores │ │ ├── virt │ │ │ └── include │ │ │ │ ├── unwind.h │ │ │ │ ├── x86_reports.h │ │ │ │ ├── registers.h │ │ │ │ ├── memory_range.h │ │ │ │ ├── utils.h │ │ │ │ └── debug.h │ │ ├── RiscV │ │ │ ├── opcodes │ │ │ │ ├── opcodes-rv32d-zfh │ │ │ │ ├── opcodes-rv32q-zfh │ │ │ │ ├── opcodes-rv32c │ │ │ │ ├── opcodes-rv64h │ │ │ │ ├── opcodes-rv64m │ │ │ │ ├── opcodes-rv64f │ │ │ │ ├── opcodes-rv64q │ │ │ │ ├── opcodes-rv64zfh │ │ │ │ ├── opcodes-svinval │ │ │ │ ├── opcodes-rv32m │ │ │ │ ├── opcodes-rv64d │ │ │ │ ├── opcodes-zicbo │ │ │ │ ├── opcodes-rv64c │ │ │ │ └── opcodes-rvv-pseudo │ │ │ ├── CSRValidationLevel.cs │ │ │ ├── PrivilegeLevel.cs │ │ │ ├── VectorInstructionsOpcodes.cs │ │ │ ├── NonstandardCSR.cs │ │ │ └── PULP_EventController.cs │ │ ├── renode │ │ │ └── arch │ │ │ │ ├── xtensa │ │ │ │ └── renode_xtensa_callbacks.c │ │ │ │ ├── sparc │ │ │ │ └── renode_sparc_callbacks.c │ │ │ │ └── ppc │ │ │ │ └── renode_ppc_callbacks.c │ │ ├── windows-properties.csproj │ │ ├── osx-properties.csproj │ │ ├── linux-properties.csproj │ │ ├── Debug │ │ │ ├── FunctionCallParameterType.cs │ │ │ └── FunctionCallParameter.cs │ │ ├── X86 │ │ │ ├── X86Registers.tt │ │ │ ├── ACPI │ │ │ │ ├── ProcessorLocalAPICRecord.cs │ │ │ │ └── DifferentiatedSystemDescriptionTable.cs │ │ │ └── X86_64Registers.tt │ │ ├── Arm │ │ │ └── ArmRegisters.tt │ │ ├── Xtensa │ │ │ └── XtensaRegisters.tt │ │ ├── Arm64 │ │ │ └── ARMv8RRegisters.tt │ │ └── KVM │ │ │ └── X86 │ │ │ └── X86KVMRegisters.tt │ ├── Main │ │ ├── Core │ │ │ ├── IPreservable.cs │ │ │ ├── ICoalescable.cs │ │ │ ├── IHostMachineElement.cs │ │ │ ├── INetworkLogSwitch.cs │ │ │ ├── INetworkLogWireless.cs │ │ │ ├── SyncUnitPolicy.cs │ │ │ ├── IGPIOSender.cs │ │ │ ├── IHasAutomaticallyConnectedGPIOOutputs.cs │ │ │ ├── ILocalGPIOReceiver.cs │ │ │ ├── IManagedThread.cs │ │ │ ├── Structure │ │ │ │ ├── ITheOnlyPossibleRegistrationPoint.cs │ │ │ │ ├── IJsonSerializable.cs │ │ │ │ ├── IConditionalRegistration.cs │ │ │ │ ├── Registers │ │ │ │ │ ├── IFlagRegisterField.cs │ │ │ │ │ ├── IValueRegisterField.cs │ │ │ │ │ ├── Tag.cs │ │ │ │ │ ├── IEnumRegisterField.cs │ │ │ │ │ └── IPacketRegisterField.cs │ │ │ │ ├── MACRepository.cs │ │ │ │ ├── IRegistered.cs │ │ │ │ ├── IBusRegistration.cs │ │ │ │ ├── IHasChildren.cs │ │ │ │ └── IRegistrationPoint.cs │ │ │ ├── IExternal.cs │ │ │ ├── IGPIOWithHooks.cs │ │ │ ├── IDisconnectableState.cs │ │ │ ├── INetworkLog.cs │ │ │ ├── IHasPreservableState.cs │ │ │ ├── IConnectable.cs │ │ │ ├── ISimpleManagedThread.cs │ │ │ ├── INumberedGPIOOutput.cs │ │ │ ├── IIdentifiable.cs │ │ │ ├── IPeripheralsGroup.cs │ │ │ ├── GPIOEndpoint.cs │ │ │ ├── MachineStateChangedEventArgs.cs │ │ │ ├── IMappedSegment.cs │ │ │ ├── GPIOConnection.cs │ │ │ ├── IdentifiableObject.cs │ │ │ └── Platform.cs │ │ ├── Peripherals │ │ │ ├── IContextState.cs │ │ │ ├── Sensor │ │ │ │ ├── ISensor.cs │ │ │ │ ├── ICPIPeripheral.cs │ │ │ │ ├── ITemperatureSensor.cs │ │ │ │ ├── IHumiditySensor.cs │ │ │ │ ├── SensorSample.cs │ │ │ │ └── IMagneticSensor.cs │ │ │ ├── USB │ │ │ │ ├── MSC │ │ │ │ │ ├── Protocol.cs │ │ │ │ │ ├── Subclass.cs │ │ │ │ │ └── BOT │ │ │ │ │ │ └── CommandStatus.cs │ │ │ │ ├── Direction.cs │ │ │ │ ├── HID │ │ │ │ │ ├── DescriptorType.cs │ │ │ │ │ ├── Protocol.cs │ │ │ │ │ └── SubclassCode.cs │ │ │ │ ├── PacketType.cs │ │ │ │ ├── USBProtocol.cs │ │ │ │ ├── PacketRecipient.cs │ │ │ │ ├── PacketSize.cs │ │ │ │ ├── IUSBDevice.cs │ │ │ │ ├── EndpointTransferType.cs │ │ │ │ ├── IProvidesDescriptor.cs │ │ │ │ ├── USBClassCode.cs │ │ │ │ ├── DescriptorType.cs │ │ │ │ └── StandardRequest.cs │ │ │ ├── CPU │ │ │ │ ├── IHaltable.cs │ │ │ │ ├── ExecutionMode.cs │ │ │ │ ├── ICPUWithMetrics.cs │ │ │ │ ├── CPUState.cs │ │ │ │ ├── ICPUWithNMI.cs │ │ │ │ ├── ICPUWithPSCI.cs │ │ │ │ ├── HaltReason.cs │ │ │ │ ├── IInitableCPU.cs │ │ │ │ ├── BreakpointType.cs │ │ │ │ ├── IControllableCPU.cs │ │ │ │ ├── ICPUWithPostGprAccessHooks.cs │ │ │ │ ├── ICPUWithPostOpcodeExecutionHooks.cs │ │ │ │ ├── ICPUWithPreOpcodeExecutionHooks.cs │ │ │ │ ├── ExecutionResult.cs │ │ │ │ ├── GDB │ │ │ │ │ ├── GDBTypeField.cs │ │ │ │ │ ├── GDBTypeEnumValue.cs │ │ │ │ │ └── GDBFeatureDescriptor.cs │ │ │ │ ├── ICPUWithMMU.cs │ │ │ │ ├── ICpuSupportingGdb.cs │ │ │ │ ├── ICPUWithMemoryAccessHooks.cs │ │ │ │ ├── CpuAbortException.cs │ │ │ │ ├── ISignalsUnit.cs │ │ │ │ └── HaltArguments.cs │ │ │ ├── IEmulationElement.cs │ │ │ ├── IHasFrequency.cs │ │ │ ├── Timers │ │ │ │ ├── IRiscVTimeProvider.cs │ │ │ │ └── ITimer.cs │ │ │ ├── IAnalyzable.cs │ │ │ ├── Bus │ │ │ │ ├── IBusPeripheral.cs │ │ │ │ ├── Access.cs │ │ │ │ ├── IQuadWordPeripheral.cs │ │ │ │ ├── SysbusAccessWidth.cs │ │ │ │ ├── BusAccessPrivileges.cs │ │ │ │ ├── IBytePeripheral.cs │ │ │ │ ├── IIndirectCSRPeripheral.cs │ │ │ │ ├── UnhandledAccessBehaviour.cs │ │ │ │ ├── IWordPeripheral.cs │ │ │ │ ├── IDoubleWordPeripheral.cs │ │ │ │ ├── ConnectionRegionAttribute.cs │ │ │ │ ├── Silencer.cs │ │ │ │ ├── Wrappers │ │ │ │ │ └── HookWrapper.cs │ │ │ │ └── AllowedTranslation.cs │ │ │ ├── Input │ │ │ │ ├── IInputDevice.cs │ │ │ │ ├── IPS2Controller.cs │ │ │ │ ├── KeyModifier.cs │ │ │ │ ├── IRelativePositionPointerInput.cs │ │ │ │ ├── IKeyboard.cs │ │ │ │ ├── IPS2Peripheral.cs │ │ │ │ ├── IPointerInput.cs │ │ │ │ ├── MouseButton.cs │ │ │ │ └── IAbsolutePositionPointerInput.cs │ │ │ ├── IHasDivisibleFrequency.cs │ │ │ ├── Network │ │ │ │ ├── INetworkInterface.cs │ │ │ │ └── IMACInterface.cs │ │ │ ├── PCI │ │ │ │ ├── PCIeSpace.cs │ │ │ │ ├── PCIeRootComplex.cs │ │ │ │ ├── IPCIeRouter.cs │ │ │ │ ├── PCIeBridge.cs │ │ │ │ ├── PCIeEndpoint.cs │ │ │ │ └── IPCIePeripheral.cs │ │ │ ├── DMA │ │ │ │ ├── IDMA.cs │ │ │ │ ├── Response.cs │ │ │ │ └── TransferType.cs │ │ │ ├── Wireless │ │ │ │ ├── ISlipRadio.cs │ │ │ │ ├── IMediumFunction.cs │ │ │ │ ├── IRadio.cs │ │ │ │ ├── Position.cs │ │ │ │ ├── BLEMedium.cs │ │ │ │ └── IEEE802_15_4Medium.cs │ │ │ ├── IAbsoluteAddressAware.cs │ │ │ ├── CFU │ │ │ │ └── ICFU.cs │ │ │ ├── IEndiannessAware.cs │ │ │ ├── IKnownSize.cs │ │ │ ├── SPI │ │ │ │ ├── ISPIPeripheral.cs │ │ │ │ └── SPILoopback.cs │ │ │ ├── ICluster.cs │ │ │ ├── IHasOwnLife.cs │ │ │ ├── Miscellaneous │ │ │ │ └── ILed.cs │ │ │ ├── UART │ │ │ │ ├── ILIN.cs │ │ │ │ └── IUARTWithBufferState.cs │ │ │ ├── I2C │ │ │ │ └── II2CPeripheral.cs │ │ │ ├── IRQControllers │ │ │ │ └── IIRQController.cs │ │ │ ├── ATAPI │ │ │ │ └── IAtapiPeripheral.cs │ │ │ ├── IMemory.cs │ │ │ ├── IMapped.cs │ │ │ ├── SENT │ │ │ │ └── ISENTPeripheral.cs │ │ │ ├── Video │ │ │ │ └── IVideo.cs │ │ │ ├── IPhysicalLayer.cs │ │ │ ├── IPeripheralWithTransactionState.cs │ │ │ ├── IAnalyzableBackend.cs │ │ │ ├── CAN │ │ │ │ └── ICAN.cs │ │ │ ├── IAnalyzableBackendAnalyzer.cs │ │ │ ├── BasicPeripheralBackendAnalyzer.cs │ │ │ └── DefaultInterruptAttribute.cs │ │ ├── Utilities │ │ │ ├── GDB │ │ │ │ ├── IMultithreadCommand.cs │ │ │ │ └── ExecuteAttribute.cs │ │ │ ├── IAutoLoadType.cs │ │ │ ├── AllowAnyNumericalValue.cs │ │ │ ├── RESD │ │ │ │ └── RESDException.cs │ │ │ ├── AutoParameterAttribute.cs │ │ │ ├── Binding │ │ │ │ ├── ExportAttribute.cs │ │ │ │ ├── ImportAttribute.cs │ │ │ │ └── INativeUnwindable.cs │ │ │ ├── Collections │ │ │ │ ├── IArray.cs │ │ │ │ ├── TreeNode.cs │ │ │ │ └── LazyList.cs │ │ │ ├── ExtensionOnObjectAttribute.cs │ │ │ ├── IProgressMonitorHandler.cs │ │ │ ├── MemberReferenceExtensions.cs │ │ │ ├── ConvertibleAttribute.cs │ │ │ ├── Packets │ │ │ │ ├── LeastSignificantByteFirst.cs │ │ │ │ └── PacketFieldAttribute.cs │ │ │ ├── IBlobProvider.cs │ │ │ └── FileLocker.cs │ │ ├── Tests │ │ │ └── UnitTests │ │ │ │ └── Mocks │ │ │ │ ├── TwoStateEnum.cs │ │ │ │ ├── MockExternal.cs │ │ │ │ ├── MockIrqSenderWithTwoInterrupts.cs │ │ │ │ └── MockReceiverConstrained.cs │ │ ├── Exceptions │ │ │ ├── InvalidRegisterAccessException.cs │ │ │ ├── ConfigurationException.cs │ │ │ ├── RegisterValueUnavailableException.cs │ │ │ ├── ConstructionException.cs │ │ │ └── RecoverableException.cs │ │ ├── Debug │ │ │ └── IdentifiableObject.cs │ │ ├── Time │ │ │ ├── Direction.cs │ │ │ ├── WorkMode.cs │ │ │ ├── RealTimeClockMode.cs │ │ │ └── ITimeDomain.cs │ │ ├── Foreign │ │ │ ├── RecordingBehaviour.cs │ │ │ └── IRecordEntry.cs │ │ ├── UserInterface │ │ │ ├── UiAccessibleAttribute.cs │ │ │ ├── IUserInterfaceProvider.cs │ │ │ ├── HideInMonitorAttribute.cs │ │ │ ├── IconAttribute.cs │ │ │ └── ControllerMaskAttribute.cs │ │ ├── Storage │ │ │ └── SCSI │ │ │ │ ├── SCSICommandDescriptorBlock.cs │ │ │ │ └── Commands │ │ │ │ └── IReadWrite10Command.cs │ │ ├── Backends │ │ │ └── Display │ │ │ │ └── IDisplay.cs │ │ ├── Network │ │ │ ├── CRCMode.cs │ │ │ └── IBasicNetworkNode.cs │ │ ├── Logging │ │ │ ├── ILoggerBackend.cs │ │ │ └── ILogger.cs │ │ └── Plugins │ │ │ └── PluginAttribute.cs │ ├── Peripherals │ │ ├── Peripherals │ │ │ ├── STM32Series.cs │ │ │ ├── Miscellaneous │ │ │ │ ├── Crypto │ │ │ │ │ └── Endianness.cs │ │ │ │ ├── INRFEventProvider.cs │ │ │ │ ├── ISideloadableKey.cs │ │ │ │ ├── S32K3XX_FlexIO │ │ │ │ │ └── IEndpoint.cs │ │ │ │ ├── SiLabs │ │ │ │ │ └── EFR32xG2_DCDC_2.cs │ │ │ │ └── OpenTitan_MultiBitBool.cs │ │ │ ├── CPU │ │ │ │ ├── Assembler │ │ │ │ │ └── IAssembler.cs │ │ │ │ ├── Registers │ │ │ │ │ └── IRegisters.cs │ │ │ │ ├── SegmentMapping.cs │ │ │ │ └── ExecutionTracer │ │ │ │ │ └── FBInstruction │ │ │ │ │ ├── README.txt │ │ │ │ │ └── instruction.fbs │ │ │ ├── USBDeprecated │ │ │ │ ├── USBLanguageID.cs │ │ │ │ ├── USBRequestException.cs │ │ │ │ ├── USBDeviceSpeed.cs │ │ │ │ ├── USBRequestType.cs │ │ │ │ ├── PortStatusAndControlRegisterChanges.cs │ │ │ │ ├── IUSBHub.cs │ │ │ │ ├── USBSetupPacket.cs │ │ │ │ ├── DescriptorType.cs │ │ │ │ ├── USBPacket.cs │ │ │ │ └── IUSBHubBase.cs │ │ │ ├── Sensors │ │ │ │ ├── AK09916.cs │ │ │ │ ├── AK09918.cs │ │ │ │ └── TMP108.cs │ │ │ ├── MemoryControllers │ │ │ │ └── ARM_SMMUv3 │ │ │ │ │ └── ARM_SMMUv3.StreamController.cs │ │ │ ├── SPI │ │ │ │ ├── STM32WBA_SPI.cs │ │ │ │ └── Cadence_xSPICommands │ │ │ │ │ └── IDMACommand.cs │ │ │ ├── Bus │ │ │ │ └── IGaislerAHB.cs │ │ │ ├── Wireless │ │ │ │ ├── IEEE802_15_4 │ │ │ │ │ └── FrameType.cs │ │ │ │ └── CC2538 │ │ │ │ │ └── InterruptSource.cs │ │ │ └── IRQControllers │ │ │ │ └── EXTI.cs │ │ └── Test │ │ │ └── PeripheralsTests │ │ │ └── CortexA9GICTests.cs │ └── Extensions │ │ ├── HostInterfaces │ │ └── Network │ │ │ └── ITapInterface.cs │ │ ├── Utilities │ │ ├── USBIP │ │ │ ├── AttachDeviceCommandDescriptor.cs │ │ │ └── DeviceListCount.cs │ │ └── GDB │ │ │ └── Commands │ │ │ ├── KillCommand.cs │ │ │ ├── ReportHaltReasonCommand.cs │ │ │ ├── SingleStepCommand.cs │ │ │ ├── ContinueCommand.cs │ │ │ ├── CurrentThreadCommand.cs │ │ │ ├── ThreadAliveCommand.cs │ │ │ └── ThreadAttachedCommand.cs │ │ ├── Hooks │ │ ├── GPIOHookExtensions.cs │ │ ├── PSCIHookExtensions.cs │ │ └── UserStateHookExtensions.cs │ │ ├── UserInterface │ │ ├── Tokenizer │ │ │ ├── Token.cs │ │ │ ├── NullToken.cs │ │ │ ├── ConditionalEqualityToken.cs │ │ │ ├── CommaToken.cs │ │ │ ├── MultilineStringTerminatorToken.cs │ │ │ ├── HexToken.cs │ │ │ ├── LeftBraceToken.cs │ │ │ ├── RightBraceToken.cs │ │ │ ├── PathToken.cs │ │ │ ├── LiteralToken.cs │ │ │ ├── CommandSplit.cs │ │ │ ├── EqualityToken.cs │ │ │ ├── CommentToken.cs │ │ │ ├── VariableToken.cs │ │ │ ├── FloatToken.cs │ │ │ └── BooleanToken.cs │ │ └── Commands │ │ │ ├── RequireVariableCommand.cs │ │ │ ├── VersionCommand.cs │ │ │ ├── PauseCommand.cs │ │ │ └── CommandAttributes.cs │ │ └── Backends │ │ └── Display │ │ └── xInput │ │ └── IInputHandler.cs ├── UI │ ├── XwtProvider │ │ └── IHasWidget.cs │ └── VideoAnalyzer │ │ ├── DisplayMode.cs │ │ ├── Events │ │ └── IEventSource.cs │ │ ├── DummyVideoAnalyzer.cs │ │ └── Handlers │ │ └── RelativePointerHandler.cs └── Plugins │ └── SampleCommandPlugin │ └── SampleCommandPlugin_NET.csproj ├── README.rst ├── .gitmodules ├── .git-blame-ignore-revs └── .gitignore /.gitattributes: -------------------------------------------------------------------------------- 1 | *.cs diff=csharp 2 | -------------------------------------------------------------------------------- /src/Emulator/Cores/virt/include/unwind.h: -------------------------------------------------------------------------------- 1 | ../../tlib/include/unwind.h -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | README 2 | ====== 3 | 4 | See `Renode README.rst `_. 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/Emulator/Cores/tlib"] 2 | path = src/Emulator/Cores/tlib 3 | url = https://github.com/antmicro/tlib.git 4 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # Reformat 2 | 73c5410e0fa445209b5d107116545130e8661f06 3 | # Fix line endings 4 | 394f00caee0312a2a18744c33279359e47c8d40d 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #temp 2 | *~ 3 | tags 4 | 5 | #bin 6 | *.so 7 | bin 8 | obj 9 | 10 | #ide 11 | *.pidb 12 | *.userprefs 13 | .vscode 14 | *.swp 15 | -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rv32d-zfh: -------------------------------------------------------------------------------- 1 | fcvt.h.d rd rs1 24..20=1 31..27=0x08 rm 26..25=2 6..2=0x14 1..0=3 2 | fcvt.d.h rd rs1 24..20=2 31..27=0x08 rm 26..25=1 6..2=0x14 1..0=3 3 | -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rv32q-zfh: -------------------------------------------------------------------------------- 1 | fcvt.h.q rd rs1 24..20=3 31..27=0x08 rm 26..25=2 6..2=0x14 1..0=3 2 | fcvt.q.h rd rs1 24..20=2 31..27=0x08 rm 26..25=3 6..2=0x14 1..0=3 3 | -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rv32c: -------------------------------------------------------------------------------- 1 | # RV32C additions to RVC 2 | 3 | @c.srli.rv32 1..0=1 15..13=4 12=0 11..10=0 9..2=ignore 4 | @c.srai.rv32 1..0=1 15..13=4 12=0 11..10=1 9..2=ignore 5 | @c.slli.rv32 1..0=2 15..13=0 12=0 11..2=ignore 6 | -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rv64h: -------------------------------------------------------------------------------- 1 | # Hypervisor extension 2 | hlv.wu rd rs1 24..20=0x1 31..25=0x34 14..12=4 6..2=0x1C 1..0=3 3 | hlv.d rd rs1 24..20=0x0 31..25=0x36 14..12=4 6..2=0x1C 1..0=3 4 | hsv.d 11..7=0 rs1 rs2 31..25=0x37 14..12=4 6..2=0x1C 1..0=3 5 | -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IPreservable.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core 8 | { 9 | public interface IPreservable 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IContextState.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Peripherals 9 | { 10 | public interface IContextState 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Sensor/ISensor.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Peripherals.Sensor 9 | { 10 | public interface ISensor : IPeripheral 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/GDB/IMultithreadCommand.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Utilities.GDB 9 | { 10 | public interface IMultithreadCommand 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rv64m: -------------------------------------------------------------------------------- 1 | # RV64M additions to RV32M 2 | 3 | mulw rd rs1 rs2 31..25=1 14..12=0 6..2=0x0E 1..0=3 4 | divw rd rs1 rs2 31..25=1 14..12=4 6..2=0x0E 1..0=3 5 | divuw rd rs1 rs2 31..25=1 14..12=5 6..2=0x0E 1..0=3 6 | remw rd rs1 rs2 31..25=1 14..12=6 6..2=0x0E 1..0=3 7 | remuw rd rs1 rs2 31..25=1 14..12=7 6..2=0x0E 1..0=3 8 | -------------------------------------------------------------------------------- /src/Emulator/Main/Core/ICoalescable.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core 9 | { 10 | public interface ICoalescable 11 | { 12 | void Coalesce(T source); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/MSC/Protocol.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB.MSC 8 | { 9 | public enum Protocol 10 | { 11 | BulkOnlyTransport = 0x50 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/IHaltable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.CPU 9 | { 10 | public interface IHaltable 11 | { 12 | bool IsHalted { set; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/MSC/Subclass.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB.MSC 8 | { 9 | public enum Subclass 10 | { 11 | ScsiTransparentCommandSet = 0x6 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IEmulationElement.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode 9 | { 10 | public interface IEmulationElement 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IHasFrequency.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals 9 | { 10 | public interface IHasFrequency 11 | { 12 | long Frequency { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/Direction.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB 8 | { 9 | public enum Direction : byte 10 | { 11 | HostToDevice, 12 | DeviceToHost 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Tests/UnitTests/Mocks/TwoStateEnum.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.UnitTests.Mocks 9 | { 10 | public enum TwoStateEnum 11 | { 12 | One, 13 | Two 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/IAutoLoadType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Utilities 9 | { 10 | public interface IAutoLoadType 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Exceptions/InvalidRegisterAccessException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Antmicro.Renode.Exceptions 4 | { 5 | public class InvalidRegisterAccessException : RecoverableException 6 | { 7 | public InvalidRegisterAccessException(string message, Exception innerException) : base(message, innerException) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ExecutionMode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.CPU 8 | { 9 | public enum ExecutionMode 10 | { 11 | Continuous, 12 | SingleStep, 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rv64f: -------------------------------------------------------------------------------- 1 | # RV64F additions to RV32F 2 | 3 | fcvt.l.s rd rs1 24..20=2 31..27=0x18 rm 26..25=0 6..2=0x14 1..0=3 4 | fcvt.lu.s rd rs1 24..20=3 31..27=0x18 rm 26..25=0 6..2=0x14 1..0=3 5 | 6 | fcvt.s.l rd rs1 24..20=2 31..27=0x1A rm 26..25=0 6..2=0x14 1..0=3 7 | fcvt.s.lu rd rs1 24..20=3 31..27=0x1A rm 26..25=0 6..2=0x14 1..0=3 8 | -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rv64q: -------------------------------------------------------------------------------- 1 | # RV64Q additions to RV32Q 2 | 3 | fcvt.l.q rd rs1 24..20=2 31..27=0x18 rm 26..25=3 6..2=0x14 1..0=3 4 | fcvt.lu.q rd rs1 24..20=3 31..27=0x18 rm 26..25=3 6..2=0x14 1..0=3 5 | 6 | fcvt.q.l rd rs1 24..20=2 31..27=0x1A rm 26..25=3 6..2=0x14 1..0=3 7 | fcvt.q.lu rd rs1 24..20=3 31..27=0x1A rm 26..25=3 6..2=0x14 1..0=3 8 | -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/HID/DescriptorType.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB.HID 8 | { 9 | public enum DescriptorType 10 | { 11 | HID = 0x21, 12 | Report = 0x22 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/STM32Series.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals 9 | { 10 | public enum STM32Series 11 | { 12 | F0, 13 | F4, 14 | WBA, 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rv64zfh: -------------------------------------------------------------------------------- 1 | # RV64Zfh additions to RV32Zfh 2 | 3 | fcvt.l.h rd rs1 24..20=2 31..27=0x18 rm 26..25=2 6..2=0x14 1..0=3 4 | fcvt.lu.h rd rs1 24..20=3 31..27=0x18 rm 26..25=2 6..2=0x14 1..0=3 5 | 6 | fcvt.h.l rd rs1 24..20=2 31..27=0x1A rm 26..25=2 6..2=0x14 1..0=3 7 | fcvt.h.lu rd rs1 24..20=3 31..27=0x1A rm 26..25=2 6..2=0x14 1..0=3 8 | -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ICPUWithMetrics.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.CPU 9 | { 10 | public interface ICPUWithMetrics : ICPU 11 | { 12 | void EnableProfiling(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Timers/IRiscVTimeProvider.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Peripherals.Timers 8 | { 9 | public interface IRiscVTimeProvider 10 | { 11 | ulong TimerValue { get; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/PacketType.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB 8 | { 9 | public enum PacketType : byte 10 | { 11 | Standard, 12 | Class, 13 | Vendor 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IHostMachineElement.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core 9 | { 10 | public interface IHostMachineElement : IEmulationElement 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Debug/IdentifiableObject.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Debugging 8 | { 9 | public class IdentifiableObject 10 | #if DEBUG 11 | : Core.IdentifiableObject 12 | #endif 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IAnalyzable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals 9 | { 10 | public interface IAnalyzable : IEmulationElement 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/HID/Protocol.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB.HID 8 | { 9 | public enum Protocol 10 | { 11 | None = 0, 12 | Keyboard = 1, 13 | Mouse = 2 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/HID/SubclassCode.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB.HID 8 | { 9 | public enum SubclassCode 10 | { 11 | NoSubclass = 0, 12 | BootInterfaceSubclass = 1 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/INetworkLogSwitch.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using Antmicro.Renode.Peripherals.Network; 8 | 9 | namespace Antmicro.Renode.Core 10 | { 11 | public interface INetworkLogSwitch : INetworkLog 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/INetworkLogWireless.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using Antmicro.Renode.Peripherals.Wireless; 8 | 9 | namespace Antmicro.Renode.Core 10 | { 11 | public interface INetworkLogWireless : INetworkLog 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/IBusPeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.Bus 9 | { 10 | public interface IBusPeripheral : IPeripheral 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/CPUState.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Peripherals.CPU 9 | { 10 | public enum EmulationCPUState 11 | { 12 | Aborted, 13 | InReset, 14 | Running, 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Input/IInputDevice.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.Input 9 | { 10 | public interface IInputDevice : IPeripheral 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Time/Direction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Time 10 | { 11 | public enum Direction 12 | { 13 | Ascending, 14 | Descending 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/SyncUnitPolicy.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core 9 | { 10 | public enum SyncUnitPolicy 11 | { 12 | ShowWarning, 13 | Adjust 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ICPUWithNMI.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.CPU 9 | { 10 | public interface ICPUWithNMI : ICPU 11 | { 12 | void OnNMI(int number, bool value, ulong? mcause); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IHasDivisibleFrequency.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals 9 | { 10 | public interface IHasDivisibleFrequency : IHasFrequency 11 | { 12 | int Divider { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Time/WorkMode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Time 10 | { 11 | public enum WorkMode 12 | { 13 | Periodic = 1, 14 | OneShot = 0 15 | } 16 | } -------------------------------------------------------------------------------- /src/UI/XwtProvider/IHasWidget.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Xwt; 9 | 10 | namespace Antmicro.Renode.UI 11 | { 12 | public interface IHasWidget 13 | { 14 | Widget Widget { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Miscellaneous/Crypto/Endianness.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Peripherals.Miscellaneous.Crypto 8 | { 9 | public enum Endianness 10 | { 11 | BigEndian, 12 | LittleEndian 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/CSRValidationLevel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2020 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.CPU 8 | { 9 | public enum CSRValidationLevel : uint 10 | { 11 | Full = 2, 12 | PrivilegeLevel = 1, 13 | None = 0 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IGPIOSender.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Peripherals; 9 | 10 | namespace Antmicro.Renode.Core 11 | { 12 | public interface IGPIOSender : IPeripheral 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Input/IPS2Controller.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.Input 9 | { 10 | public interface IPS2Controller 11 | { 12 | void Notify(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/USBProtocol.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB 8 | { 9 | public enum USBProtocol : short 10 | { 11 | USB_1_0 = 0x0100, 12 | USB_1_1 = 0x0110, 13 | USB_2_0 = 0x0200 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Network/INetworkInterface.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Peripherals.Network 10 | { 11 | public interface INetworkInterface : IAnalyzable 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/PCI/PCIeSpace.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.PCI 8 | { 9 | public enum PCIeSpace 10 | { 11 | //the enum values are used in MPFS_PCIe. 12 | TxRx, 13 | Configuration, 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/PacketRecipient.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB 8 | { 9 | public enum PacketRecipient : byte 10 | { 11 | Device, 12 | Interface, 13 | Endpoint, 14 | Other 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/PacketSize.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB 8 | { 9 | public enum PacketSize : byte 10 | { 11 | Size8 = 8, 12 | Size16 = 16, 13 | Size32 = 32, 14 | Size64 = 64 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/AllowAnyNumericalValue.cs: -------------------------------------------------------------------------------- 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 | using System; 8 | 9 | namespace Antmicro.Renode.Utilities 10 | { 11 | [AttributeUsage(AttributeTargets.Enum)] 12 | public class AllowAnyNumericalValue : Attribute 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/virt/include/x86_reports.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | typedef enum { 7 | INVALID_ACCESS_64BIT_ADDRESS, 8 | INVALID_ACCESS_64BIT_WIDTH 9 | } InvalidAccess; 10 | 11 | void handle_64bit_access(InvalidAccess invalid_access, unsigned access_len, bool is_write, uint64_t addr); 12 | 13 | void handle_64bit_register_value(int reg_number, uint64_t value); 14 | -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IHasAutomaticallyConnectedGPIOOutputs.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core 8 | { 9 | public interface IHasAutomaticallyConnectedGPIOOutputs 10 | { 11 | void DisconnectAutomaticallyConnectedGPIOOutputs(); 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/ILocalGPIOReceiver.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core 9 | { 10 | public interface ILocalGPIOReceiver 11 | { 12 | IGPIOReceiver GetLocalReceiver(int index); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IManagedThread.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2025 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core 9 | { 10 | public interface IManagedThread : ISimpleManagedThread 11 | { 12 | uint Frequency { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Foreign/RecordingBehaviour.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.EventRecording 9 | { 10 | public enum RecordingBehaviour 11 | { 12 | DomainExternal, 13 | All 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/IUSBDevice.cs: -------------------------------------------------------------------------------- 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 | using Antmicro.Renode.Peripherals; 8 | 9 | namespace Antmicro.Renode.Core.USB 10 | { 11 | public interface IUSBDevice : IPeripheral 12 | { 13 | USBDeviceCore USBCore { get; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/PrivilegeLevel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.CPU 9 | { 10 | public enum PrivilegeLevel 11 | { 12 | User = 0, 13 | Supervisor = 1, 14 | Hypervisor = 2, 15 | Machine = 3 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/Access.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Peripherals.Bus 10 | { 11 | [Flags] 12 | public enum Access 13 | { 14 | Read = 1, 15 | Write = 2, 16 | ReadAndWrite = 3 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/DMA/IDMA.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2021 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.DMA 9 | { 10 | public interface IDMA : IPeripheral 11 | { 12 | void RequestTransfer(int channel); 13 | 14 | int NumberOfChannels { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/MSC/BOT/CommandStatus.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB.MSC.BOT 8 | { 9 | public enum CommandStatus : byte 10 | { 11 | Success = 0x0, 12 | Failure = 0x1, 13 | PhaseError = 0x2 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/CPU/Assembler/IAssembler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.CPU.Assembler 9 | { 10 | public interface IAssembler 11 | { 12 | byte[] AssembleBlock(ulong pc, string code, uint flags); 13 | } 14 | } -------------------------------------------------------------------------------- /src/UI/VideoAnalyzer/DisplayMode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Extensions.Analyzers.Video 9 | { 10 | public enum DisplayMode 11 | { 12 | Stretch, 13 | Fit, 14 | Center 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Wireless/ISlipRadio.cs: -------------------------------------------------------------------------------- 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 | using System; 8 | 9 | using Antmicro.Renode.Core; 10 | 11 | namespace Antmicro.Renode.Peripherals.Wireless 12 | { 13 | public interface ISlipRadio : IRadio, IExternal, IDisposable 14 | { 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/ITheOnlyPossibleRegistrationPoint.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core.Structure 9 | { 10 | public interface ITheOnlyPossibleRegistrationPoint : IRegistrationPoint 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ICPUWithPSCI.cs: -------------------------------------------------------------------------------- 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 | using System; 8 | 9 | namespace Antmicro.Renode.Peripherals.CPU 10 | { 11 | public interface ICPUWithPSCI : ICPU 12 | { 13 | void AddCustomPSCIHandler(ulong functionIdentifier, Action stub); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/DMA/Response.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.DMA 9 | { 10 | public struct Response 11 | { 12 | public ulong? ReadAddress { get; set; } 13 | 14 | public ulong? WriteAddress { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/EndpointTransferType.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB 8 | { 9 | public enum EndpointTransferType 10 | { 11 | Control = 0, 12 | Isochronous = 1, 13 | Bulk = 2, 14 | Interrupt = 3 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Tests/UnitTests/Mocks/MockExternal.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Core; 9 | 10 | namespace Antmicro.Renode.UnitTests.Mocks 11 | { 12 | public sealed class MockExternal : IExternal 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IExternal.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.UserInterface; 9 | 10 | namespace Antmicro.Renode.Core 11 | { 12 | [Icon("box")] 13 | public interface IExternal : IEmulationElement 14 | { 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/PCI/PCIeRootComplex.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.PCI 8 | { 9 | public class PCIeRootComplex : PCIeBridge 10 | { 11 | public PCIeRootComplex(IPCIeRouter parent) : base(parent) 12 | { 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Sensor/ICPIPeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2021 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.Peripherals.I2C; 9 | 10 | namespace Antmicro.Renode.Peripherals.Sensor 11 | { 12 | public interface ICPIPeripheral : II2CPeripheral 13 | { 14 | byte[] ReadFrame(); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Sensor/ITemperatureSensor.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Peripherals.Sensor 9 | { 10 | public interface ITemperatureSensor : ISensor 11 | { 12 | // Celsius degrees 13 | decimal Temperature { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Time/RealTimeClockMode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Time 10 | { 11 | public enum RealTimeClockMode 12 | { 13 | Epoch, 14 | HostTimeLocal, 15 | HostTimeUTC, 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Miscellaneous/INRFEventProvider.cs: -------------------------------------------------------------------------------- 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 System; 9 | 10 | namespace Antmicro.Renode.Peripherals.Miscellaneous 11 | { 12 | public interface INRFEventProvider 13 | { 14 | event Action EventTriggered; 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/USBDeprecated/USBLanguageID.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.USBDeprecated 9 | { 10 | public enum USBLanguageIDCode : ushort 11 | { 12 | English = 0x09 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IAbsoluteAddressAware.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Peripherals 10 | { 11 | public interface IAbsoluteAddressAware 12 | { 13 | void SetAbsoluteAddress(ulong address); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Input/KeyModifier.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode 11 | { 12 | [Flags] 13 | public enum KeyModifier 14 | { 15 | Control = 1, 16 | Shift = 2 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Sensor/IHumiditySensor.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Peripherals.Sensor 9 | { 10 | public interface IHumiditySensor : ISensor 11 | { 12 | // percentage value, range 0-100 13 | decimal Humidity { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/HaltReason.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.CPU 9 | { 10 | public enum HaltReason 11 | { 12 | Breakpoint, 13 | Abort, 14 | Step, 15 | Pause 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Sensors/AK09916.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.Sensors 9 | { 10 | public class AK09916 : AK0991x 11 | { 12 | public override byte CompanyID => 0x48; 13 | 14 | public override byte DeviceID => 0xc; 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Sensors/AK09918.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.Sensors 9 | { 10 | public class AK09918 : AK0991x 11 | { 12 | public override byte CompanyID => 0x48; 13 | 14 | public override byte DeviceID => 0x1; 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/USBDeprecated/USBRequestException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Peripherals.USBDeprecated 11 | { 12 | public class USBRequestException : Exception 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/RESD/RESDException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Utilities.RESD 10 | { 11 | public class RESDException : Exception 12 | { 13 | public RESDException(string message) : base(message) 14 | { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Miscellaneous/ISideloadableKey.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2021 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System.Collections.Generic; 8 | 9 | namespace Antmicro.Renode.Peripherals.Miscellaneous 10 | { 11 | public interface ISideloadableKey 12 | { 13 | IEnumerable SideloadKey { set; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Sensors/TMP108.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.Sensors 8 | { 9 | // This model is a stub, roughly compatible with TMP103 10 | public class TMP108 : TMP103 11 | { 12 | public TMP108() 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/USBDeprecated/USBDeviceSpeed.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.USBDeprecated 9 | { 10 | public enum USBDeviceSpeed 11 | { 12 | Low, 13 | Full, 14 | High 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/virt/include/registers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #ifdef TARGET_X86_64KVM 7 | typedef uint64_t reg_t; 8 | #else 9 | typedef uint32_t reg_t; 10 | #endif 11 | 12 | #include "cpu_registers.h" 13 | 14 | void kvm_registers_synchronize(); 15 | void kvm_registers_invalidate(); 16 | 17 | reg_t get_register_value(Registers reg_number); 18 | void set_register_value(Registers reg_number, reg_t value); 19 | -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/PCI/IPCIeRouter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using Range = Antmicro.Renode.Core.Range; 8 | 9 | namespace Antmicro.Renode.Peripherals.PCI 10 | { 11 | public interface IPCIeRouter 12 | { 13 | void RegisterBar(Range range, IPCIePeripheral peripheral, uint bar); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Miscellaneous/S32K3XX_FlexIO/IEndpoint.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.Miscellaneous.S32K3XX_FlexIOModel 9 | { 10 | public interface IEndpoint : IPeripheral 11 | { 12 | void RegisterInFlexIO(S32K3XX_FlexIO flexIO); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IGPIOWithHooks.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Core 10 | { 11 | public interface IGPIOWithHooks : IGPIO 12 | { 13 | void AddStateChangedHook(Action hook); 14 | 15 | void RemoveStateChangedHook(Action hook); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/IInitableCPU.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.CPU 9 | { 10 | public interface IInitableCPU : ICPU 11 | { 12 | void InitFromElf(ELFSharp.ELF.IELF elf); 13 | 14 | void InitFromUImage(ELFSharp.UImage.UImage uImage); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CFU/ICFU.cs: -------------------------------------------------------------------------------- 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 | using Antmicro.Renode.Peripherals.CPU; 8 | 9 | namespace Antmicro.Renode.Peripherals.CFU 10 | { 11 | public interface ICFU : IPeripheral 12 | { 13 | ICPU ConnectedCpu { get; set; } 14 | 15 | string SimulationFilePath { get; } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/DMA/TransferType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.DMA 9 | { 10 | public enum TransferType 11 | { 12 | Byte = 1, 13 | Word = 2, 14 | DoubleWord = 4, 15 | QuadWord = 8, 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IEndiannessAware.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 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.Peripherals.Bus; 9 | 10 | using ELFSharp.ELF; 11 | 12 | namespace Antmicro.Renode.Peripherals 13 | { 14 | public interface IEndiannessAware : IBusPeripheral 15 | { 16 | Endianess Endianness { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IKnownSize.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | using Antmicro.Renode.Peripherals.Bus; 10 | 11 | namespace Antmicro.Renode.Peripherals 12 | { 13 | public interface IKnownSize : IBusPeripheral 14 | { 15 | long Size { get; } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Input/IRelativePositionPointerInput.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.Input 9 | { 10 | public interface IRelativePositionPointerInput : IPointerInput 11 | { 12 | void MoveBy(int x, int y); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/AutoParameterAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Utilities 11 | { 12 | [AttributeUsage(AttributeTargets.Parameter)] 13 | public class AutoParameterAttribute : Attribute 14 | { 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/Binding/ExportAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Utilities.Binding 11 | { 12 | [AttributeUsage(AttributeTargets.Method)] 13 | public class ExportAttribute : Attribute 14 | { 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/IQuadWordPeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.Bus 9 | { 10 | public interface IQuadWordPeripheral : IBusPeripheral 11 | { 12 | ulong ReadQuadWord(long offset); 13 | 14 | void WriteQuadWord(long offset, ulong value); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/SysbusAccessWidth.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Peripherals.Bus 10 | { 11 | [Flags] 12 | public enum SysbusAccessWidth 13 | { 14 | Byte = 1, 15 | Word = 2, 16 | DoubleWord = 4, 17 | QuadWord = 8 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/BreakpointType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.CPU 8 | { 9 | public enum BreakpointType 10 | { 11 | MemoryBreakpoint, 12 | HardwareBreakpoint, 13 | WriteWatchpoint, 14 | ReadWatchpoint, 15 | AccessWatchpoint 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/IControllableCPU.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.CPU 9 | { 10 | public interface IControllableCPU : ICPU 11 | { 12 | ExecutionResult ExecuteInstructions(ulong toExecute, out ulong executed); 13 | 14 | void RequestReturn(); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/UserInterface/UiAccessibleAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.UserInterface 11 | { 12 | public class UiAccessibleAttribute : Attribute 13 | { 14 | public string FriendlyName { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/Collections/IArray.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System.Collections.Generic; 8 | 9 | namespace Antmicro.Renode.Utilities.Collections 10 | { 11 | public interface IArray : IEnumerable 12 | { 13 | int Length { get; } 14 | 15 | T this[int index] { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/ExtensionOnObjectAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Utilities 11 | { 12 | [AttributeUsage(AttributeTargets.Method)] 13 | public class ExtensionOnObjectAttribute : Attribute 14 | { 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/USBDeprecated/USBRequestType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.USBDeprecated 9 | { 10 | public enum USBRequestType 11 | { 12 | Standard = 0, 13 | Class = 1, 14 | Vendor = 2 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Exceptions/ConfigurationException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Exceptions 10 | { 11 | public class ConfigurationException : System.Exception 12 | { 13 | public ConfigurationException(String message) : base(message) 14 | { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/SPI/ISPIPeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.SPI 9 | { 10 | public interface ISPIPeripheral : IPeripheral 11 | { 12 | byte Transmit(byte data); 13 | 14 | void FinishTransmission(); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-svinval: -------------------------------------------------------------------------------- 1 | # Svinval 2 | sinval.vma 11..7=0 rs1 rs2 31..25=0x0b 14..12=0 6..2=0x1C 1..0=3 3 | sfence.w.inval 11..7=0 19..15=0x0 24..20=0x0 31..25=0x0c 14..12=0 6..2=0x1C 1..0=3 4 | sfence.inval.ir 11..7=0 19..15=0x0 24..20=0x1 31..25=0x0c 14..12=0 6..2=0x1C 1..0=3 5 | hinval.vvma 11..7=0 rs1 rs2 31..25=0x1b 14..12=0 6..2=0x1C 1..0=3 6 | hinval.gvma 11..7=0 rs1 rs2 31..25=0x3b 14..12=0 6..2=0x1C 1..0=3 7 | -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IDisconnectableState.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core 8 | { 9 | public interface IDisconnectableState : IPreservable 10 | { 11 | // Destructive action - instance should be considered unusable after disconnecting state from object. 12 | void DisconnectState(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/INetworkLog.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Core 10 | { 11 | public interface INetworkLog : IExternal 12 | { 13 | event Action FrameTransmitted; 14 | 15 | event Action FrameProcessed; 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/BusAccessPrivileges.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Peripherals.Bus 10 | { 11 | [Flags] 12 | public enum BusAccessPrivileges 13 | { 14 | None = 0b000, 15 | Read = 0b001, 16 | Write = 0b010, 17 | Other = 0b100 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Time/ITimeDomain.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Time 8 | { 9 | /// 10 | /// Represents a time domain - hierarchy of and objects all having a common root. 11 | /// 12 | public interface ITimeDomain 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rv32m: -------------------------------------------------------------------------------- 1 | mul rd rs1 rs2 31..25=1 14..12=0 6..2=0x0C 1..0=3 2 | mulh rd rs1 rs2 31..25=1 14..12=1 6..2=0x0C 1..0=3 3 | mulhsu rd rs1 rs2 31..25=1 14..12=2 6..2=0x0C 1..0=3 4 | mulhu rd rs1 rs2 31..25=1 14..12=3 6..2=0x0C 1..0=3 5 | div rd rs1 rs2 31..25=1 14..12=4 6..2=0x0C 1..0=3 6 | divu rd rs1 rs2 31..25=1 14..12=5 6..2=0x0C 1..0=3 7 | rem rd rs1 rs2 31..25=1 14..12=6 6..2=0x0C 1..0=3 8 | remu rd rs1 rs2 31..25=1 14..12=7 6..2=0x0C 1..0=3 9 | -------------------------------------------------------------------------------- /src/Emulator/Cores/renode/arch/xtensa/renode_xtensa_callbacks.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2025 Antmicro 3 | // 4 | // This file is licensed under MIT License. 5 | // Full license text is available in 'licenses/MIT.txt' file. 6 | // 7 | 8 | #include "arch_callbacks.h" 9 | #include "renode_imports.h" 10 | 11 | EXTERNAL_AS(void, DoSemihosting, tlib_do_semihosting) 12 | EXTERNAL_AS(uint64_t, GetCPUTime, tlib_get_cpu_time) 13 | EXTERNAL_AS(void, TimerMod, tlib_timer_mod, uint32_t, uint64_t) 14 | -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IHasPreservableState.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core 8 | { 9 | public interface IHasPreservableState : IPreservable 10 | { 11 | object ExtractPreservedState(); 12 | 13 | void LoadPreservedState(object state); 14 | 15 | string PreservableName { get; } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Input/IKeyboard.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.Input 9 | { 10 | public interface IKeyboard : IInputDevice 11 | { 12 | void Press(KeyScanCode scanCode); 13 | 14 | void Release(KeyScanCode scanCode); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/IProgressMonitorHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Utilities 9 | { 10 | public interface IProgressMonitorHandler 11 | { 12 | void Finish(int id); 13 | 14 | void Update(int id, string description, int? progress); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/PCI/PCIeBridge.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.PCI 8 | { 9 | public abstract class PCIeBridge : PCIeBasePeripheral 10 | { 11 | //todo: add registers enum 12 | public PCIeBridge(IPCIeRouter parent) : base(parent, HeaderType.Bridge) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/IBytePeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Peripherals.Bus 10 | { 11 | public interface IBytePeripheral : IBusPeripheral 12 | { 13 | byte ReadByte(long offset); 14 | 15 | void WriteByte(long offset, byte value); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/IIndirectCSRPeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.CPU 9 | { 10 | public interface IIndirectCSRPeripheral : IPeripheral 11 | { 12 | uint ReadIndirectCSR(uint iselect, uint ireg); 13 | 14 | void WriteIndirectCSR(uint iselect, uint ireg, uint value); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/UnhandledAccessBehaviour.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Peripherals.Bus 10 | { 11 | public enum UnhandledAccessBehaviour 12 | { 13 | Report, 14 | ReportIfTagged, 15 | ReportIfNotTagged, 16 | DoNotReport 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/ICluster.cs: -------------------------------------------------------------------------------- 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 System.Collections.Generic; 9 | 10 | namespace Antmicro.Renode.Peripherals 11 | { 12 | public interface ICluster : IPeripheral, IEnumerable 13 | { 14 | IEnumerable> Clusters { get; } 15 | 16 | IEnumerable Clustered { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IHasOwnLife.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Peripherals 10 | { 11 | public interface IHasOwnLife 12 | { 13 | void Start(); 14 | 15 | void Pause(); 16 | 17 | void Resume(); 18 | 19 | bool IsPaused { get; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/IWordPeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Peripherals.Bus 10 | { 11 | public interface IWordPeripheral : IBusPeripheral 12 | { 13 | ushort ReadWord(long offset); 14 | 15 | void WriteWord(long offset, ushort value); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Miscellaneous/ILed.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Peripherals.Miscellaneous 11 | { 12 | public interface ILed : IPeripheral 13 | { 14 | bool State { get; } 15 | 16 | event Action StateChanged; 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/PCI/PCIeEndpoint.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2020 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.PCI 8 | { 9 | public abstract class PCIeEndpoint : PCIeBasePeripheral 10 | { 11 | //todo: add registers enum 12 | public PCIeEndpoint(IPCIeRouter parent) : base(parent, HeaderType.Endpoint) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/MemoryControllers/ARM_SMMUv3/ARM_SMMUv3.StreamController.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Peripherals.MemoryControllers 9 | { 10 | public interface ISMMUv3StreamController 11 | { 12 | bool Enabled { get; set; } 13 | 14 | void InvalidateTlb(ulong? virtualAddress = null); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IConnectable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core 9 | { 10 | public interface IConnectable : IConnectable 11 | { 12 | void AttachTo(T obj); 13 | 14 | void DetachFrom(T obj); 15 | } 16 | 17 | public interface IConnectable 18 | { 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/ISimpleManagedThread.cs: -------------------------------------------------------------------------------- 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 | using System; 8 | 9 | using Antmicro.Renode.Time; 10 | 11 | namespace Antmicro.Renode.Core 12 | { 13 | public interface ISimpleManagedThread : IDisposable 14 | { 15 | void Start(); 16 | 17 | void StartDelayed(TimeInterval delay); 18 | 19 | void Stop(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Wireless/IMediumFunction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.Wireless 8 | { 9 | public interface IMediumFunction : IEmulationElement 10 | { 11 | string FunctionName { get; } 12 | 13 | bool CanReach(Position from, Position to); 14 | 15 | bool CanTransmit(Position from); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Storage/SCSI/SCSICommandDescriptorBlock.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Storage.SCSI 8 | { 9 | public struct SCSICommandDescriptorBlock 10 | { 11 | public static SCSICommand DecodeCommand(byte[] data, int dataOffset = 0) 12 | { 13 | return (SCSICommand)data[dataOffset]; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Sensor/SensorSample.cs: -------------------------------------------------------------------------------- 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 System.Collections.Generic; 9 | 10 | namespace Antmicro.Renode.Peripherals.Sensors 11 | { 12 | public abstract class SensorSample 13 | { 14 | public abstract void Load(IList data); 15 | 16 | public abstract bool TryLoad(params string[] data); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/UART/ILIN.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 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 System; 9 | 10 | namespace Antmicro.Renode.Peripherals.UART 11 | { 12 | public interface ILINDevice : IUART 13 | { 14 | void ReceiveLINBreak(); 15 | } 16 | 17 | public interface ILINController : ILINDevice 18 | { 19 | event Action BroadcastLINBreak; 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/I2C/II2CPeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2020 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.I2C 9 | { 10 | public interface II2CPeripheral : IPeripheral 11 | { 12 | void Write(byte[] data); 13 | 14 | byte[] Read(int count = 1); 15 | 16 | void FinishTransmission(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IRQControllers/IIRQController.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Core; 9 | using Antmicro.Renode.UserInterface; 10 | 11 | namespace Antmicro.Renode.Peripherals.IRQControllers 12 | { 13 | [Icon("lightning")] 14 | public interface IIRQController : IGPIOReceiver 15 | { 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Input/IPS2Peripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.Input 9 | { 10 | public interface IPS2Peripheral : IPeripheral 11 | { 12 | byte Read(); 13 | 14 | void Write(byte value); 15 | 16 | IPS2Controller Controller { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/USBDeprecated/PortStatusAndControlRegisterChanges.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.USBDeprecated 9 | { 10 | public struct PortStatusAndControlRegisterChanges 11 | { 12 | public bool ConnectChange; 13 | public bool EnableChange; 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/virt/include/memory_range.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | typedef struct MemoryRegion { 8 | struct kvm_userspace_memory_region kvm_memory_region; 9 | LIST_ENTRY(MemoryRegion) list; 10 | } MemoryRegion; 11 | 12 | void kvm_map_range(int32_t slot, uint64_t address, uint64_t size, uint64_t pointer); 13 | 14 | void kvm_unmap_range(int32_t slot); 15 | 16 | void* kvm_translate_guest_physical_to_host(uint64_t address, uint64_t* size); 17 | -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/IDoubleWordPeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Peripherals.Bus 10 | { 11 | public interface IDoubleWordPeripheral : IBusPeripheral 12 | { 13 | uint ReadDoubleWord(long offset); 14 | 15 | void WriteDoubleWord(long offset, uint value); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Input/IPointerInput.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.Input 9 | { 10 | public interface IPointerInput : IInputDevice 11 | { 12 | void Press(MouseButton button = MouseButton.Left); 13 | 14 | void Release(MouseButton button = MouseButton.Left); 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/IJsonSerializable.cs: -------------------------------------------------------------------------------- 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 | using System; 8 | 9 | namespace Antmicro.Renode.Core.Structure 10 | { 11 | /// 12 | /// Used to acquire an object that will represent this object for JSON serialization 13 | /// 14 | public interface IJsonSerializable 15 | { 16 | Object SerializeJson(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/ATAPI/IAtapiPeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2020 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.ATAPI 9 | { 10 | public interface IAtapiPeripheral : IPeripheral 11 | { 12 | void HandleCommand(byte[] packet); 13 | 14 | void SendIdentifyResponse(); 15 | 16 | ushort DequeueData(); 17 | 18 | bool DataReady { get; } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rv64d: -------------------------------------------------------------------------------- 1 | # RV64D additions to RV32D 2 | 3 | fcvt.l.d rd rs1 24..20=2 31..27=0x18 rm 26..25=1 6..2=0x14 1..0=3 4 | fcvt.lu.d rd rs1 24..20=3 31..27=0x18 rm 26..25=1 6..2=0x14 1..0=3 5 | fmv.x.d rd rs1 24..20=0 31..27=0x1C 14..12=0 26..25=1 6..2=0x14 1..0=3 6 | 7 | fcvt.d.l rd rs1 24..20=2 31..27=0x1A rm 26..25=1 6..2=0x14 1..0=3 8 | fcvt.d.lu rd rs1 24..20=3 31..27=0x1A rm 26..25=1 6..2=0x14 1..0=3 9 | fmv.d.x rd rs1 24..20=0 31..27=0x1E 14..12=0 26..25=1 6..2=0x14 1..0=3 10 | -------------------------------------------------------------------------------- /src/Emulator/Main/Core/INumberedGPIOOutput.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System.Collections.Generic; 9 | 10 | using Antmicro.Renode.Peripherals; 11 | 12 | namespace Antmicro.Renode.Core 13 | { 14 | public interface INumberedGPIOOutput : IPeripheral 15 | { 16 | IReadOnlyDictionary Connections { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IMemory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Peripherals.Bus; 9 | 10 | namespace Antmicro.Renode.Peripherals 11 | { 12 | public interface IMemory : IPeripheral, IKnownSize, IBytePeripheral, IWordPeripheral, IDoubleWordPeripheral, IMultibyteWritePeripheral, IQuadWordPeripheral 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/VectorInstructionsOpcodes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2021 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.CPU 8 | { 9 | public static class VectorInstructionsOpcodes 10 | { 11 | public static void EnableVectorOpcodesCounting(this BaseRiscV cpu) 12 | { 13 | cpu.EnableRiscvOpcodesCountingByExtension(BaseRiscV.InstructionSet.V); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Timers/ITimer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.UserInterface; 9 | 10 | namespace Antmicro.Renode.Peripherals.Timers 11 | { 12 | [Icon("clock")] 13 | public interface ITimer : IHasFrequency 14 | { 15 | ulong Value { get; set; } 16 | 17 | bool Enabled { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/SPI/STM32WBA_SPI.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using Antmicro.Renode.Core; 8 | 9 | namespace Antmicro.Renode.Peripherals.SPI 10 | { 11 | public class STM32WBA_SPI : STM32H7_SPI 12 | { 13 | public STM32WBA_SPI(IMachine machine) : base(machine) 14 | { 15 | } 16 | 17 | protected override bool IsWba { get; } = true; 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/HostInterfaces/Network/ITapInterface.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | using Antmicro.Renode.Core; 10 | using Antmicro.Renode.Peripherals.Network; 11 | 12 | namespace Antmicro.Renode.HostInterfaces.Network 13 | { 14 | public interface ITapInterface : IMACInterface, IHostMachineElement, IDisposable 15 | { 16 | string InterfaceName { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Sensor/IMagneticSensor.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Peripherals.Sensor 9 | { 10 | public interface IMagneticSensor : ISensor 11 | { 12 | // nano Tesla 13 | int MagneticFluxDensityX { get; set; } 14 | 15 | int MagneticFluxDensityY { get; set; } 16 | 17 | int MagneticFluxDensityZ { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/CPU/Registers/IRegisters.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System.Collections.Generic; 9 | 10 | namespace Antmicro.Renode.Peripherals.CPU.Registers 11 | { 12 | public interface IRegisters 13 | { 14 | IEnumerable Keys { get; } 15 | 16 | RegisterValue this[int index] { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Foreign/IRecordEntry.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | using Antmicro.Renode.Time; 11 | 12 | namespace Antmicro.Renode.EventRecording 13 | { 14 | public interface IRecordEntry 15 | { 16 | void Play(Func handlerResolver); 17 | 18 | TimeInterval Timestamp { get; } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ICPUWithPostGprAccessHooks.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Peripherals.CPU 10 | { 11 | public interface ICPUWithPostGprAccessHooks : ICPU 12 | { 13 | void InstallPostGprAccessHookOn(UInt32 registerIndex, Action callback, UInt32 value); 14 | 15 | void EnablePostGprAccessHooks(UInt32 value); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Input/MouseButton.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Peripherals.Input 11 | { 12 | [Flags] 13 | public enum MouseButton 14 | { 15 | Left = 0x01, 16 | Right = 0x02, 17 | Middle = 0x04, 18 | Side = 0x08, 19 | Extra = 0x10 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/IProvidesDescriptor.cs: -------------------------------------------------------------------------------- 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 | using Antmicro.Renode.Utilities; 8 | 9 | namespace Antmicro.Renode.Core.USB 10 | { 11 | public interface IProvidesDescriptor 12 | { 13 | BitStream GetDescriptor(bool recursive, BitStream buffer = null); 14 | 15 | int RecursiveDescriptorLength { get; } 16 | 17 | int DescriptorLength { get; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/USBClassCode.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB 8 | { 9 | public enum USBClassCode : byte 10 | { 11 | NotSpecified = 0x0, 12 | Audio = 0x1, 13 | CommunicationsCDCControl = 0x2, 14 | HumanInterfaceDevice = 0x3, 15 | MassStorage = 0x8, 16 | CDCData = 0xA, 17 | VendorSpecific = 0xFF 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/IConditionalRegistration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 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.Peripherals; 9 | 10 | namespace Antmicro.Renode.Core.Structure 11 | { 12 | public interface IConditionalRegistration : IBusRegistration 13 | { 14 | string Condition { get; } 15 | 16 | IConditionalRegistration WithInitiatorAndStateMask(IPeripheral initiator, StateMask mask); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/Registers/IFlagRegisterField.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core.Structure.Registers 9 | { 10 | /// 11 | /// Register field that provides a boolean value. It's width is always equal to 1. 12 | /// 13 | public interface IFlagRegisterField : IRegisterField 14 | { 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ICPUWithPostOpcodeExecutionHooks.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Peripherals.CPU 10 | { 11 | public interface ICPUWithPostOpcodeExecutionHooks : ICPU 12 | { 13 | void AddPostOpcodeExecutionHook(UInt64 mask, UInt64 value, Action hook); 14 | 15 | void EnablePostOpcodeExecutionHooks(UInt32 value); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ICPUWithPreOpcodeExecutionHooks.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Peripherals.CPU 10 | { 11 | public interface ICPUWithPreOpcodeExecutionHooks : ICPU 12 | { 13 | void AddPreOpcodeExecutionHook(UInt64 mask, UInt64 value, Action hook); 14 | 15 | void EnablePreOpcodeExecutionHooks(UInt32 value); 16 | } 17 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IMapped.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System.Collections.Generic; 9 | 10 | using Antmicro.Renode.Core; 11 | using Antmicro.Renode.Peripherals.Bus; 12 | 13 | namespace Antmicro.Renode.Peripherals 14 | { 15 | public interface IMapped : IBusPeripheral 16 | { 17 | IEnumerable MappedSegments { get; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/USBDeprecated/IUSBHub.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.USBDeprecated 9 | { 10 | public interface IUSBHub : IUSBPeripheral, IUSBHubBase 11 | { 12 | IUSBPeripheral GetDevice(byte port); 13 | 14 | IUSBHub Parent { set; } 15 | 16 | byte NumberOfPorts { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ExecutionResult.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Peripherals.CPU 8 | { 9 | public enum ExecutionResult : ulong 10 | { 11 | Ok = 0, 12 | Interrupted = 1, 13 | WaitingForInterrupt = 2, 14 | StoppedAtBreakpoint = 3, 15 | StoppedAtWatchpoint = 4, 16 | ExternalMmuFault = 5, 17 | Aborted = ulong.MaxValue 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/DescriptorType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Core.USB 8 | { 9 | public enum DescriptorType : byte 10 | { 11 | Device = 1, 12 | Configuration = 2, 13 | String = 3, 14 | Interface = 4, 15 | Endpoint = 5, 16 | DeviceQualifier = 6, 17 | OtherSpeedConfiguration = 7, 18 | InterfacePower = 8 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Bus/IGaislerAHB.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.Bus 9 | { 10 | public interface IGaislerAHB : IPeripheral 11 | { 12 | uint GetVendorID(); 13 | 14 | uint GetDeviceID(); 15 | 16 | bool IsMaster(); 17 | 18 | GaislerAHBPlugAndPlayRecord.SpaceType GetSpaceType(); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/windows-properties.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | gcc 5 | gcc 6 | ar 7 | Windows 8 | $(DefineConstants);PLATFORM_WINDOWS 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Emulator/Main/Backends/Display/IDisplay.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Backends.Display 11 | { 12 | public interface IDisplay 13 | { 14 | void DrawFrame(byte[] frame); 15 | 16 | void DrawFrame(IntPtr pointer); 17 | 18 | void SetDisplayParameters(int width, int height, PixelFormat colorFormat); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/MemberReferenceExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | using Mono.Cecil; 10 | 11 | namespace Antmicro.Renode.Utilities 12 | { 13 | internal static class MemberReferenceExtensions 14 | { 15 | public static String GetFullNameOfMember(this MemberReference definition) 16 | { 17 | return definition.FullName.Replace('/', '+'); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/Registers/IValueRegisterField.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core.Structure.Registers 9 | { 10 | /// 11 | /// Register field that provides an arbitrary numeric value, not exceeding the register's width. 12 | /// 13 | public interface IValueRegisterField : IRegisterField 14 | { 15 | } 16 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/SENT/ISENTPeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Peripherals.SENT 10 | { 11 | public enum SENTEdge 12 | { 13 | Falling, 14 | Rising, 15 | } 16 | 17 | public interface ISENTPeripheral : IPeripheral 18 | { 19 | bool TransmissionEnabled { get; set; } 20 | 21 | event Action SENTEdgeChanged; 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/GDB/GDBTypeField.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.CPU 8 | { 9 | public struct GDBTypeField 10 | { 11 | public GDBTypeField(string name, string type) : this() 12 | { 13 | this.Name = name; 14 | this.Type = type; 15 | } 16 | 17 | public string Name { get; } 18 | 19 | public string Type { get; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/ConvertibleAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Utilities 11 | { 12 | [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)] 13 | public class ConvertibleAttribute : Attribute 14 | { 15 | public ConvertibleAttribute() 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Test/PeripheralsTests/CortexA9GICTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using NUnit.Framework; 9 | 10 | namespace Antmicro.Renode.PeripheralsTests 11 | { 12 | [TestFixture] 13 | public class CortexA9GICTests 14 | { 15 | [Test] 16 | public void ShouldSendAndReceiveIPI() 17 | { 18 | Assert.Inconclusive(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/UserInterface/IUserInterfaceProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Peripherals; 9 | 10 | namespace Antmicro.Renode.UserInterface 11 | { 12 | public interface IUserInterfaceProvider 13 | { 14 | void ShowAnalyser(IAnalyzableBackendAnalyzer analyzer, string name); 15 | 16 | void HideAnalyser(IAnalyzableBackendAnalyzer analyzer); 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Wireless/IEEE802_15_4/FrameType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.Wireless.IEEE802_15_4 9 | { 10 | public enum FrameType : byte 11 | { 12 | Beacon = 0x0, 13 | Data = 0x1, 14 | ACK = 0x2, 15 | MACControl = 0x3, 16 | Reserved4 = 0x4, 17 | Reserved5 = 0x5, 18 | Reserved6 = 0x6, 19 | Reserved7 = 0x7 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/osx-properties.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /usr/bin/clang 5 | /usr/bin/clang 6 | /usr/bin/ar 7 | OSX 8 | $(DefineConstants);PLATFORM_OSX 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Emulator/Extensions/Utilities/USBIP/AttachDeviceCommandDescriptor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2019 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.Packets; 9 | 10 | namespace Antmicro.Renode.Extensions.Utilities.USBIP 11 | { 12 | // the actual packet 13 | // is prepended with 14 | // the USBIP.Header 15 | public struct AttachDeviceCommandDescriptor 16 | { 17 | [PacketField, Width(bytes: 32)] 18 | public byte[] BusId; 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/GDB/GDBTypeEnumValue.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.CPU 8 | { 9 | public struct GDBTypeEnumValue 10 | { 11 | public GDBTypeEnumValue(string name, uint value) : this() 12 | { 13 | this.Name = name; 14 | this.Value = value; 15 | } 16 | 17 | public string Name { get; } 18 | 19 | public uint Value { get; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/GDB/ExecuteAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Utilities.GDB 10 | { 11 | [AttributeUsage(AttributeTargets.Method)] 12 | public class ExecuteAttribute : Attribute 13 | { 14 | public ExecuteAttribute(string mnemonic) 15 | { 16 | Mnemonic = mnemonic; 17 | } 18 | 19 | public string Mnemonic { get; private set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/linux-properties.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /usr/bin/gcc 5 | /usr/bin/gcc 6 | /usr/bin/ar 7 | Linux 8 | $(DefineConstants);PLATFORM_LINUX 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IIdentifiable.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core 8 | { 9 | public interface IIdentifiable 10 | { 11 | int UniqueObjectId { get; } 12 | } 13 | 14 | public static class IdentifiableExtensions 15 | { 16 | public static string GetDescription(this IIdentifiable @this) 17 | { 18 | return $"{@this.GetType().Name}#{@this.UniqueObjectId}"; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Network/CRCMode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Network 9 | { 10 | public enum CRCMode 11 | { 12 | // do not compute a new CRC and do not try to use the CRC from the data 13 | NoOperation, 14 | // compute a CRC 15 | Add, 16 | // remove a CRC from the data and compute a new CRC 17 | Replace, 18 | // use the CRC from the data 19 | Keep, 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Storage/SCSI/Commands/IReadWrite10Command.cs: -------------------------------------------------------------------------------- 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.Packets; 9 | 10 | namespace Antmicro.Renode.Storage.SCSI.Commands 11 | { 12 | public interface IReadWrite10Command 13 | { 14 | [PacketField, Offset(bytes: 2)] 15 | uint LogicalBlockAddress { get; set; } 16 | 17 | [PacketField, Offset(bytes: 7)] 18 | ushort TransferLength { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/CPU/SegmentMapping.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using Antmicro.Renode.Core; 8 | 9 | namespace Antmicro.Renode.Peripherals.CPU 10 | { 11 | public class SegmentMapping 12 | { 13 | public SegmentMapping(IMappedSegment segment) 14 | { 15 | Segment = segment; 16 | } 17 | 18 | public IMappedSegment Segment { get; } 19 | 20 | public bool Touched { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/USBDeprecated/USBSetupPacket.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Peripherals.USBDeprecated 11 | { 12 | public struct USBSetupPacket 13 | { 14 | public byte RequestType; 15 | public byte Request; 16 | public UInt16 Value; 17 | public UInt16 Index; 18 | public UInt16 Length; 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/Utilities/GDB/Commands/KillCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Utilities.GDB.Commands 9 | { 10 | internal class KillCommand : Command 11 | { 12 | public KillCommand(CommandsManager manager) : base(manager) 13 | { 14 | } 15 | 16 | [Execute("k")] 17 | public PacketData Execute() 18 | { 19 | return PacketData.Success; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/ConnectionRegionAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Peripherals.Bus 11 | { 12 | public class ConnectionRegionAttribute : Attribute 13 | { 14 | public ConnectionRegionAttribute(string name) 15 | { 16 | Name = name; 17 | } 18 | 19 | public string Name { get; private set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Tests/UnitTests/Mocks/MockIrqSenderWithTwoInterrupts.cs: -------------------------------------------------------------------------------- 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 | using Antmicro.Renode.Core; 8 | 9 | namespace Antmicro.Renode.UnitTests.Mocks 10 | { 11 | public class MockIrqSenderWithTwoInterrupts : MockIrqSender 12 | { 13 | public MockIrqSenderWithTwoInterrupts() : base() 14 | { 15 | AnotherIrq = new GPIO(); 16 | } 17 | 18 | public GPIO AnotherIrq { get; private set; } 19 | } 20 | } -------------------------------------------------------------------------------- /src/UI/VideoAnalyzer/Events/IEventSource.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Extensions.Analyzers.Video.Handlers; 9 | 10 | namespace Antmicro.Renode.Extensions.Analyzers.Video.Events 11 | { 12 | internal interface IEventSource 13 | { 14 | void AttachHandler(IOHandler h); 15 | 16 | void DetachHandler(); 17 | 18 | int X { get; } 19 | 20 | int Y { get; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/renode/arch/sparc/renode_sparc_callbacks.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2025 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under MIT License. 6 | // Full license text is available in 'licenses/MIT.txt' file. 7 | // 8 | 9 | #include "arch_callbacks.h" 10 | #include "renode_imports.h" 11 | 12 | EXTERNAL_AS(int32_t, FindBestInterrupt, tlib_find_best_interrupt) 13 | EXTERNAL_AS(void, AcknowledgeInterrupt, tlib_acknowledge_interrupt, int32_t) 14 | EXTERNAL_AS(void, OnCpuHalted, tlib_on_cpu_halted) 15 | EXTERNAL_AS(void, OnCpuPowerDown, tlib_on_cpu_power_down) 16 | -------------------------------------------------------------------------------- /src/Emulator/Extensions/Hooks/GPIOHookExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using Antmicro.Renode.Core; 8 | 9 | namespace Antmicro.Renode.Hooks 10 | { 11 | public static class GPIOHookExtensions 12 | { 13 | public static void AddStateChangedHook(this IGPIOWithHooks gpio, string pythonScript) 14 | { 15 | var engine = new GPIOPythonEngine(gpio, pythonScript); 16 | gpio.AddStateChangedHook(engine.Hook); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/virt/include/utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cpu.h" 4 | 5 | void kvm_abortf(const char *fmt, ...); 6 | 7 | void kvm_runtime_abortf(const char *fmt, ...); 8 | 9 | 10 | typedef enum { 11 | LOG_LEVEL_NOISY = -1, 12 | LOG_LEVEL_DEBUG = 0, 13 | LOG_LEVEL_INFO = 1, 14 | LOG_LEVEL_WARNING = 2, 15 | LOG_LEVEL_ERROR = 3, 16 | } LogLevel; 17 | 18 | void kvm_logf(LogLevel level, const char *fmt, ...); 19 | 20 | #define IOCTL_RETRY_LIMIT 10 21 | 22 | // Wrapper that will retry ioctl on EINTR a maximum of IOCTL_RETRY_LIMIT times. 23 | int ioctl_with_retry(int fd, unsigned long op, ...); 24 | -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Video/IVideo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | using Antmicro.Renode.Backends.Display; 11 | 12 | using ELFSharp.ELF; 13 | 14 | namespace Antmicro.Renode.Peripherals.Video 15 | { 16 | public interface IVideo : IPeripheral 17 | { 18 | event Action FrameRendered; 19 | 20 | event Action ConfigurationChanged; 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Main/UserInterface/HideInMonitorAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.UserInterface 11 | { 12 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Class)] 13 | public class HideInMonitorAttribute : Attribute 14 | { 15 | public HideInMonitorAttribute() 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IPeripheralsGroup.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System.Collections.Generic; 9 | 10 | using Antmicro.Renode.Peripherals; 11 | 12 | namespace Antmicro.Renode.Core 13 | { 14 | public interface IPeripheralsGroup 15 | { 16 | string Name { get; } 17 | 18 | IMachine Machine { get; } 19 | 20 | IEnumerable Peripherals { get; } 21 | 22 | void Unregister(); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/PCI/IPCIePeripheral.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.PCI 8 | { 9 | public interface IPCIePeripheral : IPeripheral 10 | { 11 | uint ConfigurationReadDoubleWord(long offset); 12 | 13 | void ConfigurationWriteDoubleWord(long offset, uint value); 14 | 15 | uint MemoryReadDoubleWord(uint bar, long offset); 16 | 17 | void MemoryWriteDoubleWord(uint bar, long offset, uint value); 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/Debug/FunctionCallParameterType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Debug 10 | { 11 | public enum FunctionCallParameterType 12 | { 13 | Ignore, 14 | Int64, 15 | UInt64, 16 | Int32, 17 | UInt32, 18 | Int16, 19 | UInt16, 20 | Byte, 21 | String, 22 | Int32Array, 23 | UInt32Array, 24 | ByteArray 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/virt/include/debug.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define TRAP_OPCODE 0xCC 8 | 9 | 10 | typedef struct Breakpoint { 11 | uint64_t pc; 12 | uint8_t code_byte; // stores value overshadowed by TRAP_OPCODE 13 | uint8_t* host_code_position; 14 | LIST_ENTRY(Breakpoint) list; 15 | } Breakpoint; 16 | 17 | bool is_breakpoint_address(uint64_t address); 18 | 19 | /* Translates guest's virtual address into guest physical address. 20 | * On failiure returns UINT64_MAX. */ 21 | uint64_t kvm_translate_guest_virtual_address(uint64_t address); 22 | -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/CPU/ExecutionTracer/FBInstruction/README.txt: -------------------------------------------------------------------------------- 1 | Trace Based Model expects unified instruction format for all supported architectures. 2 | The format is defined in `instruction.fbs` file written in FlatBuffers schema language. 3 | FlatBuffers compiler (`flatc`) is used to generate C# code for reading and writing the instruction format. 4 | FlatBuffers project is available at repository: https://github.com/google/flatbuffers. 5 | 6 | 'Instruction.cs' and `Instructions.cs` in this directory are auto-generated from FlatBuffers schema file `instruction.fbs`: 7 | 8 | ``` 9 | flatc --csharp instruction.fbs 10 | ``` -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-zicbo: -------------------------------------------------------------------------------- 1 | # Zicbom: cache-block management instructions 2 | cbo.clean rs1 31..20=1 14..12=2 11..7=0 6..2=0x03 1..0=3 3 | cbo.flush rs1 31..20=2 14..12=2 11..7=0 6..2=0x03 1..0=3 4 | cbo.inval rs1 31..20=0 14..12=2 11..7=0 6..2=0x03 1..0=3 5 | 6 | # Zicboz: cache-block zero instruction 7 | cbo.zero rs1 31..20=4 14..12=2 11..7=0 6..2=0x03 1..0=3 8 | 9 | # Zicbop: prefetch hint pseudoinstructions 10 | @prefetch.i rs1 imm12hi 24..20=0 14..12=6 11..7=0 6..2=0x04 1..0=3 11 | @prefetch.r rs1 imm12hi 24..20=1 14..12=6 11..7=0 6..2=0x04 1..0=3 12 | @prefetch.w rs1 imm12hi 24..20=3 14..12=6 11..7=0 6..2=0x04 1..0=3 13 | -------------------------------------------------------------------------------- /src/Emulator/Extensions/Utilities/GDB/Commands/ReportHaltReasonCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Utilities.GDB.Commands 8 | { 9 | internal class ReportHaltReasonCommand : Command 10 | { 11 | public ReportHaltReasonCommand(CommandsManager manager) : base(manager) 12 | { 13 | } 14 | 15 | [Execute("?")] 16 | public PacketData Execute() 17 | { 18 | return PacketData.StopReply(0); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/Utilities/GDB/Commands/SingleStepCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Utilities.GDB.Commands 8 | { 9 | internal class SingleStepCommand : Command 10 | { 11 | public SingleStepCommand(CommandsManager manager) : base(manager) 12 | { 13 | } 14 | 15 | [Execute("s")] 16 | public PacketData Execute() 17 | { 18 | manager.Cpu.Step(1); 19 | return null; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/Utilities/USBIP/DeviceListCount.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2019 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.Packets; 9 | 10 | namespace Antmicro.Renode.Extensions.Utilities.USBIP 11 | { 12 | public struct DeviceListCount 13 | { 14 | [PacketField] 15 | public uint NumberOfExportedDevices; 16 | 17 | public override string ToString() 18 | { 19 | return $"NumberOfExportedDevices = {NumberOfExportedDevices}"; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IPhysicalLayer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals 9 | { 10 | public interface IPhysicalLayer : IPhysicalLayer 11 | { 12 | } 13 | 14 | public interface IPhysicalLayer : IPhysicalLayer 15 | { 16 | V Read(T addr); 17 | 18 | void Write(T addr, V val); 19 | } 20 | 21 | public interface IPhysicalLayer : IPeripheral 22 | { 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/Packets/LeastSignificantByteFirst.cs: -------------------------------------------------------------------------------- 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 | using System; 8 | 9 | namespace Antmicro.Renode.Utilities.Packets 10 | { 11 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Struct | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 12 | public sealed class LeastSignificantByteFirst : Attribute 13 | { 14 | public LeastSignificantByteFirst() 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/renode/arch/ppc/renode_ppc_callbacks.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2025 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under MIT License. 6 | // Full license text is available in 'licenses/MIT.txt' file. 7 | // 8 | 9 | #include "arch_callbacks.h" 10 | #include "renode_imports.h" 11 | 12 | EXTERNAL_AS(uint32_t, ReadTbl, tlib_read_tbl) 13 | EXTERNAL_AS(uint32_t, ReadTbu, tlib_read_tbu) 14 | EXTERNAL_AS(uint64_t, ReadDecrementer, tlib_read_decrementer) 15 | EXTERNAL_AS(void, WriteDecrementer, tlib_write_decrementer, uint64_t) 16 | EXTERNAL_AS(uint32_t, IsVleEnabled, tlib_is_vle_enabled) 17 | -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/Registers/Tag.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Core.Structure.Registers 11 | { 12 | /// 13 | /// Information about an unhandled field in a register. 14 | /// 15 | public struct Tag 16 | { 17 | public String Name; 18 | public int Position; 19 | public int Width; 20 | public ulong? AllowedValue; 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Wireless/IRadio.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2025 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | using Antmicro.Renode.Peripherals.Network; 11 | 12 | namespace Antmicro.Renode.Peripherals.Wireless 13 | { 14 | public interface IRadio : IPeripheral, INetworkInterface 15 | { 16 | int Channel { get; set; } 17 | 18 | event Action FrameSent; 19 | 20 | void ReceiveFrame(byte[] frame, IRadio sender); 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Tests/UnitTests/Mocks/MockReceiverConstrained.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | using Antmicro.Renode.Core; 10 | 11 | namespace Antmicro.Renode.UnitTests.Mocks 12 | { 13 | [GPIO(NumberOfInputs = 5)] 14 | public class MockReceiverConstrained : IGPIOReceiver 15 | { 16 | public void Reset() 17 | { 18 | } 19 | 20 | public void OnGPIO(int number, bool value) 21 | { 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/Token.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.UserInterface.Tokenizer 10 | { 11 | public abstract class Token 12 | { 13 | public abstract object GetObjectValue(); 14 | 15 | public string OriginalValue { get; protected set; } 16 | 17 | protected Token(string originalValue) 18 | { 19 | OriginalValue = originalValue; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/GPIOEndpoint.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core 9 | { 10 | public sealed class GPIOEndpoint 11 | { 12 | public GPIOEndpoint(IGPIOReceiver receiver, int number) 13 | { 14 | Receiver = receiver; 15 | Number = number; 16 | } 17 | 18 | public IGPIOReceiver Receiver { get; private set; } 19 | 20 | public int Number { get; private set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/USBDeprecated/DescriptorType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.USBDeprecated 9 | { 10 | public enum DescriptorType : byte 11 | { 12 | Device = 1, 13 | Configuration = 2, 14 | String = 3, 15 | Interface = 4, 16 | Endpoint = 5, 17 | DeviceQualifier = 6, 18 | OtherSpeedConfiguration = 7, 19 | InterfacePower = 8 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/NullToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class NullToken : Token 11 | { 12 | public NullToken(string value) : base(value) 13 | { 14 | } 15 | 16 | public override object GetObjectValue() 17 | { 18 | return Value; 19 | } 20 | 21 | public object Value { get { return null; } } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IPeripheralWithTransactionState.cs: -------------------------------------------------------------------------------- 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 | using System.Collections.Generic; 8 | 9 | namespace Antmicro.Renode.Peripherals 10 | { 11 | public interface IPeripheralWithTransactionState : IPeripheral 12 | { 13 | IReadOnlyDictionary StateBits { get; } 14 | 15 | bool TryConvertStateObjToUlong(IContextState stateObj, out ulong? state); 16 | 17 | bool TryConvertUlongToStateObj(ulong? state, out IContextState stateObj); 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/USBDeprecated/USBPacket.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.USBDeprecated 9 | { 10 | public enum MessageRecipient 11 | { 12 | Device = 0, 13 | Interface = 1, 14 | Endpoint = 2, 15 | Other = 3 16 | } 17 | 18 | public struct USBPacket 19 | { 20 | public byte Ep; 21 | public byte [] Data; 22 | public long BytesToTransfer; 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Wireless/Position.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.Wireless 8 | { 9 | public struct Position 10 | { 11 | public Position(decimal x, decimal y, decimal z) : this() 12 | { 13 | X = x; 14 | Y = y; 15 | Z = z; 16 | } 17 | 18 | public decimal X { get; private set; } 19 | 20 | public decimal Y { get; private set; } 21 | 22 | public decimal Z { get; private set; } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rv64c: -------------------------------------------------------------------------------- 1 | # RV64C additions to RVC 2 | 3 | # C0 encoding space 4 | @c.ld 1..0=0 15..13=3 12=ignore 11..2=ignore # c.flw for RV32 5 | @c.sd 1..0=0 15..13=7 12=ignore 11..2=ignore # c.fsw for RV32 6 | 7 | # C1 encoding space 8 | c.subw 1..0=1 15..13=4 12=1 11..10=3 9..7=ignore 6..5=0 4..2=ignore 9 | c.addw 1..0=1 15..13=4 12=1 11..10=3 9..7=ignore 6..5=1 4..2=ignore 10 | @c.addiw 1..0=1 15..13=1 12=ignore 11..2=ignore # c.jal for RV32 11 | 12 | # C2 encoding space 13 | @c.ldsp 1..0=2 15..13=3 12=ignore 11..2=ignore # c.flwsp for RV32 14 | @c.sdsp 1..0=2 15..13=7 12=ignore 11..2=ignore # c.fswsp for RV32 15 | -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/SPI/SPILoopback.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.SPI 8 | { 9 | //This is a dummy device, emulating connection between MISO and MOSI lines. 10 | public class SPILoopback : ISPIPeripheral 11 | { 12 | public void FinishTransmission() 13 | { 14 | } 15 | 16 | public void Reset() 17 | { 18 | } 19 | 20 | public byte Transmit(byte data) 21 | { 22 | return data; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Emulator/Main/UserInterface/IconAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.UserInterface 11 | { 12 | [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class)] 13 | public class IconAttribute : Attribute 14 | { 15 | public IconAttribute(string resource) 16 | { 17 | ResourceName = resource; 18 | } 19 | 20 | public string ResourceName { get; private set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Exceptions/RegisterValueUnavailableException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Exceptions 10 | { 11 | public class RegisterValueUnavailableException : RecoverableException 12 | { 13 | public RegisterValueUnavailableException(string message) : base(message) 14 | { 15 | } 16 | 17 | public RegisterValueUnavailableException(string message, Exception innerException) : base(message, innerException) 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Network/IMACInterface.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | using System; 10 | 11 | using Antmicro.Renode.Core.Structure; 12 | using Antmicro.Renode.Network; 13 | 14 | namespace Antmicro.Renode.Peripherals.Network 15 | { 16 | public interface IMACInterface : INetworkInterface 17 | { 18 | MACAddress MAC { get; set; } 19 | 20 | void ReceiveFrame(EthernetFrame frame); 21 | 22 | event Action FrameReady; 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Exceptions/ConstructionException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Exceptions 11 | { 12 | public class ConstructionException : RecoverableException 13 | { 14 | public ConstructionException(string message) : base(message) 15 | { 16 | } 17 | 18 | public ConstructionException(string message, Exception innerException) : base(message, innerException) 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/IBlobProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System.IO; 9 | 10 | namespace Antmicro.Renode.Utilities 11 | { 12 | public interface IBlobProvider 13 | { 14 | BlobDescriptor GetBlobDescriptor(); 15 | 16 | void BlobIsReady(string fileName, long offset, long length); 17 | } 18 | 19 | public struct BlobDescriptor 20 | { 21 | public Stream Stream { get; set; } 22 | 23 | public long Size { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/Registers/IEnumRegisterField.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Core.Structure.Registers 11 | { 12 | /// 13 | /// Register field that provides a value of type T, where T is an enumeration. 14 | /// The maximum value of T must not exceed the field's width. 15 | /// 16 | public interface IEnumRegisterField : IRegisterField where T : struct, IConvertible 17 | { 18 | } 19 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IAnalyzableBackend.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2025 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Utilities; 9 | 10 | namespace Antmicro.Renode.Peripherals 11 | { 12 | public interface IAnalyzableBackend : IAnalyzableBackend where T : IAnalyzable 13 | { 14 | void Attach(T emulationElement); 15 | } 16 | 17 | public interface IAnalyzableBackend : IAutoLoadType 18 | { 19 | IAnalyzable AnalyzableElement { get; } 20 | 21 | void Detach(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/UART/IUARTWithBufferState.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 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 System; 9 | 10 | using Antmicro.Renode.UserInterface; 11 | 12 | namespace Antmicro.Renode.Peripherals.UART 13 | { 14 | [Icon("monitor")] 15 | public interface IUARTWithBufferState : IUART 16 | { 17 | event Action BufferStateChanged; 18 | 19 | BufferState BufferState { get; } 20 | } 21 | 22 | public enum BufferState 23 | { 24 | Empty, 25 | Ready, 26 | Full, 27 | } 28 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Wireless/BLEMedium.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using Antmicro.Renode.Core; 8 | 9 | namespace Antmicro.Renode.Peripherals.Wireless 10 | { 11 | public static class BLEExtensions 12 | { 13 | public static void CreateBLEMedium(this Emulation emulation, string name) 14 | { 15 | emulation.ExternalsManager.AddExternal(new BLEMedium(), name); 16 | } 17 | } 18 | 19 | public sealed class BLEMedium : WirelessMedium 20 | { 21 | public BLEMedium() { } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CAN/ICAN.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | using Antmicro.Renode.Core.CAN; 11 | using Antmicro.Renode.Peripherals.Network; 12 | using Antmicro.Renode.UserInterface; 13 | 14 | namespace Antmicro.Renode.Peripherals.CAN 15 | { 16 | [Icon("can")] 17 | public interface ICAN : IPeripheral, INetworkInterface 18 | { 19 | event Action FrameSent; 20 | 21 | void OnFrameReceived(CANMessageFrame message); 22 | } 23 | } -------------------------------------------------------------------------------- /src/UI/VideoAnalyzer/DummyVideoAnalyzer.cs: -------------------------------------------------------------------------------- 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 | using Antmicro.Renode.Backends.Video; 8 | using Antmicro.Renode.Peripherals; 9 | 10 | namespace Antmicro.Renode.Extensions.Analyzers.Video 11 | { 12 | public class DummyVideoAnalyzer : BasicPeripheralBackendAnalyzer 13 | { 14 | public override void Hide() 15 | { 16 | } 17 | 18 | public override void Show() 19 | { 20 | } 21 | 22 | public override void Clear() 23 | { 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/Hooks/PSCIHookExtensions.cs: -------------------------------------------------------------------------------- 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.Peripherals.CPU; 9 | 10 | namespace Antmicro.Renode.Hooks 11 | { 12 | public static class PSCIHookExtensions 13 | { 14 | public static void AddCustomPSCIHandler(this ICPUWithPSCI cpu, ulong functionIdentifier, string pythonScript) 15 | { 16 | var engine = new PSCIPythonEngine(cpu, pythonScript, functionIdentifier); 17 | cpu.AddCustomPSCIHandler(functionIdentifier, engine.Hook); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ICPUWithMMU.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.CPU 8 | { 9 | public interface ICPUWithMMU 10 | { 11 | ulong TranslateAddress(ulong logicalAddress, MpuAccess accessType); 12 | 13 | bool TryTranslateAddress(ulong logicalAddress, MpuAccess accessType, out ulong physicalAddress); 14 | 15 | uint PageSize { get; } 16 | } 17 | 18 | public enum MpuAccess 19 | { 20 | Read = 0, 21 | Write = 1, 22 | InstructionFetch = 2 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/ConditionalEqualityToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class ConditionalEqualityToken : EqualityToken 11 | { 12 | public ConditionalEqualityToken(string value) : base(value) 13 | { 14 | } 15 | 16 | public override string ToString() 17 | { 18 | return string.Format("[ConditionalEqualityToken: Value={0}]", Value); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/UserInterface/ControllerMaskAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.UserInterface 11 | { 12 | [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class)] 13 | public class ControllerMaskAttribute : Attribute 14 | { 15 | public ControllerMaskAttribute(params Type[] types) 16 | { 17 | MaskedTypes = types; 18 | } 19 | 20 | public Type[] MaskedTypes { get; private set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/CommaToken.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class CommaToken : Token 11 | { 12 | public CommaToken(string token) : base(token) 13 | { 14 | } 15 | 16 | public override object GetObjectValue() 17 | { 18 | return OriginalValue; 19 | } 20 | 21 | public override string ToString() 22 | { 23 | return string.Format("[CommaToken]"); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/MultilineStringTerminatorToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class MultilineStringTerminatorToken : StringToken 11 | { 12 | public MultilineStringTerminatorToken(string value) : base(value) 13 | { 14 | } 15 | 16 | public override string ToString() 17 | { 18 | return string.Format("[MultilineStringTerminatorToken]"); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/Collections/TreeNode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Utilities.Collections 10 | { 11 | public class TreeNode : TreeBase, T> 12 | { 13 | public TreeNode(T value) : base(value) 14 | { 15 | } 16 | 17 | public override TreeNode AddChild(T value) 18 | { 19 | var node = new TreeNode(value); 20 | ChildrenList.Add(node); 21 | return node; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ICpuSupportingGdb.cs: -------------------------------------------------------------------------------- 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 | using System.Collections.Generic; 8 | 9 | namespace Antmicro.Renode.Peripherals.CPU 10 | { 11 | public interface ICpuSupportingGdb : ICPUWithHooks, ICPUWithRegisters 12 | { 13 | void EnterSingleStepModeSafely(HaltArguments args); 14 | 15 | string GDBArchitecture { get; } 16 | 17 | List GDBFeatures { get; } 18 | 19 | bool DebuggerConnected { get; set; } 20 | 21 | bool ShouldEnterDebugMode { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/HexToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.UserInterface.Tokenizer 11 | { 12 | public class HexToken : DecimalIntegerToken 13 | { 14 | public HexToken(string value) : base(Convert.ToInt64(value.Split('x')[1], 16).ToString()) 15 | { 16 | } 17 | 18 | public override string ToString() 19 | { 20 | return string.Format("[HexToken: Value={0}]", Value); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/Hooks/UserStateHookExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Core; 9 | 10 | namespace Antmicro.Renode.Hooks 11 | { 12 | public static class UserStateHookExtensions 13 | { 14 | public static void AddUserStateHook(this IMachine machine, string stateName, string pythonScript) 15 | { 16 | var engine = new UserStatePythonEngine(machine, pythonScript); 17 | machine.AddUserStateHook(x => x == stateName, engine.Hook); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/MachineStateChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core 9 | { 10 | public class MachineStateChangedEventArgs 11 | { 12 | public MachineStateChangedEventArgs(State state) 13 | { 14 | CurrentState = state; 15 | } 16 | 17 | public State CurrentState { get; private set; } 18 | 19 | public enum State 20 | { 21 | Started, 22 | Paused, 23 | Disposed 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/Debug/FunctionCallParameter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Debug 10 | { 11 | public struct FunctionCallParameter 12 | { 13 | static FunctionCallParameter() 14 | { 15 | IgnoredParameter = new FunctionCallParameter { Type = FunctionCallParameterType.Ignore }; 16 | } 17 | 18 | public FunctionCallParameterType Type; 19 | public int NumberOfElements; 20 | 21 | public static FunctionCallParameter IgnoredParameter; 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ICPUWithMemoryAccessHooks.cs: -------------------------------------------------------------------------------- 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.Logging.Profiling; 9 | 10 | namespace Antmicro.Renode.Peripherals.CPU 11 | { 12 | public interface ICPUWithMemoryAccessHooks : ICPU 13 | { 14 | void SetHookAtMemoryAccess(MemoryAccessHook hook); 15 | } 16 | 17 | public delegate void MemoryAccessHook( 18 | ulong virtualPC, 19 | MemoryOperation operation, 20 | ulong virtualAddress, 21 | ulong physicalAddress, 22 | uint width, 23 | ulong value 24 | ); 25 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/CPU/ExecutionTracer/FBInstruction/instruction.fbs: -------------------------------------------------------------------------------- 1 | namespace FBInstruction; 2 | 3 | table Instruction { 4 | addr : uint64; 5 | opcode: uint32; 6 | mnemonic: string; 7 | operands: [string]; 8 | inputs: [string]; 9 | outputs: [string]; 10 | is_nop: bool; 11 | is_branch: bool; 12 | branch_target: uint64; // 0 means not set 13 | is_flush: bool; 14 | is_vctrl: bool; 15 | loads: [uint64]; 16 | stores: [uint64]; 17 | lmul: float32; // valid values: 1/8, 1/4, 1/2, 1, 2, 4, 8, and 0 which means not set 18 | sew: uint8; // 0 means not set 19 | vl: int16; // -1 means not set 20 | } 21 | 22 | table Instructions { instructions:[Instruction]; } 23 | 24 | root_type Instructions; 25 | -------------------------------------------------------------------------------- /src/Emulator/Extensions/Backends/Display/xInput/IInputHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Backends.Display.XInput 9 | { 10 | public interface IInputHandler 11 | { 12 | void ButtonPressed(int button); 13 | 14 | void ButtonReleased(int button); 15 | 16 | void KeyPressed(int key); 17 | 18 | void KeyReleased(int key); 19 | 20 | void MouseMoved(int x, int y, int dx, int dy); 21 | 22 | bool Stop { get; set; } 23 | 24 | bool CursorFixed { get; } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/CpuAbortException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Peripherals.CPU 11 | { 12 | public class CpuAbortException : Exception 13 | { 14 | public CpuAbortException() 15 | { 16 | } 17 | 18 | public CpuAbortException(string message) : base(message) 19 | { 20 | } 21 | 22 | public CpuAbortException(string message, Exception innerException) : base(message, innerException) 23 | { 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/Binding/ImportAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | using Antmicro.Migrant; 11 | 12 | namespace Antmicro.Renode.Utilities.Binding 13 | { 14 | [AttributeUsage(AttributeTargets.Field)] 15 | public class ImportAttribute : TransientAttribute 16 | { 17 | public string Name { get; set; } 18 | 19 | public bool UseExceptionWrapper { get; set; } = true; 20 | 21 | // By default all [Import]s are required 22 | public bool Optional { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Wireless/IEEE802_15_4Medium.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using Antmicro.Renode.Core; 8 | 9 | namespace Antmicro.Renode.Peripherals.Wireless 10 | { 11 | public static class IEEE802_15_4Extensions 12 | { 13 | public static void CreateIEEE802_15_4Medium(this Emulation emulation, string name) 14 | { 15 | emulation.ExternalsManager.AddExternal(new IEEE802_15_4Medium(), name); 16 | } 17 | } 18 | 19 | public sealed class IEEE802_15_4Medium : WirelessMedium 20 | { 21 | public IEEE802_15_4Medium() { } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Network/IBasicNetworkNode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 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.Peripherals; 9 | 10 | namespace Antmicro.Renode.Network 11 | { 12 | public delegate bool BasicNetworkSendDataDelegate(TData data, TAddress source, TAddress destination); 13 | 14 | public interface IBasicNetworkNode : IPeripheral 15 | { 16 | void ReceiveData(TData data, TAddress source, TAddress destination); 17 | 18 | event BasicNetworkSendDataDelegate TrySendData; 19 | 20 | TAddress NodeAddress { get; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Wireless/CC2538/InterruptSource.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.Wireless.CC2538 8 | { 9 | internal enum InterruptSource 10 | { 11 | StartOfFrameDelimiter, 12 | FifoP, 13 | SrcMatchDone, 14 | SrcMatchFound, 15 | FrameAccepted, 16 | RxPktDone, 17 | RxMaskZero, 18 | 19 | TxAckDone, 20 | TxDone, 21 | RfIdle, 22 | CommandStrobeProcessorManualInterrupt, 23 | CommandStrobeProcessorStop, 24 | CommandStrobeProcessorWait 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/Utilities/GDB/Commands/ContinueCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using Antmicro.Renode.Peripherals.CPU; 8 | 9 | namespace Antmicro.Renode.Utilities.GDB.Commands 10 | { 11 | internal class ContinueCommand : Command 12 | { 13 | public ContinueCommand(CommandsManager manager) : base(manager) 14 | { 15 | } 16 | 17 | [Execute("c")] 18 | public PacketData Execute() 19 | { 20 | manager.Cpu.ExecutionMode = ExecutionMode.Continuous; 21 | manager.Cpu.Resume(); 22 | 23 | return null; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/Utilities/GDB/Commands/CurrentThreadCommand.cs: -------------------------------------------------------------------------------- 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 | using Antmicro.Renode.Utilities.GDB; 8 | 9 | namespace Antmicro.Renode.Extensions.Utilities.GDB.Commands 10 | { 11 | public class CurrentThreadCommand : Command, IMultithreadCommand 12 | { 13 | public CurrentThreadCommand(CommandsManager manager) : base(manager) 14 | { 15 | } 16 | 17 | [Execute("qC")] 18 | public PacketData Execute() 19 | { 20 | return new PacketData(string.Format("QC{0:x}", manager.ManagedCpus[manager.Cpu])); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/X86/X86Registers.tt: -------------------------------------------------------------------------------- 1 | <# 2 | // 3 | // Copyright (c) 2010-2018 Antmicro 4 | // Copyright (c) 2011-2015 Realtime Embedded 5 | // 6 | // This file is licensed under the MIT License. 7 | // Full license text is available in 'licenses/MIT.txt'. 8 | // 9 | #> 10 | <#@ template language="C#" #> 11 | <#@ include file="../Common/RegisterTemplateDefinitions.tt" #> 12 | <# 13 | CLASS_NAME = "X86"; 14 | HEADER_FILE = "Emulator/Cores/tlib/arch/i386/cpu_registers.h"; 15 | 16 | PC_REGISTER = "EIP"; 17 | 18 | GENERAL_REGISTERS.AddRange(new[] { "EAX", "ECX", "EDX", "EBX", "ESP", "EBP", "ESI", "EDI", "EIP", "EFLAGS", "CS", "SS", "DS", "ES", "FS", "GS", "CR0", "CR1", "CR2", "CR3", "CR4" }); 19 | #> 20 | <#@ include file="../Common/RegisterTemplate.tt" #> -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/LeftBraceToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class LeftBraceToken : Token 11 | { 12 | public LeftBraceToken(string token) : base(token) 13 | { 14 | } 15 | 16 | public override object GetObjectValue() 17 | { 18 | return OriginalValue; 19 | } 20 | 21 | public override string ToString() 22 | { 23 | return string.Format("[LeftBraceToken]"); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/RightBraceToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class RightBraceToken : Token 11 | { 12 | public RightBraceToken(string token) : base(token) 13 | { 14 | } 15 | 16 | public override object GetObjectValue() 17 | { 18 | return OriginalValue; 19 | } 20 | 21 | public override string ToString() 22 | { 23 | return string.Format("[RightBraceToken]"); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Logging/ILoggerBackend.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2021 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | using System.Collections.Generic; 10 | 11 | namespace Antmicro.Renode.Logging 12 | { 13 | public interface ILoggerBackend : IDisposable 14 | { 15 | void Log(LogEntry entry); 16 | 17 | void SetLogLevel(LogLevel level, int sourceId = -1); 18 | 19 | LogLevel GetLogLevel(); 20 | 21 | IDictionary GetCustomLogLevels(); 22 | 23 | void Reset(); 24 | 25 | void Flush(); 26 | 27 | bool IsControllable { get; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/USB/StandardRequest.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Core.USB 8 | { 9 | public enum StandardRequest 10 | { 11 | GetStatus = 0, 12 | ClearFeature = 1, 13 | // value 2 reserved for the future use 14 | SetFeature = 3, 15 | // value 4 reserved for the future use 16 | SetAddress = 5, 17 | GetDescriptor = 6, 18 | SetDescriptor = 7, 19 | GetConfiguration = 8, 20 | SetConfiguration = 9, 21 | GetInterface = 10, 22 | SetInterface = 11, 23 | SynchronizeFrame = 12 24 | } 25 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Plugins/PluginAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Plugins 11 | { 12 | [AttributeUsage(AttributeTargets.Class)] 13 | public class PluginAttribute : Attribute 14 | { 15 | public string Name { get; set; } 16 | 17 | public string Description { get; set; } 18 | 19 | public string Version { get; set; } 20 | 21 | public string Vendor { get; set; } 22 | 23 | public Type[] Dependencies { get; set; } 24 | 25 | public string[] Modes { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/Utilities/GDB/Commands/ThreadAliveCommand.cs: -------------------------------------------------------------------------------- 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 | using Antmicro.Renode.Utilities.GDB; 8 | 9 | namespace Antmicro.Renode.Extensions.Utilities.GDB.Commands 10 | { 11 | public class ThreadAliveCommand : Command, IMultithreadCommand 12 | { 13 | public ThreadAliveCommand(CommandsManager manager) : base(manager) 14 | { 15 | } 16 | 17 | [Execute("T")] 18 | public PacketData Execute() 19 | { 20 | // return information to gdb that the thread is still alive 21 | return new PacketData("OK"); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/IAnalyzableBackendAnalyzer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2025 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Utilities; 9 | 10 | namespace Antmicro.Renode.Peripherals 11 | { 12 | public interface IAnalyzableBackendAnalyzer : IAnalyzableBackendAnalyzer where T : IAnalyzableBackend 13 | { 14 | void AttachTo(T backend); 15 | } 16 | 17 | public interface IAnalyzableBackendAnalyzer : IAutoLoadType 18 | { 19 | void Show(); 20 | 21 | void Hide(); 22 | 23 | void Clear(); 24 | 25 | IAnalyzableBackend Backend { get; } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/Binding/INativeUnwindable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Utilities.Binding 9 | { 10 | // This interface should be implemented by classes that export methods that can throw exceptions 11 | // using NativeBinder. If it is not implemented, an exception being thrown by an export will 12 | // cause the process to exit. For an example implementation, see tlib's unwind.h and tlib_unwind 13 | // (the C# implementation will usually consist of just a call to a native function.) 14 | public interface INativeUnwindable 15 | { 16 | void NativeUnwind(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/UI/VideoAnalyzer/Handlers/RelativePointerHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Peripherals.Input; 9 | 10 | namespace Antmicro.Renode.Extensions.Analyzers.Video.Handlers 11 | { 12 | internal class RelativePointerHandler : PointerHandler 13 | { 14 | public RelativePointerHandler(IRelativePositionPointerInput input) : base(input) 15 | { 16 | } 17 | 18 | public override void PointerMoved(int x, int y, int dx, int dy) 19 | { 20 | ((IRelativePositionPointerInput)input).MoveBy(dx, dy); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Logging/ILogger.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Logging 11 | { 12 | public interface ILogger : IDisposable 13 | { 14 | string GetMachineName(int id); 15 | 16 | string GetObjectName(int id); 17 | 18 | void Flush(); 19 | 20 | int GetOrCreateSourceId(object source); 21 | 22 | bool TryGetName(int id, out string objectName, out string machineName); 23 | 24 | bool TryGetSourceId(object source, out int id); 25 | 26 | bool SynchronousLogging { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Input/IAbsolutePositionPointerInput.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals.Input 9 | { 10 | public interface IAbsolutePositionPointerInput : IPointerInput 11 | { 12 | void MoveTo(int x, int y); 13 | 14 | int MaxX { get; } 15 | 16 | int MaxY { get; } 17 | 18 | //These two almost always should equal zero. If you need to provide a 19 | //blind area, take a look at IAbsolutePositionPointerInputWithActiveArea. 20 | int MinX { get; } 21 | 22 | int MinY { get; } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/Packets/PacketFieldAttribute.cs: -------------------------------------------------------------------------------- 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 | using System; 8 | 9 | namespace Antmicro.Renode.Utilities.Packets 10 | { 11 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 12 | public sealed class PacketFieldAttribute : Attribute 13 | { 14 | public PacketFieldAttribute([System.Runtime.CompilerServices.CallerLineNumber] int order = 0) 15 | { 16 | this.order = order; 17 | } 18 | 19 | public int Order { get { return order; } } 20 | 21 | private readonly int order; 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/Arm/ArmRegisters.tt: -------------------------------------------------------------------------------- 1 | <# 2 | // 3 | // Copyright (c) 2010-2018 Antmicro 4 | // Copyright (c) 2011-2015 Realtime Embedded 5 | // 6 | // This file is licensed under the MIT License. 7 | // Full license text is available in 'licenses/MIT.txt'. 8 | // 9 | #> 10 | <#@ template language="C#" #> 11 | <#@ include file="../Common/RegisterTemplateDefinitions.tt" #> 12 | <# 13 | CLASS_NAME = "Arm"; 14 | HEADER_FILE = "Emulator/Cores/tlib/arch/arm/cpu_registers.h"; 15 | DEFINES.Add("TARGET_ARM32"); 16 | 17 | BEFORE_WRITE_HOOKS.Add("PC", "BeforePCWrite"); 18 | 19 | GENERAL_REGISTERS.AddRange(new[] { "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15" }); 20 | #> 21 | <#@ include file="../Common/RegisterTemplate.tt" #> 22 | -------------------------------------------------------------------------------- /src/Emulator/Cores/Xtensa/XtensaRegisters.tt: -------------------------------------------------------------------------------- 1 | <# 2 | // 3 | // Copyright (c) 2010-2022 Antmicro 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | #> 9 | <#@ template language="C#" #> 10 | <#@ include file="../Common/RegisterTemplateDefinitions.tt" #> 11 | <# 12 | CLASS_NAME = "Xtensa"; 13 | HEADER_FILE = "Emulator/Cores/tlib/arch/xtensa/cpu_registers.h"; 14 | 15 | GENERAL_REGISTERS.AddRange(new[] { "AR0", "AR1", "AR2", "AR3", "AR4", "AR5" , "AR6" , "AR7" , "AR8" , "AR9", 16 | "AR10", "AR11", "AR12", "AR13", "AR14", "AR15", "PC" }); 17 | 18 | UNSETTABLE_REGISTERS.AddRange(new[] { "INTERRUPT" }); 19 | #> 20 | <#@ include file="../Common/RegisterTemplate.tt" #> 21 | -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IMappedSegment.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Core 11 | { 12 | public interface IMappedSegment 13 | { 14 | IntPtr Pointer { get; } 15 | 16 | ulong StartingOffset { get; } 17 | 18 | ulong Size { get; } 19 | 20 | void Touch(); 21 | } 22 | 23 | public static class IMappedSegmentExtensions 24 | { 25 | public static Range GetRange(this IMappedSegment segment) 26 | { 27 | return new Range(segment.StartingOffset, segment.Size); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/SPI/Cadence_xSPICommands/IDMACommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System.Collections.Generic; 8 | 9 | using static Antmicro.Renode.Peripherals.SPI.Cadence_xSPI; 10 | 11 | namespace Antmicro.Renode.Peripherals.SPI.Cadence_xSPICommands 12 | { 13 | internal interface IDMACommand 14 | { 15 | void WriteData(IReadOnlyList data); 16 | 17 | IList ReadData(int length); 18 | 19 | TransmissionDirection DMADirection { get; } 20 | 21 | uint DMADataCount { get; } 22 | 23 | bool DMATriggered { get; } 24 | 25 | bool DMAError { get; } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/NonstandardCSR.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2021 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Peripherals.CPU 10 | { 11 | public struct NonstandardCSR 12 | { 13 | public NonstandardCSR(Func readOperation, Action writeOperation, string name) : this() 14 | { 15 | this.ReadOperation = readOperation; 16 | this.WriteOperation = writeOperation; 17 | this.Name = name; 18 | } 19 | 20 | public Func ReadOperation { get; } 21 | 22 | public Action WriteOperation { get; } 23 | 24 | public string Name { get; } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Commands/RequireVariableCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.UserInterface.Tokenizer; 9 | 10 | namespace Antmicro.Renode.UserInterface.Commands 11 | { 12 | public class RequireVariableCommand : AutoLoadCommand 13 | { 14 | public RequireVariableCommand(Monitor monitor) : base(monitor, "require", "verifies the existence of a variable.") 15 | { 16 | } 17 | 18 | [Runnable] 19 | public void Run(Token _) 20 | { 21 | // THIS METHOD IS INTENTIONALY LEFT BLANK 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/FileLocker.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Utilities 10 | { 11 | public class FileLocker : IDisposable 12 | { 13 | public FileLocker(string fileToLock) 14 | { 15 | #if PLATFORM_WINDOWS 16 | innerLocker = new WindowsFileLocker(fileToLock); 17 | #else 18 | innerLocker = new PosixFileLocker(fileToLock); 19 | #endif 20 | } 21 | 22 | public void Dispose() 23 | { 24 | innerLocker?.Dispose(); 25 | innerLocker = null; 26 | } 27 | 28 | private IDisposable innerLocker; 29 | } 30 | } -------------------------------------------------------------------------------- /src/Plugins/SampleCommandPlugin/SampleCommandPlugin_NET.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net6.0 4 | net6.0-windows10.0.17763.0 5 | SampleCommandPlugin 6 | ..\..\..\..\..\output\properties.csproj 7 | 7.2 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/BasicPeripheralBackendAnalyzer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2025 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Peripherals 9 | { 10 | public abstract class BasicPeripheralBackendAnalyzer : IAnalyzableBackendAnalyzer where T : IAnalyzableBackend 11 | { 12 | public virtual void AttachTo(T backend) 13 | { 14 | Backend = backend; 15 | } 16 | 17 | public abstract void Show(); 18 | 19 | public abstract void Hide(); 20 | 21 | public abstract void Clear(); 22 | 23 | public IAnalyzableBackend Backend { get; private set; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/USBDeprecated/IUSBHubBase.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | using Antmicro.Renode.Core.Structure; 11 | 12 | namespace Antmicro.Renode.Peripherals.USBDeprecated 13 | { 14 | public interface IUSBHubBase : IPeripheralRegister, IPeripheralContainer 15 | { 16 | event Action Connected ; 17 | 18 | event Action Disconnected ; 19 | 20 | event Action RegisterHub ; 21 | 22 | event Action ActiveDevice ; 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/PULP_EventController.cs: -------------------------------------------------------------------------------- 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 | namespace Antmicro.Renode.Peripherals.IRQControllers 8 | { 9 | public class PULP_EventController : IIRQController 10 | { 11 | public PULP_EventController(PULP_InterruptController parent) 12 | { 13 | this.parent = parent; 14 | } 15 | 16 | public void OnGPIO(int number, bool value) 17 | { 18 | parent.OnEvent(number, value); 19 | } 20 | 21 | public void Reset() 22 | { 23 | // intentionally left blank 24 | } 25 | 26 | private readonly PULP_InterruptController parent; 27 | } 28 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Commands/VersionCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Core; 9 | 10 | using AntShell.Commands; 11 | 12 | namespace Antmicro.Renode.UserInterface.Commands 13 | { 14 | public class VersionCommand : AutoLoadCommand 15 | { 16 | public VersionCommand(Monitor monitor) : base(monitor, "version", "shows version information.") 17 | { 18 | } 19 | 20 | [Runnable] 21 | public void Run(ICommandInteraction writer) 22 | { 23 | writer.WriteLine(EmulationManager.Instance.VersionString); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/MACRepository.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core.Structure 9 | { 10 | public class MACRepository 11 | { 12 | public MACAddress GenerateUniqueMAC() 13 | { 14 | lock(currentMAClock) 15 | { 16 | var result = currentMAC; 17 | currentMAC = currentMAC.Next(); 18 | return result; 19 | } 20 | } 21 | 22 | private MACAddress currentMAC = MACAddress.Parse("00:00:00:00:00:02"); 23 | private readonly object currentMAClock = new object(); 24 | } 25 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/Silencer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Peripherals.Bus 10 | { 11 | [AllowedTranslations(AllowedTranslation.ByteToDoubleWord | AllowedTranslation.WordToDoubleWord | AllowedTranslation.QuadWordToDoubleWord)] 12 | public class Silencer : IDoubleWordPeripheral 13 | { 14 | public uint ReadDoubleWord(long offset) 15 | { 16 | return 0; 17 | } 18 | 19 | public void WriteDoubleWord(long offset, uint value) 20 | { 21 | } 22 | 23 | public void Reset() 24 | { 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/GDB/GDBFeatureDescriptor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System.Collections.Generic; 8 | 9 | namespace Antmicro.Renode.Peripherals.CPU 10 | { 11 | public struct GDBFeatureDescriptor 12 | { 13 | public GDBFeatureDescriptor(string name) : this() 14 | { 15 | this.Name = name; 16 | this.Registers = new List(); 17 | this.Types = new List(); 18 | } 19 | 20 | public string Name { get; } 21 | 22 | public List Registers { get; } 23 | 24 | public List Types { get; } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/Utilities/GDB/Commands/ThreadAttachedCommand.cs: -------------------------------------------------------------------------------- 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 | using Antmicro.Renode.Utilities.GDB; 8 | 9 | namespace Antmicro.Renode.Extensions.Utilities.GDB.Commands 10 | { 11 | public class ThreadAttachedCommand : Command, IMultithreadCommand 12 | { 13 | public ThreadAttachedCommand(CommandsManager manager) : base(manager) 14 | { 15 | } 16 | 17 | [Execute("qAttached")] 18 | public PacketData Execute() 19 | { 20 | // return information to gdb that it has successfully attached to an existing process 21 | return new PacketData("1"); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/GPIOConnection.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core 9 | { 10 | public sealed class GPIOConnection 11 | { 12 | public GPIOConnection(int sourceNumber, GPIOEndpoint endpoint) 13 | { 14 | this.SourceNumber = sourceNumber; 15 | this.GPIOEndpoint = endpoint; 16 | } 17 | 18 | public int SourceNumber 19 | { 20 | get; 21 | private set; 22 | } 23 | 24 | public GPIOEndpoint GPIOEndpoint 25 | { 26 | get; 27 | private set; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/Arm64/ARMv8RRegisters.tt: -------------------------------------------------------------------------------- 1 | <# 2 | // 3 | // Copyright (c) 2010-2025 Antmicro 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | #> 9 | <#@ template language="C#" #> 10 | <#@ include file="../Common/RegisterTemplateDefinitions.tt" #> 11 | <# 12 | CLASS_NAME = "ARMv8R"; 13 | HEADER_FILE = "Emulator/Cores/tlib/arch/arm64/cpu_registers.h"; 14 | FALLBACK_SET_REGISTER = "TrySetNonMappedRegister"; 15 | FALLBACK_GET_REGISTER = "TryGetNonMappedRegister"; 16 | FALLBACK_REGISTERS = "GetNonMappedRegisters"; 17 | 18 | GENERAL_REGISTERS.AddRange(new[] { "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15" }); 19 | #> 20 | <#@ include file="../Common/RegisterTemplate.tt" #> 21 | -------------------------------------------------------------------------------- /src/Emulator/Cores/X86/ACPI/ProcessorLocalAPICRecord.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 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.Packets; 9 | 10 | namespace Antmicro.Renode.Core.ACPI 11 | { 12 | // Processor Local APIC Record - record of Multiple APIC Description Table 13 | [LeastSignificantByteFirst] 14 | public struct ProcessorLocalAPICRecord 15 | { 16 | [PacketField] 17 | public byte EntryType; 18 | [PacketField] 19 | public byte RecordLength; 20 | [PacketField] 21 | public byte ACPIProcessorID; 22 | [PacketField] 23 | public byte APICID; 24 | [PacketField] 25 | public uint Flags; 26 | } 27 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/PathToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class PathToken : StringToken 11 | { 12 | public PathToken(string value) : base(value) 13 | { 14 | Value = value.TrimStart('@').Replace(@"\ ", " "); 15 | } 16 | 17 | public override object GetObjectValue() 18 | { 19 | return Value; 20 | } 21 | 22 | public override string ToString() 23 | { 24 | return string.Format("[PathToken: Value={0}]", Value); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Utilities/Collections/LazyList.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | 11 | namespace Antmicro.Renode.Utilities.Collections 12 | { 13 | public sealed class LazyList 14 | { 15 | public LazyList() 16 | { 17 | funcs = new List>(); 18 | } 19 | 20 | public void Add(Func func) 21 | { 22 | funcs.Add(func); 23 | } 24 | 25 | public List ToList() 26 | { 27 | return funcs.Select(x => x()).ToList(); 28 | } 29 | 30 | private readonly List> funcs; 31 | } 32 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/RiscV/opcodes/opcodes-rvv-pseudo: -------------------------------------------------------------------------------- 1 | # vmv1r.v, vmv2r.v, vmv4r.v, vmv8r.v 2 | @vmvnfr.v 31..26=0x27 25=1 vs2 simm5 14..12=0x3 vd 6..0=0x57 3 | 4 | @vl1r.v 31..26=0 25=1 24..20=0x08 rs1 14..12=0x0 vd 6..0=0x07 5 | @vl2r.v 31..26=1 25=1 24..20=0x08 rs1 14..12=0x5 vd 6..0=0x07 6 | @vl4r.v 31..26=3 25=1 24..20=0x08 rs1 14..12=0x6 vd 6..0=0x07 7 | @vl8r.v 31..26=7 25=1 24..20=0x08 rs1 14..12=0x7 vd 6..0=0x07 8 | 9 | @vle1.v 31..28=0 27..26=0 25=1 24..20=0xb rs1 14..12=0x0 vd 6..0=0x07 10 | @vse1.v 31..28=0 27..26=0 25=1 24..20=0xb rs1 14..12=0x0 vs3 6..0=0x27 11 | 12 | @vfredsum.vs 31..26=0x01 vm vs2 vs1 14..12=0x1 vd 6..0=0x57 13 | @vfwredsum.vs 31..26=0x31 vm vs2 vs1 14..12=0x1 vd 6..0=0x57 14 | 15 | @vpopc.m 31..26=0x10 vm vs2 19..15=0x10 14..12=0x2 rd 6..0=0x57 16 | -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/Registers/IPacketRegisterField.cs: -------------------------------------------------------------------------------- 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 | using Antmicro.Renode.Utilities.Packets; 8 | 9 | namespace Antmicro.Renode.Core.Structure.Registers 10 | { 11 | /// 12 | /// Register field that provides a value of type T, where T is a struct. 13 | /// The maximum bit width of T is 64 bits. 14 | /// The field must not be larger than the packet's width, but it can be smaller. 15 | /// In this case, the remaining bits at the end of the packet will be zero-filled. 16 | /// 17 | public interface IPacketRegisterField : IRegisterField where T : struct 18 | { 19 | } 20 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/ISignalsUnit.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.CPU 8 | { 9 | public interface ISignalsUnit 10 | { 11 | ulong GetAddress(string name); 12 | 13 | ulong GetSignal(string name); 14 | 15 | bool IsSignalEnabled(string name); 16 | 17 | bool IsSignalEnabledForCPU(string name, ICPU cpu); 18 | 19 | void SetSignal(string name, ulong value); 20 | 21 | void SetSignalFromAddress(string name, ulong address); 22 | 23 | void SetSignalState(string name, bool state, uint index); 24 | 25 | void SetSignalStateForCPU(string name, bool state, ICPU cpu); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/CPU/HaltArguments.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | namespace Antmicro.Renode.Peripherals.CPU 8 | { 9 | public class HaltArguments 10 | { 11 | public HaltArguments(HaltReason reason, ICPU cpu, ulong? address = null, BreakpointType? breakpointType = null) 12 | { 13 | Reason = reason; 14 | Cpu = cpu; 15 | Address = address; 16 | BreakpointType = breakpointType; 17 | } 18 | 19 | public HaltReason Reason { get; } 20 | 21 | public ICPU Cpu { get; } 22 | 23 | public ulong? Address { get; } 24 | 25 | public BreakpointType? BreakpointType { get; } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/IRegistered.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | using Antmicro.Renode.Peripherals; 10 | 11 | namespace Antmicro.Renode.Core.Structure 12 | { 13 | /// 14 | /// Interface representing registered device. It is covariant because registered specialised device is 15 | /// registered device. 16 | /// 17 | public interface IRegistered 18 | where TPeripheral : IPeripheral where TRegistrationPoint : IRegistrationPoint 19 | { 20 | TPeripheral Peripheral { get; } 21 | 22 | TRegistrationPoint RegistrationPoint { get; } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/IRQControllers/EXTI.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Core; 9 | using Antmicro.Renode.Logging; 10 | 11 | namespace Antmicro.Renode.Peripherals.IRQControllers 12 | { 13 | public class EXTI : STM32F4_EXTI 14 | { 15 | public EXTI(IMachine machine, int numberOfOutputLines = 14, int firstDirectLine = STM32F4_EXTI.DefaultFirstDirectLine) 16 | : base(machine, numberOfOutputLines, firstDirectLine) 17 | { 18 | this.Log(LogLevel.Warning, "Peripheral '{0}' is deprecated. '{1}' should be used instead", nameof(EXTI), nameof(STM32F4_EXTI)); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/DefaultInterruptAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System; 8 | 9 | namespace Antmicro.Renode.Peripherals 10 | { 11 | /// 12 | /// This attribute indicates that an interrupt source (GPIO) 13 | /// can be used in REPL without name when connecting to an interrupt destination 14 | /// even if there are several interrupt sources within the peripheral. 15 | /// 16 | /// 17 | /// Only one GPIO property within a peripheral should be marked with this attribute. 18 | /// 19 | [AttributeUsage(AttributeTargets.Property)] 20 | public class DefaultInterruptAttribute : Attribute 21 | { 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/LiteralToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class LiteralToken : Token 11 | { 12 | public LiteralToken(string value) : base(value) 13 | { 14 | Value = value; 15 | } 16 | 17 | public override object GetObjectValue() 18 | { 19 | return Value; 20 | } 21 | 22 | public override string ToString() 23 | { 24 | return string.Format("[Literal: Value={0}]", Value); 25 | } 26 | 27 | public string Value { get; private set; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/CommandSplit.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class CommandSplit : Token 11 | { 12 | public CommandSplit(string value) : base(value) 13 | { 14 | Value = value; 15 | } 16 | 17 | public override object GetObjectValue() 18 | { 19 | return Value; 20 | } 21 | 22 | public override string ToString() 23 | { 24 | return string.Format("[EndOfCommand: Value={0}]", Value); 25 | } 26 | 27 | public string Value { get; private set; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/EqualityToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class EqualityToken : Token 11 | { 12 | public EqualityToken(string value) : base(value) 13 | { 14 | Value = value; 15 | } 16 | 17 | public override object GetObjectValue() 18 | { 19 | return Value; 20 | } 21 | 22 | public override string ToString() 23 | { 24 | return string.Format("[EqualToken: Value={0}]", Value); 25 | } 26 | 27 | public string Value { get; private set; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/IBusRegistration.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2024 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.Peripherals; 9 | using Antmicro.Renode.Peripherals.CPU; 10 | 11 | namespace Antmicro.Renode.Core.Structure 12 | { 13 | /// 14 | /// Interface to mark a registration with an address on the bus 15 | /// (as opposed to a numbered or null registration). 16 | /// 17 | public interface IBusRegistration : IRegistrationPoint 18 | { 19 | IPeripheral Initiator { get; } 20 | 21 | StateMask? StateMask { get; } 22 | 23 | ICluster Cluster { get; } 24 | 25 | ulong Offset { get; } 26 | 27 | ulong StartingPoint { get; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Miscellaneous/SiLabs/EFR32xG2_DCDC_2.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2025 Antmicro 3 | // Copyright (c) 2022-2025 Silicon Labs 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Peripherals.Miscellaneous.SiLabs 10 | { 11 | public partial class EFR32xG2_DCDC_2 12 | { 13 | partial void Status_Bypsw_ValueProvider(bool a) 14 | { 15 | // Enable BYPASS switch. 16 | status_bypsw_bit.Value = isEnabled; 17 | } 18 | 19 | partial void If_Regulation_ValueProvider(bool a) 20 | { 21 | // Complete DCDC startup 22 | if_regulation_bit.Value = isEnabled; 23 | } 24 | 25 | private readonly bool isEnabled = true; 26 | } 27 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/X86/X86_64Registers.tt: -------------------------------------------------------------------------------- 1 | <# 2 | // 3 | // Copyright (c) 2010-2024 Antmicro 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | #> 9 | <#@ template language="C#" #> 10 | <#@ include file="../Common/RegisterTemplateDefinitions.tt" #> 11 | <# 12 | CLASS_NAME = "X86_64"; 13 | HEADER_FILE = "Emulator/Cores/tlib/arch/i386/cpu_registers.h"; 14 | 15 | DEFINES.Add("TARGET_X86_64"); 16 | 17 | PC_REGISTER = "RIP"; 18 | 19 | GENERAL_REGISTERS.AddRange(new[] { "RAX", "RBX", "RCX", "RDX", "RSI", "RDI", "RBP", "RSP", 20 | "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15", "RIP", "EFLAGS", 21 | "CS", "SS", "DS", "ES", "FS", "GS", "ST0", "ST1", "ST2", "ST3", "ST4", "ST5", "ST6", "ST7" }); 22 | #> 23 | <#@ include file="../Common/RegisterTemplate.tt" #> 24 | -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Commands/PauseCommand.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using Antmicro.Renode.Core; 9 | 10 | using AntShell.Commands; 11 | 12 | namespace Antmicro.Renode.UserInterface.Commands 13 | { 14 | public class PauseCommand : AutoLoadCommand 15 | { 16 | public PauseCommand(Monitor monitor) : base(monitor, "pause", "pauses the emulation.", "p") 17 | { 18 | } 19 | 20 | [Runnable] 21 | public void Halt(ICommandInteraction writer) 22 | { 23 | writer.WriteLine("Pausing emulation..."); 24 | EmulationManager.Instance.CurrentEmulation.PauseAll(); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/IHasChildren.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System.Collections.Generic; 9 | 10 | namespace Antmicro.Renode.Core.Structure 11 | { 12 | public interface IHasChildren 13 | { 14 | IEnumerable GetNames(); 15 | 16 | T TryGetByName(string name, out bool success); 17 | } 18 | 19 | public static class IHasChildrenHelper 20 | { 21 | public static bool TryGetByName(this IHasChildren @this, string name, out T child) 22 | { 23 | bool success; 24 | child = @this.TryGetByName(name, out success); 25 | return success; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/Wrappers/HookWrapper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | using Range = Antmicro.Renode.Core.Range; 11 | 12 | namespace Antmicro.Renode.Peripherals.Bus.Wrappers 13 | { 14 | public abstract class HookWrapper 15 | { 16 | protected HookWrapper(IBusPeripheral peripheral, Type type, Range? subrange) 17 | { 18 | Peripheral = peripheral; 19 | Name = type.Name; 20 | Subrange = subrange; 21 | } 22 | 23 | protected readonly string Name; 24 | protected readonly IBusPeripheral Peripheral; 25 | protected readonly Range? Subrange; 26 | } 27 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/KVM/X86/X86KVMRegisters.tt: -------------------------------------------------------------------------------- 1 | <# 2 | // 3 | // Copyright (c) 2010-2025 Antmicro 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | #> 9 | <#@ template language="C#" #> 10 | <#@ include file="../../Common/RegisterTemplateDefinitions.tt" #> 11 | <# 12 | CLASS_NAME = "X86KVM"; 13 | HEADER_FILE = "Emulator/Cores/virt/include/cpu_registers.h"; 14 | ACCESSOR_PREFIX = "kvm_"; 15 | 16 | DEFINES.Add("TARGET_X86KVM"); 17 | 18 | PC_REGISTER = "EIP"; 19 | 20 | GENERAL_REGISTERS.AddRange(new[] { "EAX", "ECX", "EDX", "EBX", "ESP", "EBP", "ESI", "EDI", "EIP", "EFLAGS", "CS", "SS", "DS", "ES", "FS", "GS", "ST0", "ST1", "ST2", "ST3", "ST4", "ST5", "ST6", "ST7", "CR0", "CR1", "CR2", "CR3", "CR4" }); 21 | #> 22 | <#@ include file="../../Common/RegisterTemplate.tt" #> 23 | -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/CommentToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class CommentToken : Token 11 | { 12 | public CommentToken(string value) : base(value) 13 | { 14 | Value = value.TrimStart('#'); 15 | } 16 | 17 | public override object GetObjectValue() 18 | { 19 | return Value; 20 | } 21 | 22 | public override string ToString() 23 | { 24 | return string.Format("[CommentToken: Value={0}]", Value); 25 | } 26 | 27 | public string Value { get; private set; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/VariableToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.UserInterface.Tokenizer 9 | { 10 | public class VariableToken : Token 11 | { 12 | public VariableToken(string value) : base(value) 13 | { 14 | Value = value.TrimStart('$'); 15 | } 16 | 17 | public override object GetObjectValue() 18 | { 19 | return Value; 20 | } 21 | 22 | public override string ToString() 23 | { 24 | return string.Format("[VariableToken: Value={0}]", Value); 25 | } 26 | 27 | public string Value { get; private set; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/FloatToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | using System.Globalization; 8 | 9 | namespace Antmicro.Renode.UserInterface.Tokenizer 10 | { 11 | public class FloatToken : Token 12 | { 13 | public FloatToken(string value) : base(value) 14 | { 15 | Value = float.Parse(value, CultureInfo.InvariantCulture); 16 | } 17 | 18 | public override object GetObjectValue() 19 | { 20 | return Value; 21 | } 22 | 23 | public override string ToString() 24 | { 25 | return string.Format("[FloatToken: Value={0}]", Value); 26 | } 27 | 28 | public float Value { get; private set; } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/IdentifiableObject.cs: -------------------------------------------------------------------------------- 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 | using System.Threading; 8 | 9 | namespace Antmicro.Renode.Core 10 | { 11 | public class IdentifiableObject : IIdentifiable 12 | { 13 | public IdentifiableObject() 14 | { 15 | uniqueObjectId = Interlocked.Increment(ref IdCounter); 16 | } 17 | 18 | public override string ToString() 19 | { 20 | return $"[IdentifiableObject: {uniqueObjectId}]"; 21 | } 22 | 23 | public int UniqueObjectId 24 | { 25 | get { return uniqueObjectId; } 26 | } 27 | 28 | private static int IdCounter = 0; 29 | 30 | private readonly int uniqueObjectId; 31 | } 32 | } -------------------------------------------------------------------------------- /src/Emulator/Cores/X86/ACPI/DifferentiatedSystemDescriptionTable.cs: -------------------------------------------------------------------------------- 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 System.Text; 9 | 10 | using Antmicro.Renode.Utilities.Packets; 11 | 12 | namespace Antmicro.Renode.Core.ACPI 13 | { 14 | [LeastSignificantByteFirst] 15 | public struct DifferentiatedSystemDescriptionTable 16 | { 17 | public DifferentiatedSystemDescriptionTable(uint tableLength) 18 | { 19 | Header = new SystemDescriptionTableHeader 20 | { 21 | Signature = Encoding.ASCII.GetBytes("DSDT"), 22 | TableLength = tableLength 23 | }; 24 | } 25 | 26 | [PacketField] 27 | public SystemDescriptionTableHeader Header; 28 | } 29 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Commands/CommandAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | using System.Collections.Generic; 10 | 11 | namespace Antmicro.Renode.UserInterface.Commands 12 | { 13 | [AttributeUsage(AttributeTargets.Method)] 14 | public class RunnableAttribute : Attribute 15 | { 16 | } 17 | 18 | [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)] 19 | public class ValuesAttribute : Attribute 20 | { 21 | public ValuesAttribute(params object[] values) 22 | { 23 | Values = new List(values); 24 | } 25 | 26 | public IEnumerable Values { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Platform.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | 9 | namespace Antmicro.Renode.Core 10 | { 11 | public class Platform 12 | { 13 | public Platform() 14 | { 15 | HasMemory = true; 16 | } 17 | 18 | public override string ToString() 19 | { 20 | return Name; 21 | } 22 | 23 | public string Name { get; set; } 24 | 25 | public string ScriptPath { get; set; } 26 | 27 | public bool HasFlash { get; set; } 28 | 29 | public bool HasPendrive { get; set; } 30 | 31 | public bool HasMemory { get; set; } 32 | 33 | public string IconResource { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Emulator/Peripherals/Peripherals/Miscellaneous/OpenTitan_MultiBitBool.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // 4 | // This file is licensed under the MIT License. 5 | // Full license text is available in 'licenses/MIT.txt'. 6 | // 7 | 8 | namespace Antmicro.Renode.Peripherals.Miscellaneous 9 | { 10 | // All below values come from https://github.com/lowRISC/opentitan/blob/master/sw/device/lib/base/multibits.h 11 | public enum MultiBitBool4 12 | { 13 | True = 0x6, 14 | False = 0x9, 15 | } 16 | 17 | public enum MultiBitBool8 18 | { 19 | True = 0x96, 20 | False = 0x69, 21 | } 22 | 23 | public enum MultiBitBool12 24 | { 25 | True = 0x696, 26 | False = 0x969, 27 | } 28 | 29 | public enum MultiBitBool16 30 | { 31 | True = 0x9696, 32 | False = 0x6969, 33 | } 34 | } -------------------------------------------------------------------------------- /src/Emulator/Extensions/UserInterface/Tokenizer/BooleanToken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.UserInterface.Tokenizer 11 | { 12 | public class BooleanToken : Token 13 | { 14 | public BooleanToken(string value) : base(value) 15 | { 16 | Value = Boolean.Parse(value); 17 | } 18 | 19 | public override object GetObjectValue() 20 | { 21 | return Value; 22 | } 23 | 24 | public override string ToString() 25 | { 26 | return string.Format("[BooleanToken: Value={0}]", Value); 27 | } 28 | 29 | public bool Value { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Core/Structure/IRegistrationPoint.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2023 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | namespace Antmicro.Renode.Core.Structure 9 | { 10 | /// 11 | /// Point under which a peripheral can be registered. 12 | /// 13 | /// Not every registration point type can be used for addressing the peripheral. 14 | /// Some peripherals allow registering via more than one type of registration point, 15 | /// which interally get converted to a type used for addressing and retrieval of registered 16 | /// peripherals. 17 | /// 18 | /// 19 | public interface IRegistrationPoint 20 | { 21 | string PrettyString { get; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Exceptions/RecoverableException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2018 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Exceptions 11 | { 12 | public class RecoverableException : Exception 13 | { 14 | public RecoverableException(Exception innerException) : base(String.Empty, innerException) 15 | { 16 | } 17 | 18 | public RecoverableException(string message, Exception innerException) : base(message, innerException) 19 | { 20 | } 21 | 22 | public RecoverableException(string message) : base(message) 23 | { 24 | } 25 | 26 | public RecoverableException() : base() 27 | { 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Emulator/Main/Peripherals/Bus/AllowedTranslation.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2022 Antmicro 3 | // Copyright (c) 2011-2015 Realtime Embedded 4 | // 5 | // This file is licensed under the MIT License. 6 | // Full license text is available in 'licenses/MIT.txt'. 7 | // 8 | using System; 9 | 10 | namespace Antmicro.Renode.Peripherals.Bus 11 | { 12 | [Flags] 13 | public enum AllowedTranslation 14 | { 15 | ByteToWord = 1 << 0, 16 | ByteToDoubleWord = 1 << 1, 17 | ByteToQuadWord = 1 << 2, 18 | WordToByte = 1 << 3, 19 | WordToDoubleWord = 1 << 4, 20 | WordToQuadWord = 1 << 5, 21 | DoubleWordToByte = 1 << 6, 22 | DoubleWordToWord = 1 << 7, 23 | DoubleWordToQuadWord = 1 << 8, 24 | QuadWordToByte = 1 << 9, 25 | QuadWordToWord = 1 << 10, 26 | QuadWordToDoubleWord = 1 << 11, 27 | } 28 | } --------------------------------------------------------------------------------