1*** Keywords *** 2Prepare Machine 3 ${TEST_DIR}= Evaluate r"${CURDIR}".replace(" ", "\\ ") 4 Execute Command include @${TEST_DIR}/TestPeripheral.cs 5 6 Execute Command mach create 7 Execute Command machine LoadPlatformDescriptionFromString "cpu: CPU.ARMv7A @ sysbus { cpuType: \\"cortex-a9\\" }" 8 Execute Command machine LoadPlatformDescriptionFromString "mem: Memory.MappedMemory @ sysbus 0x0 { size: 0x1000 }" 9 Execute Command machine LoadPlatformDescriptionFromString "mock: Mocks.TestPeripheral @ sysbus 0x2000" 10 11 12Prepare Multicore Machine 13 ${TEST_DIR}= Evaluate r"${CURDIR}".replace(" ", "\\ ") 14 Execute Command include @${TEST_DIR}/TestPeripheral.cs 15 16 Execute Command mach create 17 Execute Command machine LoadPlatformDescriptionFromString "cpu0: CPU.ARMv7A @ sysbus { cpuType: \\"cortex-a9\\" }" 18 Execute Command machine LoadPlatformDescriptionFromString "cpu1: CPU.ARMv7A @ sysbus { cpuType: \\"cortex-a9\\" }" 19 Execute Command machine LoadPlatformDescriptionFromString "mem: Memory.MappedMemory @ sysbus 0x0 { size: 0x1000 }" 20 Execute Command machine LoadPlatformDescriptionFromString "mock: Mocks.TestPeripheral @ sysbus 0x2000" 21 22 23Scheduled Action Should Be Delayed By ${delay} Microseconds 24 ${x}= Wait For Log Entry Written value 0x0 to Reg0 25 ${c}= Get Regexp Matches ${x} \\.([0-9]+) 1 26 ${y}= Evaluate str(int(${c[0]}) + ${delay}).rjust(6, '0') 27 Wait For Log Entry Executing scheduled action for Reg0; current timestamp is 00:00:00.${y} 28 29Fill Memory 30 # prepare a block of code 31 # containing precisely 12 instructions 32 # consisting mostly of `nops` with 33 # a single `strb` inbetween 34 35 # 1: nop 36 Execute Command sysbus WriteDoubleWord 0x10 0xe320f000 37 # 2: nop 38 Execute Command sysbus WriteDoubleWord 0x14 0xe320f000 39 # 3: nop 40 Execute Command sysbus WriteDoubleWord 0x18 0xe320f000 41 # 4: nop 42 Execute Command sysbus WriteDoubleWord 0x1c 0xe320f000 43 # 5: nop 44 Execute Command sysbus WriteDoubleWord 0x20 0xe320f000 45 # 6: nop 46 Execute Command sysbus WriteDoubleWord 0x24 0xe320f000 47 # 7: nop 48 Execute Command sysbus WriteDoubleWord 0x28 0xe320f000 49 # 8: strb r0, [r1] 50 Execute Command sysbus WriteDoubleWord 0x2c 0xe5c10000 51 # 9: nop 52 Execute Command sysbus WriteDoubleWord 0x30 0xe320f000 53 # 10: nop 54 Execute Command sysbus WriteDoubleWord 0x34 0xe320f000 55 # 11: nop 56 Execute Command sysbus WriteDoubleWord 0x38 0xe320f000 57 # 12: nop 58 Execute Command sysbus WriteDoubleWord 0x3c 0xe320f000 59 # 13: j -4 60 Execute Command sysbus WriteDoubleWord 0x40 0xeafffffd 61 62 63*** Test Cases *** 64Should Delay Action 65 Prepare Machine 66 Execute Command sysbus.mock SetDelay 3 67 68 Create Log Tester 1 69 70 Execute Command sysbus.cpu PC 0x10 71 Execute Command sysbus.cpu SetRegister 1 0x2000 72 73 Fill Memory 74 Scheduled Action Should Be Delayed By 3 Microseconds 75 76 77Should Delay Action With Multiple Cores 78 Prepare Multicore Machine 79 Execute Command machine SetSerialExecution true 80 Execute Command sysbus.mock SetDelay 3 81 82 Create Log Tester 1 83 84 Execute Command sysbus.cpu0 PC 0x10 85 Execute Command sysbus.cpu0 SetRegister 1 0x2000 86 87 # just make the other CPU spin in a loop 88 Execute Command sysbus.cpu1 PC 0x3c 89 90 Fill Memory 91 Scheduled Action Should Be Delayed By 3 Microseconds 92 93 94Should Delay Action With Multiple Cores In Different Ordering 95 Prepare Multicore Machine 96 Execute Command machine SetSerialExecution true 97 Execute Command sysbus.mock SetDelay 3 98 99 Create Log Tester 1 100 101 Execute Command sysbus.cpu1 PC 0x10 102 Execute Command sysbus.cpu1 SetRegister 1 0x2000 103 104 # just make the other CPU spin in a loop 105 Execute Command sysbus.cpu0 PC 0x3c 106 107 Fill Memory 108 Scheduled Action Should Be Delayed By 3 Microseconds 109