1*** Keywords *** 2Prepare Machine 3 Execute Command using sysbus 4 Execute Command mach create 5 Execute Command machine LoadPlatformDescriptionFromString "cpu: CPU.RiscV64 @ sysbus { cpuType: \\"rv64imacv_zicsr\\"; timeProvider: empty }" 6 Execute Command machine LoadPlatformDescriptionFromString "mapmem: Memory.MappedMemory @ sysbus 0x10000 { size: 0x1000 }" 7 # cashing works only on peripherals accessible via sysbus, hence we can't use MappedMemory 8 Execute Command machine LoadPlatformDescriptionFromString "arrmem: Memory.ArrayMemory @ sysbus 0x100000 { size: 0x1000 }" 9 10 Execute Command cpu PC 0x10000 11 Write Program 12 13Write Program 14 # lui a5,0x100 15 Execute Command sysbus WriteDoubleWord 0x10000 0x001007b7 16 17 # lw a0, 16(a5) 18 Execute Command sysbus WriteDoubleWord 0x10004 0x0107a503 19 20 # beqz x0,-4 21 Execute Command sysbus WriteDoubleWord 0x10008 0xfe000ee3 22 23*** Test Cases *** 24Cache Read Value 25 Prepare Machine 26 Execute Command cpu EnableReadCache 0x100010 2 4 27 Execute Command cpu Step 1 28 29 # check that register has a proper reset value 30 Register Should Be Equal 10 0x0 31 32 # first two reads should not be cached - we should observe the actual value 33 Execute Command sysbus WriteDoubleWord 0x100010 0x10 34 Execute Command cpu Step 2 35 Register Should Be Equal 10 0x10 36 37 Execute Command sysbus WriteDoubleWord 0x100010 0x11 38 Execute Command cpu Step 2 39 Register Should Be Equal 10 0x11 40 41 # the next 4 reads should be cached - we should observe the previous value 42 Execute Command sysbus WriteDoubleWord 0x100010 0x12 43 Execute Command cpu Step 2 44 Register Should Be Equal 10 0x11 45 46 Execute Command sysbus WriteDoubleWord 0x100010 0x13 47 Execute Command cpu Step 2 48 Register Should Be Equal 10 0x11 49 50 Execute Command sysbus WriteDoubleWord 0x100010 0x14 51 Execute Command cpu Step 2 52 Register Should Be Equal 10 0x11 53 54 Execute Command sysbus WriteDoubleWord 0x100010 0x15 55 Execute Command cpu Step 2 56 Register Should Be Equal 10 0x11 57 58 # now caching should be disabled for the next 2 reads 59 Execute Command sysbus WriteDoubleWord 0x100010 0x16 60 Execute Command cpu Step 2 61 Register Should Be Equal 10 0x16 62 63 Execute Command sysbus WriteDoubleWord 0x100010 0x17 64 Execute Command cpu Step 2 65 Register Should Be Equal 10 0x17 66 67 # and now the caching should be enabled again 68 Execute Command sysbus WriteDoubleWord 0x100010 0x18 69 Execute Command cpu Step 2 70 Register Should Be Equal 10 0x17 71 72 Execute Command sysbus WriteDoubleWord 0x100010 0x19 73 Execute Command cpu Step 2 74 Register Should Be Equal 10 0x17 75 76 Execute Command sysbus WriteDoubleWord 0x100010 0x1A 77 Execute Command cpu Step 2 78 Register Should Be Equal 10 0x17 79 80 Execute Command sysbus WriteDoubleWord 0x100010 0x1B 81 Execute Command cpu Step 2 82 Register Should Be Equal 10 0x17 83 84 # and again caching should be disabled 85 Execute Command sysbus WriteDoubleWord 0x100010 0x1C 86 Execute Command cpu Step 2 87 Register Should Be Equal 10 0x1C