1# Copyright (c) 2021 Antmicro
2# SPDX-License-Identifier: Apache-2.0
3
4*** Settings ***
5Suite Setup                   Run Keywords
6...                           Setup   AND
7...                           Execute Command           include @${CURDIR}/LiteX_I2C_Zephyr.cs
8Suite Teardown                Teardown
9Test Setup                    Reset Emulation
10Resource                      ${RENODEKEYWORDS}
11
12*** Keywords ***
13Wait For Ring
14    Wait For Line On Uart     RING:
15    # Passing whitespaces in arguments is a bit tricky.
16    # Here we wait for the following pattern:
17    #           *
18    #        *     *
19    #      *         *
20    #     *           *
21    #      *         *
22    #        *     *
23    #           *
24    Wait For Line On Uart     ${SPACE*10}*
25    Wait For Line On Uart     ${SPACE*7}*${SPACE*5}*
26    Wait For Line On Uart     ${SPACE*5}*${SPACE*9}*
27    Wait For Line On Uart     ${SPACE*4}*${SPACE*11}*
28    Wait For Line On Uart     ${SPACE*5}*${SPACE*9}*
29    Wait For Line On Uart     ${SPACE*7}*${SPACE*5}*
30    Wait For Line On Uart     ${SPACE*10}*
31
32Wait For Slope
33    Wait For Line On Uart     SLOPE:
34    # Passing whitespaces in arguments is a bit tricky.
35    # Here we wait for the following pattern:
36    #         *
37    #        *
38    #       *
39    #      *
40    #     *
41    #    *
42    #   *
43    #  * * * * * * * *
44    Wait For Line On Uart    ${SPACE*8}*
45    Wait For Line On Uart    ${SPACE*7}*
46    Wait For Line On Uart    ${SPACE*6}*
47    Wait For Line On Uart    ${SPACE*5}*
48    Wait For Line On Uart    ${SPACE*4}*
49    Wait For Line On Uart    ${SPACE*3}*
50    Wait For Line On Uart    ${SPACE*2}*
51    Wait For Line On Uart    ${SPACE}* * * * * * * *
52
53*** Test Cases ***
54Run Hello World Demo
55    Execute Command           using sysbus
56
57    Execute Command           mach create
58    Execute Command           machine LoadPlatformDescription @${CURDIR}/litex-vexriscv-tflite.repl
59
60    Execute Command           showAnalyzer uart Antmicro.Renode.Analyzers.LoggingUartAnalyzer
61
62    Execute Command           sysbus LoadELF @${CURDIR}/../tensorflow/tensorflow/lite/micro/tools/make/gen/zephyr_vexriscv_x86_64/hello_world/build/zephyr/zephyr.elf
63
64    Create Terminal Tester    sysbus.uart
65
66    Start Emulation
67
68    Wait For Line On Uart     Booting Zephyr OS
69    Wait For Line On Uart     x_value
70    Wait For Line On Uart     y_value
71
72Run Magic Wand Demo
73    Execute Command           using sysbus
74
75    Execute Command           mach create
76    Execute Command           machine LoadPlatformDescription @${CURDIR}/litex-vexriscv-tflite.repl
77
78    Execute Command           showAnalyzer uart Antmicro.Renode.Analyzers.LoggingUartAnalyzer
79
80    Execute Command           sysbus LoadELF @${CURDIR}/../tensorflow/tensorflow/lite/micro/tools/make/gen/zephyr_vexriscv_x86_64/magic_wand/build/zephyr/zephyr.elf
81
82    Execute Command           i2c.adxl345 MaxFifoDepth 1
83    Execute Command           i2c.adxl345 FeedSample @${CURDIR}/circle.data
84    Execute Command           i2c.adxl345 FeedSample 0 15000 15000 128
85    Execute Command           i2c.adxl345 FeedSample 0 0 0 128
86    Execute Command           i2c.adxl345 FeedSample @${CURDIR}/angle.data
87    Execute Command           i2c.adxl345 FeedSample 0 15000 15000 128
88    Execute Command           i2c.adxl345 FeedSample 0 0 0 128
89    Execute Command           i2c.adxl345 FeedSample @${CURDIR}/circle.data
90    Execute Command           i2c.adxl345 FeedSample 0 15000 15000 128
91    Execute Command           i2c.adxl345 FeedSample 0 0 0 128
92    Execute Command           i2c.adxl345 FeedSample @${CURDIR}/angle.data
93    Execute Command           i2c.adxl345 FeedSample 0 15000 15000 128
94    Execute Command           i2c.adxl345 FeedSample 0 0 0 128
95
96    Create Terminal Tester    sysbus.uart  timeout=480
97
98    Start Emulation
99
100    Wait For Line On Uart     Booting Zephyr OS
101    Wait For Line On Uart     Got accelerometer
102
103    Wait For Ring
104    Wait For Slope
105    Wait For Ring
106    Wait For Slope
107
108