diff --git a/cv32e40s/tests/programs/custom/zc_test/zc_test.c b/cv32e40s/tests/programs/custom/zc_test/zc_test.c index 3bac064f27..34c751b673 100644 --- a/cv32e40s/tests/programs/custom/zc_test/zc_test.c +++ b/cv32e40s/tests/programs/custom/zc_test/zc_test.c @@ -111,6 +111,17 @@ void m_external_irq_handler(void) { } +static void +test_mva01s_same_register(void) +{ + printf("test_mva01s_same_register: start\n"); + __asm__ volatile( + "cm.mva01s s2, s2" + : : : "s2" + ); + printf("test_mva01s_same_register: done\n"); +} + int main(int argc, char *argv[]) { @@ -120,10 +131,15 @@ int main(int argc, char *argv[]) test_instr_num = 0; + // Setup + printf("Enabling irq. \n"); enable_all_irq(); + + // Test: PushPop + printf("\n\nTesting push/pop instructions. \n"); test_active = pushpop; @@ -138,11 +154,13 @@ int main(int argc, char *argv[]) interrupt_push_pop(i); } + + // Test: Popret + printf("\n\nTesting popret instructions. \n"); test_active = popret; test_instr_num = 0; - for (int i = PUSH_RLIST_MIN; i <= PUSH_RLIST_MAX; i++) { glb_irq_line = 0x1 << EX_IRQ_LINE; @@ -154,11 +172,13 @@ int main(int argc, char *argv[]) interrupt_popret(i); } + + // Test: Popretz + printf("\n\nTesting popretz instructions. \n"); test_active = popretz; test_instr_num = 0; - for (int i = PUSH_RLIST_MIN; i <= PUSH_RLIST_MAX; i++) { glb_irq_line = 0x1 << EX_IRQ_LINE; @@ -171,6 +191,8 @@ int main(int argc, char *argv[]) } + // Test: Mvsa01 + printf("\n\nTesting mvsa01 instructions. \n"); test_active = mvsa; test_instr_num = 0; @@ -191,12 +213,18 @@ int main(int argc, char *argv[]) i = iteratorVault; } + + // Test: Mva01s + printf("\n\nTesting mva01s instructions. \n"); + test_active = mvas; test_instr_num = 0; + //creating random values for the target registers rnd0 = vp_random_num(0xFFFFFFFE, 0x0); rnd1 = vp_random_num(0xFFFFFFFE, 0x0); + for (int i = 0; i < MVAS_INSTR_SIZE; i++) { glb_irq_line = 0x1 << EX_IRQ_LINE; @@ -212,6 +240,13 @@ int main(int argc, char *argv[]) } + // Test: Mva01s - Same Register (Sanity check of RTL bugfix.) + + test_mva01s_same_register(); + + + // ErrorCheck & Exit + if(exp_irq != ex_traps_entered) { printf("\tERROR: %u interrupts taken, expected %u", (unsigned int)ex_traps_entered, (unsigned int)exp_irq); failureCount += 1;