Скачиваний:
46
Добавлен:
21.03.2016
Размер:
985.51 Кб
Скачать

Keil Software — C51 Compiler User’s Guide

107

 

 

Siemens 80C517 and 80C537

The Siemens 80C517 and 80C537 provide high-speed 32-bit and 16-bit arithmetic operations as well as 8 data pointers which can be used for memory access. Using the high-speed arithmetic unit improves the performance of many int, long, and float operations.

The MOD517 control directive instructs the C51 compiler to generate code that utilizes the advanced features of these CPUs.

Data Pointers

The Siemens 80C517 and 80C537 provide 8 data pointers which can be used to improve memory accesses. Using multiple data pointers can improve the execution of library functions such as: memcpy, memmove, memcmp, strcpy, and strcmp. The 8 data pointers of the 80C517 and 80C537 can also reduce the stack load of interrupt functions.

C51 uses only 2 of the 8 data pointers of the 80C517 at a time. In order to keep the stack load in the interrupt routines low, C51 switches to 2 unused data

pointers when switching the register bank. In this case, the contents of the 5 register DPSEL are saved on the stack, and a new pair of data pointers is

selected. Saving the data pointers on the stack is no longer required.

If an interrupt routine does not switch to another register bank (for example, the function is declared without the using attribute), the data pointers must be saved on the stack (using 4 bytes of stack space). To keep the size of the stack as small as possible, use the MOD517(NODP8) directive to compile the interrupt routine and the functions called from within the interrupt. This generates code for the interrupt that uses only one data pointer and, therefore, only 2 bytes of stack space.

108

Chapter 5. 8051 Derivatives

 

 

High-speed Arithmetic

C51 uses the 32-bit and 16-bit arithmetic operations of the 80C517 to improve performance of a number of math-intensive operations. C language programs execute considerably faster when using either of these CPUs.

The following tables show execution times for various arithmetic operations and compare the performance of the standard 8051 to that of the 80C517 CPU.

16-bit Binary Integer Operations

 

 

Operation

CPU

Routine

Min.

Avg.

Max.

 

 

 

 

 

 

 

 

 

 

Signed/unsigned multiplication

8051

IMUL

29

29

29

 

 

 

80517

intrinsic

17

17

17

 

 

Unsigned division

8051

UIDIV

16

128

153

 

 

 

80517

UIDIV517

22

22

22

 

 

Signed division

8051

SIDIV

53

141

181

 

 

 

80517

SIDIV517

35

52

60

 

 

Times are shown in CPU cycles.

 

 

 

 

 

32-bit Binary Integer Operations

 

 

 

 

 

 

 

 

 

 

 

 

 

5

 

Operation

CPU

Routine

Min.

Avg.

Max.

 

 

 

 

 

 

 

 

Signed/unsigned multiplication

8051

LMUL

106

106

106

 

 

80517

LMUL517

62

62

62

 

 

Unsigned division

8051

ULDIV

227

497

650

 

 

 

80517

ULDIV517

36

52

101

 

 

Signed division

8051

SLDIV

267

564

709

 

 

 

80517

SLDIV517

49

75

141

 

 

Left shift

8051

LSHL

5

237

470

 

 

 

80517

LSHL517

5

28

29

 

 

Unsigned right shift

8051

ULSHR

5

237

470

 

 

 

80517

ULSHR517

5

29

30

 

 

Signed right shift

8051

SLSHR

5

237

470

 

 

 

80517

 

 

 

 

 

 

 

 

Times are shown in CPU cycles.

Keil Software — C51 Compiler User’s Guide

109

 

 

Floating-point Operations

Operation

CPU

Routine

Min.

Avg.

Max.

 

 

 

 

 

 

 

 

 

 

Addition

8051

FPADD

8

107

202

 

 

 

80517

FPADD517

8

107

202

 

 

Subtraction

8051

FPSUB

11

113

214

 

 

 

80517

FPSUB517

11

113

214

 

 

Multiplication

8051

FPMUL

13

114

198

 

 

 

80517

FPMUL517

13

86

141

 

 

Division

8051

FPDIV

48

687

999

 

 

 

80517

FPDIV517

48

165

209

 

 

Comparison

8051

FPCMP

42

54

59

 

 

 

80517

FPCMP517

42

54

59

 

 

Square root

8051

SQRT

12

1936

2360

 

 

 

80517

SQRT517

12

755

882

 

 

Sine

8051

SIN

1565

2928

3476

 

 

 

80517

SIN517

1422

2519

3048

 

 

Cosine

8051

COS

1601

2921

3665

 

 

 

80517

COS517

1458

2514

3180

 

 

Tangent

8051

TAN

1982

4966

5699

 

 

 

80517

TAN517

1839

3753

4329

 

 

Arcsine

8051

ASIN

912

6991

8554

 

 

 

80517

ASIN517

912

3984

4717

 

 

Arccosine

8051

ACOS

796

7578

8579

 

 

 

 

80517

ACOS517

796

4255

4871

 

5

Arctangent

8051

ATAN

1069

3320

3712

 

 

 

 

80517

ATAN517

1037

2444

2737

 

 

Exponential

8051

EXP

233

3314

5308

 

 

 

80517

EXP517

176

2879

4724

 

 

 

 

Natural Logarithm

8051

LOG

32

3432

4128

 

 

 

80517

LOG517

32

2405

2926

 

 

Common Logarithm

8051

LOG10

34

3607

4328

 

 

 

80517

LOG10517

34

2530

3069

 

 

ASCII to float conversion

8051

FPATOF

960

3006

5611

 

 

 

80517

FPATOF517

722

2202

4144

 

 

 

 

 

 

 

 

 

 

Times are shown in CPU cycles.

110

Chapter 5. 8051 Derivatives

 

 

NOTES

The execution times specified in the preceding tables do not take access times for variables or stack operations into consideration. Actual processing times may consume up to 100 additional cycles depending on the stack load and address space used.

When using the arithmetic features of the 80C517 and 80C537, note that operations involving the arithmetic processor are exclusive and may not be interrupted. Do not use the arithmetic extensions in both the main program and an interrupt service routine.

Use the following suggestions to help guarantee that only one thread of execution uses the arithmetic processor:

!Use the MOD517 directive to compile functions which are guaranteed to execute only in the main program or functions used by one interrupt service routine, but not both.

!Compile all remaining functions with the MOD517(NOAU) directive.

Library Routines

5

The extra features of the 80C517 and 80C537 are used in several library routines

 

to enhance performance. These routines are listed below and are described in

 

detail in “Chapter 8. Library Reference” on page 175.

 

 

acos517

exp517

sin517

 

asin517

log10517

sprintf517

 

atan517

log517

sqrt517

 

atof517

printf517

sscanf517

 

cos517

scanf517

tan517

Соседние файлы в папке Лаборатория