1*** Variables ***
2${URI}                              @https://dl.antmicro.com/projects/renode
3${BIN}                              murax--demo.elf-s_26952-7635fc30d0a3ed10c5b7cba622131b02d103f629
4${UART}                             sysbus.uart
5
6// Binaries from https://github.com/antmicro/renode-verilator-integration, rev. f9b4139
7${APB3UART_SOCKET_LINUX}            ${URI}/Vapb3uart-Linux-x86_64-12904733885-s_1639760-a15bb0221a8ae95ecd8554f5a2c78e783bc3d806
8${APB3UART_SOCKET_WINDOWS}          ${URI}/Vapb3uart-Windows-x86_64-12904733885.exe-s_3250718-de16e82b644a368079af147cad0a7bc6a8dea82e
9${APB3UART_SOCKET_MACOS}            ${URI}/Vapb3uart-macOS-x86_64-12904733885-s_224032-16d279cf20b3e9e07039d29f000e954c567dd9c8
10${APB3UART_NATIVE_LINUX}            ${URI}/libVapb3uart-Linux-x86_64-12904733885.so-s_2093168-c89c855d6d5cd1b000ee1deb96446c5cbd87e73f
11${APB3UART_NATIVE_WINDOWS}          ${URI}/libVapb3uart-Windows-x86_64-12904733885.dll-s_3257110-2a81e95599ae0f234a620265b253976053675e9a
12${APB3UART_NATIVE_MACOS}            ${URI}/libVapb3uart-macOS-x86_64-12904733885.dylib-s_240416-847e4db9882610f2068465a7426c17e4a45f92f8
13
14${PLATFORM}=     SEPARATOR=
15...  """                                                                        ${\n}
16...  using "platforms/cpus/verilated/murax_vexriscv_verilated_uart.repl"        ${\n}
17...                                                                             ${\n}
18...  uart:                                                                      ${\n}
19...  ${SPACE*4}address: "127.0.0.1"                                             ${\n}
20...  """
21
22
23*** Keywords ***
24Create Machine
25    [Arguments]         ${apb3uart_linux}    ${apb3uart_windows}    ${apb3uart_macos}    ${repl}
26    Execute Command            using sysbus
27    Execute Command            mach create
28    Execute Command            machine LoadPlatformDescription ${repl}
29
30    Execute Command            sysbus LoadELF ${URI}/${BIN}
31    Execute Command            uart SimulationFilePathLinux ${apb3uart_linux}
32    Execute Command            uart SimulationFilePathWindows ${apb3uart_windows}
33    Execute Command            uart SimulationFilePathMacOS ${apb3uart_macos}
34
35    Machine Config
36
37Create Machine With Platform Description From String
38    [Arguments]         ${apb3uart_linux}    ${apb3uart_windows}    ${apb3uart_macos}    ${repl}
39    Execute Command            using sysbus
40    Execute Command            mach create
41    Execute Command            machine LoadPlatformDescriptionFromString ${repl}
42
43    Execute Command            sysbus LoadELF ${URI}/${BIN}
44    Execute Command            uart SimulationFilePathLinux ${apb3uart_linux}
45    Execute Command            uart SimulationFilePathWindows ${apb3uart_windows}
46    Execute Command            uart SimulationFilePathMacOS ${apb3uart_macos}
47
48    Machine Config
49
50Machine Config
51    Execute Command            sysbus.cpu MTVEC 0x80000020
52
53    # this is a hack to allow handling interrupts at all; this should be fixed after #13326
54    Execute Command            sysbus.cpu SetMachineIrqMask 0xffffffff
55
56    # set frame length in UART's FrameCongfig register (0xC)
57    Execute Command            sysbus WriteDoubleWord 0xF001000C 0x000F
58
59Handle UART Input
60    # After the initial 'A' char, value 255 is sent to UART which affects the input.
61    # First three chars are consumed by the 255, and then printed together, so if the input would be 'a', 'b' and 'c', then on the UART
62    # would appear "�abc". After that the UART is echoing any input normally.
63    Write Char On Uart         .
64    Write Char On Uart         .
65    Write Char On Uart         .
66
67    Write Char On Uart         A
68    Write Char On Uart         n
69    Write Char On Uart         t
70
71
72*** Test Cases ***
73Echo On Uart With Native Communication
74    [Tags]                     skip_osx  skip_host_arm
75    Create Machine             ${APB3UART_NATIVE_LINUX}  ${APB3UART_NATIVE_WINDOWS}  ${APB3UART_NATIVE_MACOS}  @platforms/cpus/verilated/murax_vexriscv_verilated_uart.repl
76    Create Terminal Tester     sysbus.uart
77    Execute Command            showAnalyzer sysbus.uart
78
79    Start Emulation
80
81    Handle UART Input
82
83    Wait For Prompt On Uart    Ant
84
85Echo On Uart With Socket Based Communication
86    [Tags]                     skip_osx  skip_host_arm
87    Create Machine With Platform Description From String  ${APB3UART_SOCKET_LINUX}  ${APB3UART_SOCKET_WINDOWS}  ${APB3UART_SOCKET_MACOS}  ${PLATFORM}
88    Create Terminal Tester     sysbus.uart
89    Execute Command            showAnalyzer sysbus.uart
90
91    Start Emulation
92
93    Handle UART Input
94
95    Wait For Prompt On Uart    Ant
96