1*** Variables ***
2${UART}                       sysbus.uart
3${URI}                        @https://dl.antmicro.com/projects/renode
4${PROMPT}                     litex>${SPACE}
5
6*** Keywords ***
7Create Machine
8    [Arguments]  ${bin}
9
10    Execute Command          mach create
11    Execute Command          machine LoadPlatformDescription @platforms/boards/crosslink-nx-evn.repl
12
13    Execute Command          sysbus LoadBinary ${URI}/${bin} 0x0
14    Execute Command          sysbus.cpu PC 0x0
15
16Assert Led
17    [Arguments]  ${id}  ${expected_state}
18
19    ${actual_state}=  Execute Command  sysbus.leds.led${id} State
20    Should Be Equal   ${expected_state}  ${actual_state.rstrip()}
21
22*** Test Cases ***
23Should Run LiteX BIOS
24    Create Machine           crosslink-nx-evn_litex_bios.bin-s_22272-5c9b575eac0a1b12e62860c0c8904dd4d7181279
25    Create Terminal Tester   ${UART}
26
27    Start Emulation
28
29    Wait For Line On Uart    BIOS CRC passed
30    Wait For Line On Uart    CPU:\\s+VexRiscv                  treatAsRegex=true
31    Wait For Line On Uart    === Boot ===
32    Wait For Line On Uart    === Console ===
33
34    Wait For Prompt On Uart  ${PROMPT}
35
36    Write Line To Uart       help
37
38    Wait For Line On Uart    LiteX BIOS, available commands
39
40    Wait For Prompt On Uart  ${PROMPT}
41
42    Assert Led               0  False
43
44    Write Line To Uart       leds 0x1
45    Wait For Prompt On Uart  ${PROMPT}
46
47    Assert Led               0  True
48
49