OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [bench/] [asm/] [cputest.c] - Diff between revs 168 and 172

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 168 Rev 172
Line 145... Line 145...
        "\tBREAK\n"
        "\tBREAK\n"
        "\tLDI\t1,R1\n" // Test fails
        "\tLDI\t1,R1\n" // Test fails
        "\tJMP\tR0");
        "\tJMP\tR0");
 
 
void    break_two(void);
void    break_two(void);
 
        // Can we stop a break before we hit it?
asm("\t.global\tbreak_two\n"
asm("\t.global\tbreak_two\n"
        "\t.type\tbreak_two,@function\n"
        "\t.type\tbreak_two,@function\n"
"break_two:\n"
"break_two:\n"
        "\tLDI\t0,R1\n"
        "\tLDI\t0,R1\n"
        "\tJMP\tR0\n"
        "\tJMP\tR0\n"
Line 818... Line 819...
        //
        //
        // Test #4: Can we load the CC plus a value into a register?
        // Test #4: Can we load the CC plus a value into a register?
        //      I don't think so ...
        //      I don't think so ...
        "\tJMP\tR0\n");
        "\tJMP\tR0\n");
 
 
 
// Multiple argument test
 
__attribute__((noinline))
 
int     multiarg_subroutine(int a, int b, int c, int d, int e, int f, int g) {
 
        if (a!=0)        return 1;
 
        if (b!=1)       return 2;
 
        if (c!=2)       return 4;
 
        if (d!=3)       return 8;
 
        if (e!=4)       return 16;
 
        if (f!=5)       return 32;
 
        if (g!=6)       return 64;
 
        return 0;
 
}
 
 
 
int     multiarg_test(void) {
 
        return multiarg_subroutine(0,1,2,3,4,5,6);
 
}
 
 
__attribute__((noinline))
__attribute__((noinline))
void    wait(unsigned int msk) {
void    wait(unsigned int msk) {
        *PIC = 0x7fff0000|msk;
        *PIC = 0x7fff0000|msk;
        asm("MOV\tidle_task(PC),uPC\n");
        asm("MOV\tidle_task(PC),uPC\n");
        *PIC = 0x80000000|(msk<<16);
        *PIC = 0x80000000|(msk<<16);
Line 947... Line 965...
#endif
#endif
#ifdef  HAVE_COUNTER
#ifdef  HAVE_COUNTER
        *COUNTER = 0;
        *COUNTER = 0;
#endif
#endif
 
 
#define STACKTEST       asm("CMP\t16108,SP\n\tHALT.NZ\n")
// #define      STACKTEST       asm("CMP\t16108,SP\n\tHALT.NZ\n")
 
#define STACKTEST
        STACKTEST;
        STACKTEST;
 
 
        // *UART_CTRL = 8333; // 9600 Baud, 8-bit chars, no parity, one stop bit
        // *UART_CTRL = 8333; // 9600 Baud, 8-bit chars, no parity, one stop bit
        *UART_CTRL = 25; // 9600 Baud, 8-bit chars, no parity, one stop bit
        *UART_CTRL = 25; // 9600 Baud, 8-bit chars, no parity, one stop bit
        //
        //
Line 972... Line 991...
        if ((run_test(break_one, user_stack_ptr))||(zip_ucc()&0x1f50))
        if ((run_test(break_one, user_stack_ptr))||(zip_ucc()&0x1f50))
                test_fails(start_time, &testlist[tnum]);
                test_fails(start_time, &testlist[tnum]);
        STACKTEST;
        STACKTEST;
 
 
        save_context(context);
        save_context(context);
        if (context[15] != (int)break_one+1)
        if ((context[15] != (int)break_one+1)||(0==(zip_ucc()&0x80)))
                test_fails(start_time, &testlist[tnum]);
 
        if (0==(zip_ucc()&0x80))
 
                test_fails(start_time, &testlist[tnum]);
                test_fails(start_time, &testlist[tnum]);
        txstr("Pass\r\n"); testlist[tnum++] = 0; // 0
        txstr("Pass\r\n"); testlist[tnum++] = 0; // 0
 
 
        STACKTEST;
        STACKTEST;
 
 
        // Test break instruction in user mode
        // Test break instruction in user mode
        // Make sure that a decision on the clock prior won't still cause a 
        // Make sure that a decision on the clock prior won't still cause a 
        // break condition
        // break condition
        testid("Break test #2"); MARKSTART;
        testid("Break test #2"); MARKSTART;
        if ((run_test(break_two, user_stack_ptr))||(zip_ucc()&0x1f10))
        if ((run_test(break_two, user_stack_ptr))||(zip_ucc()&0x1d90))
                test_fails(start_time, &testlist[tnum]);
                test_fails(start_time, &testlist[tnum]);
        txstr("Pass\r\n"); testlist[tnum++] = 0; // #1
        txstr("Pass\r\n"); testlist[tnum++] = 0; // #1
 
 
        // LJMP test ... not (yet) written
        // LJMP test ... not (yet) written
 
 
Line 1093... Line 1110...
        testid("CC Register test"); MARKSTART;
        testid("CC Register test"); MARKSTART;
        if ((run_test(ccreg_test, user_stack_ptr))||(zip_ucc()&0x01d90))
        if ((run_test(ccreg_test, user_stack_ptr))||(zip_ucc()&0x01d90))
                test_fails(start_time, &testlist[tnum]);
                test_fails(start_time, &testlist[tnum]);
        txstr("Pass\r\n"); testlist[tnum++] = 0;
        txstr("Pass\r\n"); testlist[tnum++] = 0;
 
 
 
        // Multiple argument test
 
        testid("Multi-Arg test"); MARKSTART;
 
        if ((run_test(multiarg_test, user_stack_ptr))||(zip_ucc()&0x01d90))
 
                test_fails(start_time, &testlist[tnum]);
 
        txstr("Pass\r\n"); testlist[tnum++] = 0;
 
 
        txstr("\r\n");
        txstr("\r\n");
        txstr("-----------------------------------\r\n");
        txstr("-----------------------------------\r\n");
        txstr("All tests passed.  Halting CPU.\n");
        txstr("All tests passed.  Halting CPU.\n");
        zip_halt();
        zip_halt();
}
}

powered by: WebSVN 2.1.0

© copyright 1999-2022 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.