|
1 | 1 | import mpy_coverage |
2 | 2 |
|
3 | 3 | mpy_coverage.run_one_arch("rv32imc", "rv32") |
| 4 | + |
| 5 | +print("Expected to compile") |
| 6 | +mpy_coverage.run_extra_cases( |
| 7 | + "rv32imc", |
| 8 | + [ |
| 9 | + "@micropython.asm_rv32\ndef f(): ebreak()", |
| 10 | + ], |
| 11 | +) |
| 12 | + |
| 13 | +# Test "argument out of range" specifically for label targets |
| 14 | +nl = "\n" |
| 15 | +beqz_test = f""" |
| 16 | +@micropython.asm_rv32 |
| 17 | +def f(): |
| 18 | + c_beqz(a0, l) |
| 19 | +{nl.join(" ecall()" for _ in range(64))} |
| 20 | + label(l) |
| 21 | + """ |
| 22 | + |
| 23 | +print("Expected to fail") |
| 24 | +mpy_coverage.run_extra_cases( |
| 25 | + "rv32imc", |
| 26 | + [ |
| 27 | + "@micropython.asm_rv32\ndef f(a0, a1, a2, a3, a4): ac_li(a0, 1)", |
| 28 | + "@micropython.asm_rv32\ndef f(a0, a4): ac_li(a0, 1)", |
| 29 | + "@micropython.asm_rv32\ndef f(a0): csrrc()", |
| 30 | + "@micropython.asm_rv32\ndef f(a0): csrrc(s0, s0, s0)", |
| 31 | + "@micropython.asm_rv32\ndef f(a0): csrrc(s0, s0, 0xffffff)", |
| 32 | + "@micropython.asm_rv32\ndef f(a0): csrrc(s0, 0, s0)", |
| 33 | + "@micropython.asm_rv32\ndef f(a0): moo()", |
| 34 | + "@micropython.asm_rv32\ndef f(a0): beq(a0,a0,0)", |
| 35 | + "@micropython.asm_rv32\ndef f(a0): beq(a0,a0,3.14)", |
| 36 | + "@micropython.asm_rv32\ndef f(a0): beq(a0,a0,y)", |
| 37 | + "@micropython.asm_rv32\ndef f(): lw(a3, 99999(a3))", |
| 38 | + "@micropython.asm_rv32\ndef f(): lw(a3, -99999(a3))", |
| 39 | + "@micropython.asm_rv32\ndef f(): lw(a3, +99999(a3))", |
| 40 | + "@micropython.asm_rv32\ndef f(): lw(a3, (a3))", |
| 41 | + "@micropython.asm_rv32\ndef f(): lw()", |
| 42 | + "@micropython.asm_rv32\ndef f(): a=di(a2, a2, -1)", |
| 43 | + "@micropython.asm_rv32\ndef f(ax): beq(ax, ax, 1)", |
| 44 | + "@micropython.asm_rv32\ndef f(): c_lui(zero, 0)", |
| 45 | + "@micropython.asm_rv32\ndef f(): c_lui(a0, 0)", |
| 46 | + "@micropython.asm_rv32\ndef f(): csrrci(a0, 63, 63)", |
| 47 | + beqz_test, |
| 48 | + ], |
| 49 | +) |
0 commit comments