@@ -272,7 +272,8 @@ int main(int argc, char *argv[]) {
272
272
if (retval != EXIT_SUCCESS )
273
273
return retval ;
274
274
275
- // Repeat test1 (restore vector mode)
275
+ // TODO unused tests. to be removed at clean-up
276
+ /* // Repeat test1 (restore vector mode)
276
277
retval = test7();
277
278
if (retval != EXIT_SUCCESS)
278
279
return retval;
@@ -286,7 +287,7 @@ int main(int argc, char *argv[]) {
286
287
retval = test9();
287
288
if (retval != EXIT_SUCCESS)
288
289
return retval;
289
-
290
+ */
290
291
return EXIT_SUCCESS ;
291
292
}
292
293
@@ -498,14 +499,14 @@ int test3() {
498
499
// Tests that WFI works regardless of MSTATUS.MIE
499
500
// Tests that IRQ handler is not entered after WFI unless MSTATUS.MIE is set
500
501
int test4 () {
501
- /*
502
+
502
503
printf ("TEST 4 - WFI\n" );
503
504
504
505
// Test 4 is a WFI test
505
506
active_test = 4 ;
506
507
507
508
// Iterate through multiple loops
508
- for (int irq = 0 ; irq < 32; irq++) {
509
+ for (int irq = 1 ; irq < 32 ; irq ++ ) { // NMI is irq[0]
509
510
if (!(((0x1 << irq ) & IRQ_MASK )))
510
511
continue ;
511
512
@@ -530,8 +531,8 @@ int test4() {
530
531
else
531
532
mstatus_mie_disable ();
532
533
533
- // Assert random batch of irqs (w/o selected irq)
534
- rand_irq = random_num32() & ~(0x1 << irq);
534
+ // Assert random batch of irqs (w/o selected irq) and not NMI.
535
+ rand_irq = random_num32 () & ~(0x1 << irq ) & ~( 0x1 ) ;
535
536
mm_ram_assert_irq (rand_irq , 0 );
536
537
537
538
delay (2 );
@@ -556,7 +557,6 @@ int test4() {
556
557
}
557
558
}
558
559
}
559
- */
560
560
return EXIT_SUCCESS ;
561
561
}
562
562
@@ -582,47 +582,13 @@ int test5() {
582
582
return EXIT_SUCCESS ;
583
583
}
584
584
585
- // Test 6 will repeat the basic interrupt test in test 1
586
- // But with a relocated vector table via mtvec CSR and DIRECT vector mode
587
585
int test6 () {
588
- /* volatile uint32_t save_mtvec;
589
- int retval;
590
-
591
- printf("TEST 6 - TRIGGER ALL IRQS IN SEQUENCE (DIRECT-MODE MTVEC):\n");
592
-
593
- active_test = 6;
594
-
595
- asm volatile("csrr %0, mtvec" : "=r" (save_mtvec));
596
- asm volatile("csrw mtvec, %0" : : "r" ((uint32_t) alt_direct_vector_table)); // Leave mode at 0
597
-
598
- retval = test1_impl(1);
599
- asm volatile("csrw mtvec, %0" : : "r" (save_mtvec));
600
- if (retval != EXIT_SUCCESS) {
601
- return ERR_CODE_TEST_6;
602
- }
603
- */
604
- return EXIT_SUCCESS ;
605
- }
606
-
607
- // Test 7 is a direct repeat of test 1 in vectored mode
608
- int test7 () {
609
- /* printf("TEST 7 - TRIGGER ALL IRQS IN SEQUENCE: (REPEAT VECTOR MODE)\n");
610
-
611
- active_test = 7;
612
-
613
- if (test1_impl(0) != EXIT_SUCCESS)
614
- return ERR_CODE_TEST_7;
615
-
616
- return EXIT_SUCCESS;
617
- */
618
- }
619
-
620
- int test8 () {
621
586
volatile uint32_t mcausew ;
622
587
volatile uint32_t mcauser ;
623
588
624
589
// MCAUSE is writable, this simple check tests this and also fufills code coverage
625
- printf ("TEST 8 - READ/WRITE TO MCAUSE\n" );
590
+ printf ("TEST 6 - READ/WRITE TO MCAUSE\n" );
591
+ active_test = 6 ;
626
592
627
593
mcausew = 0x0 ;
628
594
__asm__ volatile ("csrw mcause, %0" : : "r" (mcausew ));
@@ -651,14 +617,59 @@ int test8() {
651
617
return EXIT_SUCCESS ;
652
618
}
653
619
620
+ // Test 7 will repeat the basic interrupt test in test 1
621
+ // But with a relocated vector table via mtvec CSR and DIRECT vector mode
622
+ // CV32E20 does not support DIRECT mode.
623
+ // TODO Saved here until clean up
624
+ /*
625
+ int test7() {
626
+
627
+ volatile uint32_t save_mtvec;
628
+ int retval;
629
+
630
+ printf("TEST 7 - TRIGGER ALL IRQS IN SEQUENCE (DIRECT-MODE MTVEC):\n");
631
+
632
+ active_test = 7;
633
+
634
+ asm volatile("csrr %0, mtvec" : "=r" (save_mtvec));
635
+ asm volatile("csrw mtvec, %0" : : "r" ((uint32_t) alt_direct_vector_table)); // Leave mode at 0
636
+
637
+ retval = test1_impl(1);
638
+ asm volatile("csrw mtvec, %0" : : "r" (save_mtvec));
639
+ if (retval != EXIT_SUCCESS) {
640
+ return ERR_CODE_TEST_7;
641
+ }
642
+ return EXIT_SUCCESS;
643
+
644
+ }
645
+ */
646
+ // Test 7 is a direct repeat of test 1 in vectored mode
647
+ // why repeat?
648
+ /* TODO Saved here until clean up
649
+ int test8() {
650
+ printf("TEST 8 - TRIGGER ALL IRQS IN SEQUENCE: (REPEAT VECTOR MODE)\n");
651
+
652
+ active_test = 8;
653
+
654
+ if (test1_impl(0) != EXIT_SUCCESS)
655
+ return ERR_CODE_TEST_8;
656
+
657
+ return EXIT_SUCCESS;
658
+ }
659
+ */
660
+
661
+ // CV32E20 - this test appears to be a coverage filler test. Will wait until we see initial coverage numbers
662
+ /* TODO Saved here until clean up
654
663
int test9() {
655
- /* volatile uint32_t save_mtvec;
664
+
665
+ volatile uint32_t save_mtvec;
656
666
printf("TEST 9 - ECALL-WFI Coverage Test\n");
657
667
658
668
active_test = 9;
659
669
660
- asm volatile("csrr %0, mtvec" : "=r" (save_mtvec));
661
- asm volatile("csrw mtvec, %0" : : "r" ((uint32_t) alt_direct_ecall_table)); // Leave mode at 0
670
+ // Just leave MTVEC =0x0101. CV32E20 doesn't support DIRECT mode.
671
+ // asm volatile("csrr %0, mtvec" : "=r" (save_mtvec));
672
+ // asm volatile("csrw mtvec, %0" : : "r" ((uint32_t) alt_direct_ecall_table)); // Leave mode at 0
662
673
663
674
mm_ram_assert_irq(0, 0);
664
675
@@ -716,5 +727,5 @@ int test9() {
716
727
asm volatile("csrw mtvec, %0" : : "r" (save_mtvec));
717
728
718
729
return EXIT_SUCCESS;
719
- */
720
730
}
731
+ */
0 commit comments