Skip to content

Commit

Permalink
zc_test: add mva01s bugfix sanity
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Pedersen <[email protected]>
  • Loading branch information
silabs-robin committed Dec 1, 2023
1 parent b6bbc40 commit fc6abe8
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions cv32e40s/tests/programs/custom/zc_test/zc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[])
{
Expand All @@ -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;

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit fc6abe8

Please sign in to comment.