1*** Variables *** 2${UART} sysbus.cpu.uartSemihosting 3 4*** Keywords *** 5Create Machine 6 Execute Command using sysbus 7 Execute Command mach create 8 Execute Command machine LoadPlatformDescription @platforms/cpus/xtensa-sample-controller.repl 9 10Load Opcodes To Memory 11 # MOVI at0, 0x400 12 Execute Command sysbus WriteDoubleWord 0x00 0x0000A402 13 # L32I at1, at0, 0x0 14 Execute Command sysbus WriteDoubleWord 0x03 0x00002012 15 # L32I at2, at0, 0x1 (load from at0 + 4) 16 Execute Command sysbus WriteDoubleWord 0x06 0x00012022 17 # BEQZ at2, 0x12 18 Execute Command sysbus WriteDoubleWord 0x09 0x00005216 19 # QUOU at3, at1, at2 (integer division) 20 Execute Command sysbus WriteDoubleWord 0x0c 0x00C23120 21 # J 0x15 22 Execute Command sysbus WriteDoubleWord 0x0f 0x00000086 23 # MOVI at3, 0x0 24 Execute Command sysbus WriteDoubleWord 0x12 0x0000A032 25 # J 0x15 26 Execute Command sysbus WriteDoubleWord 0x15 0xFFFFFF06 27 28*** Test Cases *** 29Test Division 30 ${NUMERATOR}= Set Variable 0x10 31 ${DENOMINATOR}= Set Variable 0x02 32 ${EXPECTED_RES}= Evaluate str(0 if ${DENOMINATOR} == 0 else ${NUMERATOR} // ${DENOMINATOR}) 33 34 Create Machine 35 Execute Command machine LoadPlatformDescriptionFromString 'opmem: Memory.MappedMemory @ sysbus 0x0 { size: 0x30000 }' 36 Execute Command cpu PC 0x0 37 Load Opcodes To Memory 38 39 # Load operands of the operation 40 # in this example it will calculate: 41 # 0x10 / 0x02 42 Execute Command sysbus WriteDoubleWord 0x400 ${NUMERATOR} 43 Execute Command sysbus WriteDoubleWord 0x404 ${DENOMINATOR} 44 45 Execute Command cpu Step 46 PC Should Be Equal 0x3 47 Register Should Be Equal 1 0x400 48 49 Execute Command cpu Step 50 PC Should Be Equal 0x6 51 Register Should Be Equal 2 ${NUMERATOR} 52 53 Execute Command cpu Step 54 PC Should Be Equal 0x9 55 Register Should Be Equal 3 ${DENOMINATOR} 56 57 Execute Command cpu Step 3 58 59 PC Should Be Equal 0x15 60 Register Should Be Equal 4 ${EXPECTED_RES} 61 62 63Test Zephyr hello_world sample 64 Create Machine 65 Execute Command sysbus LoadELF @https://dl.antmicro.com/projects/renode/xtensa-sample-controller-zephyr-hello-world.elf-s_293544-4be60f8a3891e70c30e1e8a471df4ad12ab08144 66 Execute Command cpu PC 0x50000000 67 68 Create Terminal Tester ${UART} 69 70 Start Emulation 71 72 Wait For Line On Uart Booting Zephyr OS 73 Wait For Line On Uart Hello World! qemu_xtensa 74