High-Speed Arithmetic

C51 uses the 32-bit and 16-bit arithmetic operations of the 80C517 and 80C537 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 compares the performance of the standard 8051 to that of the 80C517 CPU.

16-bit Binary Integer Operations

Execution Time in CPU Cycles

Operation/CPU

Library Routine

Min.

Typ.

Max.

Signed/unsigned multiplication

8051

IMUL

31

80517

intrinsic

16

Unsigned division

8051

UIDIV

18

100

190

80517

UIDIV517

24

Signed division

8051

SIDIV

38

120

210

80517

SIDIV517

44

32-bit Binary Integer Operations

Execution Time in CPU Cycles

Operation/CPU

Library Routine

Min.

Typ.

Max.

Signed/unsigned multiplication

8051

LMUL

128

80517

LMUL517

74

Unsigned division

8051

ULDIV

1000

1100

1500

80517

ULDIV517

38

80

126

Signed division

8051

SLDIV

1030

1130

1530

80517

SLDIV517

68

90

156

Left shift

8051

LSHL

7

7+(15×cnt)

472

80517

LSHL517

7

30

31

Unsigned right shift

8051

ULSHR

7

7+(15×cnt)

472

80517

ULSHR517

7

31

32

Signed right shift

8051

SLSHR

7

7+(15×cnt)

472

80517

SLSHR517

7

31

32

Floating-point Operations

Execution Time in CPU Cycles

Operation/CPU

Library Routine

Min.

Typ.

Max.

Addition

8051

FPADD

100

220

285

80517

FPADD517

100

190

205

Subtraction

8051

FPSUB

100

220

287

80517

FPSUB517

100

190

207

Multiplication

8051

FPMUL

352

375

384

80517

FPMUL517

200

215

230

Division

8051

FPDIV

1020

1150

1210

80517

FPDIV517

250

285

350

Comparison

8051

FPCMP

100

80517

FPCMP517

100

Square root

8051

SQRT

40

2560

2860

80517

SQRT517

40

1150

1170

Sine

8051

SIN

4770

80517

SIN517

3500

Cosine

8051

COS

5300

80517

COS517

3700

Tangent

8051

TAN

2370

9570

80517

TAN517

2370

6170

Arcsine

8051

ASIN

930

9730

10060

80517

ASIN517

740

5280

5370

Arccosine

8051

ACOS

2030

10250

11470

80517

ACOS517

1850

5800

5900

Arctangent

8051

ATAN

1125

6700

80517

ATAN517

1125

3760

Exponential

8051

EXP

2940

7680

7870

80517

EXP517

2840

5380

5530

 Logarithm

8051

LOG

45

5730

6050

80517

LOG517

45

3550

3600

ASCII to floating-point conversion

8051

FPATOF

800

3000

16380

80517

FPATOF517

680

2050

9930

NOTE
The execution times specified in this table do not take into consideration access times for variables or stack operations. The actual processing times may consume up to 100 additional cycles depending on the accessed address space and stack load.

When using the arithmetic features of the 80C517 and 80C537, note that the operations involving the arithmetic processor are exclusive and are not interrupt-capable. For this reason, do not use the arithmetic extensions in both the main program and in an interrupt service routine. By doing the following, you can guarantee that only one thread of execution uses the arithmetic processor:

    Use the MOD517 directive to compile functions which are guaranteed to be executed 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.