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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [bench/] [asm/] [zipdhry.S] - Diff between revs 50 and 57

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

Rev 50 Rev 57
Line 29... Line 29...
;
;
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;
// Under Verilator:
// Under Verilator:
//      DMIPS:          25.57   100 MHz         0.26
//      DMIPS:          28.6    100 MHz (sim)   0.29
 
//
 
//
 
//   with no loop unrolling nor function inlining
 
//      DMIPS:          24.3    100 MHz (sim)   0.24
 
//   with packed strings
 
//      DMIPS:          35.6    100 MHz (sim)   0.36
 
//
// For comparison:
// For comparison:
//      uBlaze:         255     177 MHz         1.44
//      uBlaze:         255     177 MHz         1.44
//      LEON3                                   1.4
//      LEON3                                   1.4
//      NiOS II:        218     185 MHz         1.16
//      NiOS II:        218     185 MHz         1.16
//      OpenRisk        250     250 MHz         1.00
//      OpenRisk        250     250 MHz         1.00
//      LM32                                    1.14
//      LM32                                    1.14
//      ZPU             2.6      50 MHz         0.05
//      ZPU             2.6      50 MHz         0.05
//
//
 
 
 
// Some #def's to control compilation.
 
//
 
// SKIP_SHORT_CIRCUITS determines whether or not we do internal testing and
 
// jump to a BUSY instruction on failure for the debugger to pick up.  Skip
 
// this for valid testing.
 
//
 
// #define      SKIP_SHORT_CIRCUITS
 
//
 
// NO_INLINE controls whether or not we inline certain functions.  If you
 
// define this, nothing will be inlined.
 
// #define      NO_INLINE
 
//
 
// NO_LOOP_UNROLLING controls loop unrolling.  The default is to unroll loops
 
// by a factor of 4x.  By defining this, all loop unrolling is removed.
// #define      NO_LOOP_UNROLLING
// #define      NO_LOOP_UNROLLING
#define SKIP_SHORT_CIRCUITS
//
 
// Use PSTRS has to deal with whether or not we are processing packed strings
 
// or normal strings.  Packed strings are really a cheaters exception to the
 
// dhrystone measure, although they do get our score up.
 
//
 
// #define      USE_PSTRS
        sys.ctr.mtask   equ     0xc0000008
        sys.ctr.mtask   equ     0xc0000008
// int main(int argc, char **argv) {
// int main(int argc, char **argv) {
//      dhrystone();
//      dhrystone();
// }
// }
entry:
entry:
Line 70... Line 96...
// typedef      enum { Ident_1, Ident_2, Ident_3, Ident_4, Ident_5 } test_enum;
// typedef      enum { Ident_1, Ident_2, Ident_3, Ident_4, Ident_5 } test_enum;
// typedef      enum { false, true } bool;
// typedef      enum { false, true } bool;
 
 
// typedef      int     Arr_1_Dim[50];
// typedef      int     Arr_1_Dim[50];
// typedef      int     Arr_2_Dim[50][50];
// typedef      int     Arr_2_Dim[50][50];
 
#ifdef  USE_PSTRS
 
#define RECSIZE 12
 
#else
#define RECSIZE 35
#define RECSIZE 35
 
#endif
#define NUMBER_OF_RUNS  (512)
#define NUMBER_OF_RUNS  (512)
        ptr_comp                        equ     0
        ptr_comp                        equ     0
        discr                           equ     1
        discr                           equ     1
        variant.var_1.enum_comp         equ     2
        variant.var_1.enum_comp         equ     2
        variant.var_1.int_comp          equ     3
        variant.var_1.int_comp          equ     3
Line 112... Line 142...
//
//
lcl_strcpy:
lcl_strcpy:
        ; R0 = d
        ; R0 = d
        ; R1 = s
        ; R1 = s
        ; R3 = ch
        ; R3 = ch
#ifdef  NO_LOOP_UNROLLING
 
copy_next_char:
copy_next_char:
 
#ifdef  NO_LOOP_UNROLLING
        LOD     (R1),R2
        LOD     (R1),R2
        STO     R2,(R0)
        STO     R2,(R0)
 
#ifdef  USE_PSTRS
 
        TST     255,R2
 
#else
 
        CMP     0,R2
 
#endif
 
        RETN.Z
        ADD     1,R0
        ADD     1,R0
        ADD     1,R1
        ADD     1,R1
        CMP     0,R2
        BRA     copy_next_char
        BNZ     copy_next_char
 
 
 
 
 
#else
#else
copy_next_char:
 
        LOD     (R1),R2
        LOD     (R1),R2
        CMP     0,R2
 
        STO     R2,(R0)
        STO     R2,(R0)
        BZ      lcl_strcpy_end_of_loop
#ifdef  USE_PSTRS
        LOD     1(R1),R2
        TST     255,R2
 
#else
        CMP     0,R2
        CMP     0,R2
 
#endif
 
        ; BZ    lcl_strcpy_end_of_loop
 
        RETN.Z
 
        LOD     1(R1),R2
        STO     R2,1(R0)
        STO     R2,1(R0)
        BZ      lcl_strcpy_end_of_loop
#ifdef  USE_PSTRS
        LOD     2(R1),R2
        TST     255,R2
 
#else
        CMP     0,R2
        CMP     0,R2
 
#endif
 
        ; BZ    lcl_strcpy_end_of_loop
 
        RETN.Z
 
        LOD     2(R1),R2
        STO     R2,2(R0)
        STO     R2,2(R0)
        BZ      lcl_strcpy_end_of_loop
#ifdef  USE_PSTRS
        LOD     3(R1),R2
        TST     255,R2
 
#else
        CMP     0,R2
        CMP     0,R2
 
#endif
 
        ; BZ    lcl_strcpy_end_of_loop
 
        RETN.Z
 
        LOD     3(R1),R2
        STO     R2,3(R0)
        STO     R2,3(R0)
        BZ      lcl_strcpy_end_of_loop
        ; BZ    lcl_strcpy_end_of_loop
 
#ifdef  USE_PSTRS
 
        TST     255,R2
 
#else
 
        CMP     0,R2
 
#endif
 
        RETN.Z
        ADD     4,R0
        ADD     4,R0
        ADD     4,R1
        ADD     4,R1
        CMP     0,R2
        BRA     copy_next_char
        BNZ     copy_next_char
 
lcl_strcpy_end_of_loop:
 
#endif
#endif
        RETN
 
 
 
//int   lcl_strcmp(char *s1, char *s2) {
//int   lcl_strcmp(char *s1, char *s2) {
//      char    a, b;
//      char    a, b;
//      do {
//      do {
//              a = *s1++; b = *s2++;
//              a = *s1++; b = *s2++;
Line 161... Line 215...
        SUB     1,SP
        SUB     1,SP
        STO     R3,1(SP)
        STO     R3,1(SP)
 
 
strcmp_top_of_loop:
strcmp_top_of_loop:
#ifdef  NO_LOOP_UNROLLING
#ifdef  NO_LOOP_UNROLLING
        LOD     (R0),R2
        ; LOD   (R0),R2
        LOD     (R1),R3                 ; Alternate approach:
        ; LOD   (R1),R3                 ; Alternate approach:
        ; CMP   R2,R3                   ;       CMP     0,R2
        ; CMP   R2,R3                   ;       CMP     0,R2
        ; BNZ   strcmp_end_loop         ;       BZ      strcmp_end_loop
        ; BNZ   strcmp_end_loop         ;       BZ      strcmp_end_loop
        ; CMP   0,R2                    ;       CMP     R2,R3
        ; CMP   0,R2                    ;       CMP     R2,R3
        ; BZ    strcmp_end_loop         ;       BZ      strcmp_top_of_loop
        ; BZ    strcmp_end_loop         ;       BZ      strcmp_top_of_loop
        ; CMP   0,R3                    ;
        ; CMP   0,R3                    ;
Line 174... Line 228...
        ; ADD   1,R0
        ; ADD   1,R0
        ; ADD   1,R1
        ; ADD   1,R1
        ; BRA   strcmp_top_of_loop
        ; BRA   strcmp_top_of_loop
        LOD     (R0),R2
        LOD     (R0),R2
        LOD     (R1),R3
        LOD     (R1),R3
 
#ifdef  USE_PSTRS
 
        TST     255,R2
 
#else
        CMP     0,R2
        CMP     0,R2
 
#endif
        BZ      strcmp_end_loop
        BZ      strcmp_end_loop
 
        ADD     1,R0
 
        ADD     1,R1
        CMP     R2,R3
        CMP     R2,R3
        BZ      strcmp_top_of_loop
        BZ      strcmp_top_of_loop
#else
#else
        LOD     (R0),R2
        LOD     (R0),R2
        LOD     (R1),R3
        LOD     (R1),R3
 
#ifdef  USE_PSTRS
 
        TST     255,R2
 
#else
        CMP     0,R2
        CMP     0,R2
 
#endif
        BZ      strcmp_end_loop
        BZ      strcmp_end_loop
        CMP     R2,R3
        CMP     R2,R3
        BNZ     strcmp_end_loop
        BNZ     strcmp_end_loop
        LOD     1(R0),R2
        LOD     1(R0),R2
        LOD     1(R1),R3
        LOD     1(R1),R3
 
#ifdef  USE_PSTRS
 
        TST     255,R2
 
#else
        CMP     0,R2
        CMP     0,R2
 
#endif
        BZ      strcmp_end_loop
        BZ      strcmp_end_loop
        CMP     R2,R3
        CMP     R2,R3
        BNZ     strcmp_end_loop
        BNZ     strcmp_end_loop
        LOD     2(R0),R2
        LOD     2(R0),R2
        LOD     2(R1),R3
        LOD     2(R1),R3
 
#ifdef  USE_PSTRS
 
        TST     255,R2
 
#else
        CMP     0,R2
        CMP     0,R2
 
#endif
        BZ      strcmp_end_loop
        BZ      strcmp_end_loop
        CMP     R2,R3
        CMP     R2,R3
        BNZ     strcmp_end_loop
        BNZ     strcmp_end_loop
        LOD     3(R0),R2
        LOD     3(R0),R2
        LOD     3(R1),R3
        LOD     3(R1),R3
 
#ifdef  USE_PSTRS
 
        TST     255,R2
 
#else
        CMP     0,R2
        CMP     0,R2
 
#endif
        BZ      strcmp_end_loop
        BZ      strcmp_end_loop
        CMP     R2,R3
        CMP     R2,R3
        BNZ     strcmp_end_loop
        BNZ     strcmp_end_loop
        ADD     4,R0
        ADD     4,R0
        ADD     4,R1
        ADD     4,R1
Line 301... Line 377...
        STO     R2,1(SP)
        STO     R2,1(SP)
        BRA     func_1
        BRA     func_1
 
 
        CMP     0,R0
        CMP     0,R0
        ADD.Z   1,R5
        ADD.Z   1,R5
 
#ifndef SKIP_SHORT_CIRCUITS
 
        BUSY.NZ
 
#endif
#else
#else
        LOD     (R6),R2
        LOD     (R6),R2
        MOV     R4,R6
        MOV     R4,R6
        ADD     R5,R6
        ADD     R5,R6
        LOD     1(R6),R1
        LOD     1(R6),R1
Line 312... Line 391...
        CMP     R2,R1
        CMP     R2,R1
        STO.Z   R2,gbl_ch(R12)
        STO.Z   R2,gbl_ch(R12)
        LDILO.Z 1,R0
        LDILO.Z 1,R0
 
 
        ADD.NZ  1,R5
        ADD.NZ  1,R5
#endif
 
 
 
#ifndef SKIP_SHORT_CIRCUITS
#ifndef SKIP_SHORT_CIRCUITS
        BUSY.NZ
        BUSY.Z
#endif
#endif
 
#endif
 
 
        CMP     3,R5
        CMP     3,R5
#ifndef SKIP_SHORT_CIRCUITS
#ifndef SKIP_SHORT_CIRCUITS
        BUSY.LT
        BUSY.LT
#endif
#endif
        BLT     func_2_top_while_loop
        BLT     func_2_top_while_loop
Line 341... Line 420...
        MOV     __HERE__+3(PC),R2
        MOV     __HERE__+3(PC),R2
        STO     R2,1(SP)
        STO     R2,1(SP)
        BRA     lcl_strcmp
        BRA     lcl_strcmp
        CMP     0,R0
        CMP     0,R0
        BGT     func_2_final_then
        BGT     func_2_final_then
#ifndef SKIP_SHORT_CIRCUITS
 
        BUSY
 
#endif
 
        CLR     R0
        CLR     R0
        BRA     func_2_return_and_cleanup
        BRA     func_2_return_and_cleanup
func_2_final_then:
func_2_final_then:
        // ADD  7,R5            ; Never read, so useless code
        // ADD  7,R5            ; Never read, so useless code
        LDI     1,R0
        LDI     1,R0
Line 890... Line 966...
//              proc_2(&lcl_int_1);
//              proc_2(&lcl_int_1);
//      }
//      }
//}
//}
 
 
some_string:
some_string:
 
#ifdef  USE_PSTRS
 
        word    'DHRY','STON','E PR','OGRA','M, S','OME '
 
        word    'STRI','NG\0\0'
 
#else
        word    'D','H','R','Y','S','T','O','N','E',' '
        word    'D','H','R','Y','S','T','O','N','E',' '
        word    'P','R','O','G','R','A','M',',',' '
        word    'P','R','O','G','R','A','M',',',' '
        word    'S','O','M','E',' ','S','T','R','I','N','G'
        word    'S','O','M','E',' ','S','T','R','I','N','G'
        word    0
        word    0
 
#endif
 
 
first_string:
first_string:
 
#ifdef  USE_PSTRS
 
        word    'DHRY','STON','E PR','OGRA'
 
        word    'M, 1','\'ST ','STRI','NG\0\0'
 
#else
        word    'D','H','R','Y','S','T','O','N','E',' '
        word    'D','H','R','Y','S','T','O','N','E',' '
        word    'P','R','O','G','R','A','M',','
        word    'P','R','O','G','R','A','M',','
        word    ' ','1','\'','S','T'
        word    ' ','1','\'','S','T'
        word    ' ','S','T','R','I','N','G'
        word    ' ','S','T','R','I','N','G'
        word    0
        word    0
 
#endif
 
 
second_string:
second_string:
 
#ifdef  USE_PSTRS
 
        word    'DHRY','STON','E PR','OGRA'
 
        word    'M, 2','\'ND ','STRI','NG\0\0'
 
#else
        word    'D','H','R','Y','S','T','O','N','E',' '
        word    'D','H','R','Y','S','T','O','N','E',' '
        word    'P','R','O','G','R','A','M',',',' '
        word    'P','R','O','G','R','A','M',',',' '
        word    '2','\'','N','D',' ','S','T','R','I','N','G'
        word    '2','\'','N','D',' ','S','T','R','I','N','G'
        word    0
        word    0
 
#endif
 
 
third_string:
third_string:
 
#ifdef  USE_PSTRS
 
        word    'DHRY','STON','E PR','OGRA'
 
        word    'M, 3','\'RD ','STRI','NG\0\0'
 
#else
        word    'D','H','R','Y','S','T','O','N','E',' '
        word    'D','H','R','Y','S','T','O','N','E',' '
        word    'P','R','O','G','R','A','M',',',' '
        word    'P','R','O','G','R','A','M',',',' '
        word    '3','\'','R','D',' ','S','T','R','I','N','G'
        word    '3','\'','R','D',' ','S','T','R','I','N','G'
        word    0
        word    0
 
#endif
 
 
dhrystone:
dhrystone:
#ifdef  SUPERVISOR_TASK
#ifdef  SUPERVISOR_TASK
        SUB     12+RECSIZE+RECSIZE+30+30+3,SP
        SUB     12+RECSIZE+RECSIZE+30+30+3,SP
        ; Leave a space on the top of the stack for calling
        ; Leave a space on the top of the stack for calling

powered by: WebSVN 2.1.0

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