mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-05 22:43:39 +00:00
Add BLT test
This commit is contained in:
parent
83276f98e4
commit
49a94ca174
3 changed files with 25 additions and 0 deletions
|
|
@ -7,6 +7,14 @@ void main(void) {
|
|||
asm("auipc t0, 0"); // copy pc into t0
|
||||
asm("auipc t1, 0"); // copy pc into t1
|
||||
break;
|
||||
case TEST2:
|
||||
asm("li t0, 2");
|
||||
asm("li t1, 1");
|
||||
label2:
|
||||
println("loop");
|
||||
asm goto("blt t0, t1, %l0" : : : : label2);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@
|
|||
|
||||
enum {
|
||||
TEST1,
|
||||
TEST2,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -59,4 +59,20 @@ void test_auipc(void) {
|
|||
TEST_ASSERT_EQUAL(vmst._core.regs[6], vmst._core.regs[5] + 4);
|
||||
}
|
||||
|
||||
void test_blt(void) {
|
||||
uvm32_run(&vmst, &evt, 100);
|
||||
// check for picktest syscall
|
||||
TEST_ASSERT_EQUAL(evt.typ, UVM32_EVT_SYSCALL);
|
||||
TEST_ASSERT_EQUAL(evt.data.syscall.code, SYSCALL_PICKTEST);
|
||||
uvm32_arg_setval(&vmst, &evt, RET, TEST2);
|
||||
|
||||
uvm32_run(&vmst, &evt, 100);
|
||||
TEST_ASSERT_EQUAL(evt.typ, UVM32_EVT_SYSCALL);
|
||||
TEST_ASSERT_EQUAL(evt.data.syscall.code, UVM32_SYSCALL_PRINTLN);
|
||||
|
||||
// run vm to completion
|
||||
uvm32_run(&vmst, &evt, 100);
|
||||
TEST_ASSERT_EQUAL(evt.typ, UVM32_EVT_END);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue