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

Subversion Repositories zipcpu

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /zipcpu/trunk/bench/asm
    from Rev 50 to Rev 57
    Reverse comparison

Rev 50 → Rev 57

/zipdhry.S
31,7 → 31,14
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
// 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:
// uBlaze: 255 177 MHz 1.44
// LEON3 1.4
41,8 → 48,27
// 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 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
// int main(int argc, char **argv) {
// dhrystone();
72,7 → 98,11
 
// typedef int Arr_1_Dim[50];
// typedef int Arr_2_Dim[50][50];
#ifdef USE_PSTRS
#define RECSIZE 12
#else
#define RECSIZE 35
#endif
#define NUMBER_OF_RUNS (512)
ptr_comp equ 0
discr equ 1
114,39 → 144,63
; R0 = d
; R1 = s
; R3 = ch
copy_next_char:
#ifdef NO_LOOP_UNROLLING
copy_next_char:
LOD (R1),R2
STO R2,(R0)
#ifdef USE_PSTRS
TST 255,R2
#else
CMP 0,R2
#endif
RETN.Z
ADD 1,R0
ADD 1,R1
CMP 0,R2
BNZ copy_next_char
BRA copy_next_char
 
 
 
#else
copy_next_char:
LOD (R1),R2
STO R2,(R0)
#ifdef USE_PSTRS
TST 255,R2
#else
CMP 0,R2
STO R2,(R0)
BZ lcl_strcpy_end_of_loop
#endif
; BZ lcl_strcpy_end_of_loop
RETN.Z
LOD 1(R1),R2
STO R2,1(R0)
#ifdef USE_PSTRS
TST 255,R2
#else
CMP 0,R2
STO R2,1(R0)
BZ lcl_strcpy_end_of_loop
#endif
; BZ lcl_strcpy_end_of_loop
RETN.Z
LOD 2(R1),R2
STO R2,2(R0)
#ifdef USE_PSTRS
TST 255,R2
#else
CMP 0,R2
STO R2,2(R0)
BZ lcl_strcpy_end_of_loop
#endif
; BZ lcl_strcpy_end_of_loop
RETN.Z
LOD 3(R1),R2
STO R2,3(R0)
; BZ lcl_strcpy_end_of_loop
#ifdef USE_PSTRS
TST 255,R2
#else
CMP 0,R2
STO R2,3(R0)
BZ lcl_strcpy_end_of_loop
#endif
RETN.Z
ADD 4,R0
ADD 4,R1
CMP 0,R2
BNZ copy_next_char
lcl_strcpy_end_of_loop:
BRA copy_next_char
#endif
RETN
 
//int lcl_strcmp(char *s1, char *s2) {
// char a, b;
163,8 → 217,8
 
strcmp_top_of_loop:
#ifdef NO_LOOP_UNROLLING
LOD (R0),R2
LOD (R1),R3 ; Alternate approach:
; LOD (R0),R2
; LOD (R1),R3 ; Alternate approach:
; CMP R2,R3 ; CMP 0,R2
; BNZ strcmp_end_loop ; BZ strcmp_end_loop
; CMP 0,R2 ; CMP R2,R3
176,32 → 230,54
; BRA strcmp_top_of_loop
LOD (R0),R2
LOD (R1),R3
#ifdef USE_PSTRS
TST 255,R2
#else
CMP 0,R2
#endif
BZ strcmp_end_loop
ADD 1,R0
ADD 1,R1
CMP R2,R3
BZ strcmp_top_of_loop
#else
LOD (R0),R2
LOD (R1),R3
#ifdef USE_PSTRS
TST 255,R2
#else
CMP 0,R2
#endif
BZ strcmp_end_loop
CMP R2,R3
BNZ strcmp_end_loop
LOD 1(R0),R2
LOD 1(R1),R3
#ifdef USE_PSTRS
TST 255,R2
#else
CMP 0,R2
#endif
BZ strcmp_end_loop
CMP R2,R3
BNZ strcmp_end_loop
LOD 2(R0),R2
LOD 2(R1),R3
#ifdef USE_PSTRS
TST 255,R2
#else
CMP 0,R2
#endif
BZ strcmp_end_loop
CMP R2,R3
BNZ strcmp_end_loop
LOD 3(R0),R2
LOD 3(R1),R3
#ifdef USE_PSTRS
TST 255,R2
#else
CMP 0,R2
#endif
BZ strcmp_end_loop
CMP R2,R3
BNZ strcmp_end_loop
303,6 → 379,9
 
CMP 0,R0
ADD.Z 1,R5
#ifndef SKIP_SHORT_CIRCUITS
BUSY.NZ
#endif
#else
LOD (R6),R2
MOV R4,R6
314,11 → 393,11
LDILO.Z 1,R0
 
ADD.NZ 1,R5
#ifndef SKIP_SHORT_CIRCUITS
BUSY.Z
#endif
#endif
 
#ifndef SKIP_SHORT_CIRCUITS
BUSY.NZ
#endif
CMP 3,R5
#ifndef SKIP_SHORT_CIRCUITS
BUSY.LT
343,9 → 422,6
BRA lcl_strcmp
CMP 0,R0
BGT func_2_final_then
#ifndef SKIP_SHORT_CIRCUITS
BUSY
#endif
CLR R0
BRA func_2_return_and_cleanup
func_2_final_then:
892,29 → 968,49
//}
 
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 'P','R','O','G','R','A','M',',',' '
word 'S','O','M','E',' ','S','T','R','I','N','G'
word 0
#endif
 
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 'P','R','O','G','R','A','M',','
word ' ','1','\'','S','T'
word ' ','S','T','R','I','N','G'
word 0
#endif
 
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 'P','R','O','G','R','A','M',',',' '
word '2','\'','N','D',' ','S','T','R','I','N','G'
word 0
#endif
 
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 'P','R','O','G','R','A','M',',',' '
word '3','\'','R','D',' ','S','T','R','I','N','G'
word 0
#endif
 
dhrystone:
#ifdef SUPERVISOR_TASK
/Makefile
30,7 → 30,7
#
################################################################################
#
all: zipdhry.z testdiv.z wdt.z
all: zipdhry.z testdiv.z wdt.z halttest.z
ZASM := ../../sw/zasm/zasm
ZDMP := ../../sw/zasm/zdump
LIBS := ../../sw/lib
38,6 → 38,8
 
dump: zipdhry.txt testdiv.txt
 
halttest.z: halttest.S
$(ZASM) $(INCS) $^ -o $@
zipdhry.z: zipdhry.S $(LIBS)/divs.S $(LIBS)/divu.S stack.S
$(ZASM) $(INCS) $^ -o $@
zipdhry.txt: zipdhry.z

powered by: WebSVN 2.1.0

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