The last chip in the comparison is the Z16F2810. When I started the tests I got a Loop overhead time of only 0.64, which made me think the chip might be very fast. When I moved on to the multiplication and division tests, though, some of them completed in only 0.89 seconds. After looking at the assembly generated during compilation I noticed that the arguments of division were only being copied to the register that holds the answer. It seems that even though all the variables were declared as volatile, the compiler decided to optimize the division out anyway. This made me think the compiler was simply ignoring the volatile keyword but the assembly generated when accessing volatiles is slightly different. Loops involving them take about 25% longer to run, so it does have an effect. The only way I could prevent it from optimizing out multiplies and divides while keeping optimizations was to declare the involved variables globally. The User Manual for the chip helped a lot when looking at this problem and I think it is really well done.
For arithmetic operations, the chip did very well. It was always faster than the MSP430 and almost as fast as the LPC1114 for most things. One place it did very well was division where it outperformed all the other chips by a large margin because it has a hardware divider. General GPIO is also pretty fast, although it does not have any special mechanism for speeding it up like the masks on the LPC1114 or the constant generator on the MSP430. BCD Add was about the same as the MSP430. BCD Multiply was faster than on the MSP430 but still much slower than on the LPC1114.
After running all the chips, here are my conclusions:
Results are after the break.
These tests are not a comprehensive benchmark. Many factors have to be taken into account to choose the right chip for a job. These tests only focus on a very narrow range of those factors.
For arithmetic operations, the chip did very well. It was always faster than the MSP430 and almost as fast as the LPC1114 for most things. One place it did very well was division where it outperformed all the other chips by a large margin because it has a hardware divider. General GPIO is also pretty fast, although it does not have any special mechanism for speeding it up like the masks on the LPC1114 or the constant generator on the MSP430. BCD Add was about the same as the MSP430. BCD Multiply was faster than on the MSP430 but still much slower than on the LPC1114.
After running all the chips, here are my conclusions:
- MSP430 Easy to use and reasonably fast. Good choice for small jobs and low-power projects. Held back by low clock speed (16MHz), small memory, and lack of hardware multiplier.
- LPC1114 The fastest chip by far for everything but division and 8 bit math. Lots of RAM and Flash. Straightforward to use, although there is no real community. Very fast GPIO with masks. Top choice for calculations.
- DS89C450 Fast for 8 bit math, although slow at shifting. Very fast GPIO since each GPIO pin is mapped to its own byte in memory. Extremely slow at BCD calculations. The only real advantage is the external memory bus.
- AT89LP6440 Similar to the DS89C450 but lower clock speed and performance.
- Z16F2810 Good performance but inferior to the LPC1114 in everything but dividing. Debugger is very useful but the IDE itself is sometimes clunky. Enough RAM and very big Flash (128KB). PLCC package is inconvenient.
In the future I plan to do a few more projects that will need the extra horsepower for the LPC1114. For other smaller jobs I will stick with the MSP430.
These tests are not a comprehensive benchmark. Many factors have to be taken into account to choose the right chip for a job. These tests only focus on a very narrow range of those factors.
MSP430G2553 | LPC1114 | DS89C450 | AT89LP6440 | Z16F2810 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Loop overhead time | -O3 | 1.72 | 0.84 | 3.33 | 3.33 | 1.79 | ||||||
-Os | 1.72 | 0.91 | 3.33 | (20MHz) | (33MHz) | 3.33 | 1.79 | |||||
Add unsigned 8 bit | -O3 | 9.826 | 8.106 | 4.64 | 3.8 | 6.29 | 2.96 | 1.79 | 6.26 | 2.93 | 7.1 | 5.31 |
-Os | 9.889 | 8.169 | 4.84 | 3.93 | 6.24 | 2.91 | 1.76 | 6.25 | 2.92 | 7.1 | 5.31 | |
Add unsigned 16 bit | -O3 | 10.032 | 8.312 | 4.96 | 4.12 | 18.04 | 14.71 | 8.92 | 18.07 | 14.74 | 6.71 | 4.92 |
-Os | 10.071 | 8.351 | 5.15 | 4.24 | 17.92 | 14.59 | 8.84 | 18.05 | 14.72 | 6.71 | 4.92 | |
Add unsigned 32 bit | -O3 | 29.592 | 27.872 | 4.23 | 3.39 | 31.49 | 28.16 | 17.07 | 31.47 | 28.14 | 9.29 | 7.5 |
-Os | 29.816 | 28.096 | 4.38 | 3.47 | 31.3 | 27.97 | 16.95 | 31.42 | 28.09 | 9.29 | 7.5 | |
Add signed 8 bit | -O3 | 9.84 | 8.12 | 4.63 | 3.79 | 6.29 | 2.96 | 1.79 | 6.25 | 2.92 | 7.09 | 5.3 |
-Os | 9.909 | 8.189 | 4.82 | 3.91 | 6.24 | 2.91 | 1.76 | 6.25 | 2.92 | 7.1 | 5.31 | |
Add signed 16 bit | -O3 | 10.02 | 8.3 | 4.63 | 3.79 | 18.05 | 14.72 | 8.92 | 18.09 | 14.76 | 6.7 | 4.91 |
-Os | 10.054 | 8.334 | 5.15 | 4.24 | 17.92 | 14.59 | 8.84 | 18.05 | 14.72 | 6.71 | 4.92 | |
Add signed 32 bit | -O3 | 29.536 | 27.816 | 4.2 | 3.36 | 31.49 | 28.16 | 17.07 | 31.45 | 28.12 | 9.29 | 7.5 |
-Os | 29.637 | 27.917 | 4.38 | 3.47 | 31.31 | 27.98 | 16.96 | 31.44 | 28.11 | 9.29 | 7.5 | |
Multiply unsigned 8 bit | -O3 | 19.65 | 17.93 | 1.28 | 0.44 | 5.31 | 1.98 | 1.2 | 4.43 | 1.1 | 4.15 | 2.36 |
-Os | 19.58 | 17.86 | 1.41 | 0.5 | 5.28 | 1.95 | 1.18 | 4.42 | 1.09 | 4.15 | 2.36 | |
Multiply unsigned 16 bit | -O3 | 21.14 | 19.42 | 1.28 | 0.44 | 12.92 | 9.59 | 5.81 | 10.3 | 6.97 | 3.64 | 1.85 |
-Os | 21.07 | 19.35 | 1.41 | 0.5 | 12.82 | 9.49 | 5.75 | 10.27 | 6.94 | 3.64 | 1.85 | |
Multiply unsigned 32 bit | -O3 | 40.36 | 38.64 | 1.33 | 0.49 | 31.37 | 28.04 | 16.99 | 23 | 19.67 | 3.76 | 1.97 |
-Os | 40.23 | 38.51 | 1.42 | 0.51 | 31.28 | 27.95 | 16.94 | 22.9 | 19.57 | 3.76 | 1.97 | |
Multiply signed 8 bit | -O3 | 19.98 | 18.26 | 1.39 | 0.55 | 5.31 | 1.98 | 1.2 | 4.43 | 1.1 | 5.02 | 3.23 |
-Os | 19.91 | 18.19 | 1.53 | 0.62 | 5.28 | 1.95 | 1.18 | 4.43 | 1.1 | 5.02 | 3.23 | |
Multiply signed 16 bit | -O3 | 20.65 | 18.93 | 1.39 | 0.55 | 12.91 | 9.58 | 5.81 | 10.28 | 6.95 | 4.51 | 2.72 |
-Os | 20.58 | 18.86 | 1.53 | 0.62 | 12.82 | 9.49 | 5.75 | 10.26 | 6.93 | 4.51 | 2.72 | |
Multiply signed 32 bit | -O3 | 70.24 | 68.52 | 1.23 | 0.39 | 31.38 | 28.05 | 17 | 22.94 | 19.61 | 4.63 | 2.84 |
-Os | 69.97 | 68.25 | 1.41 | 0.5 | 31.18 | 27.85 | 16.88 | 22.9 | 19.57 | 4.63 | 2.84 | |
Divide unsigned 8 bit | -O3 | 17.34 | 15.62 | 8.09 | 7.25 | 5.44 | 2.11 | 1.28 | 4.68 | 1.35 | 5.14 | 3.35 |
-Os | 17.27 | 15.55 | 8.33 | 7.42 | 5.4 | 2.07 | 1.25 | 4.67 | 1.34 | 5.14 | 3.35 | |
Divide unsigned 16 bit | -O3 | 29.44 | 27.72 | 11 | 10.16 | 75.43 | 72.1 | 43.7 | 73.35 | 70.02 | 4.63 | 2.84 |
-Os | 29.32 | 27.6 | 11.14 | 10.23 | 74.98 | 72.65 | 43.42 | 73.21 | 69.88 | 4.63 | 2.84 | |
Divide unsigned 32 bit | -O3 | 90.12 | 88.4 | 14.56 | 13.72 | 231.16 | 227.83 | 138.08 | 226.32 | 222.99 | 6.6 | 4.81 |
-Os | 89.75 | 88.03 | 14.65 | 13.74 | 229.63 | 226.3 | 137.15 | 225.89 | 222.56 | 6.6 | 4.81 | |
Divide signed 8 bit | -O3 | 33.27 | 31.55 | 9.35 | 8.51 | 8.26 | 4.93 | 2.99 | 7.24 | 3.91 | 5.26 | 3.47 |
-Os | 33.13 | 31.41 | 9.38 | 8.47 | 8.2 | 4.87 | 2.95 | 7.22 | 3.89 | 5.26 | 3.47 | |
Divide signed 16 bit | -O3 | 33.72 | 32 | 12.05 | 11.21 | 79.34 | 76.01 | 46.07 | 77.29 | 73.96 | 4.75 | 2.96 |
-Os | 33.47 | 31.75 | 12.29 | 11.38 | 78.89 | 75.56 | 45.79 | 77.13 | 73.8 | 4.75 | 2.96 | |
Divide signed 32 bit | -O3 | 96.94 | 95.22 | 15.5 | 14.66 | 231.86 | 228.53 | 138.5 | 227.3 | 223.97 | 6.85 | 5.06 |
-Os | 96.54 | 94.82 | 15.58 | 14.67 | 230.46 | 227.13 | 137.65 | 226.68 | 223.35 | 6.84 | 5.05 | |
Shift right unsigned 8 bit | -O3 | 14.86 | 13.14 | 1.83 | 0.99 | 17.8 | 14.47 | 8.77 | 16.02 | 12.69 | 5.01 | 3.22 |
-Os | 14.79 | 13.07 | 1.96 | 1.05 | 17.67 | 14.34 | 8.69 | 15.98 | 12.65 | 5.01 | 3.22 | |
Shift right unsigned 16 bit | -O3 | 29.79 | 28.07 | 1.83 | 0.99 | 62.86 | 59.53 | 36.08 | 58.94 | 55.61 | 4.75 | 2.96 |
-Os | 29.66 | 27.94 | 1.97 | 1.06 | 62.46 | 59.13 | 35.84 | 58.79 | 55.46 | 4.75 | 2.96 | |
Shift right unsigned 32 bit | -O3 | 69.62 | 67.9 | 1.72 | 0.88 | 200.46 | 197.13 | 119.47 | 192.1 | 188.77 | 5.24 | 3.45 |
-Os | 69.31 | 67.59 | 1.8 | 0.89 | 199.32 | 195.99 | 118.78 | 191.57 | 188.24 | 5.24 | 3.45 | |
Shift right signed 8 bit | -O3 | 14.85 | 13.13 | 2.16 | 1.32 | 20.74 | 17.41 | 10.55 | 18.72 | 15.39 | 5.01 | 3.22 |
-Os | 14.8 | 13.08 | 2.29 | 1.38 | 20.62 | 17.29 | 10.48 | 18.66 | 15.33 | 5.01 | 3.22 | |
Shift right signed 16 bit | -O3 | 25.15 | 23.43 | 2.16 | 1.32 | 67.76 | 64.43 | 39.05 | 63.59 | 60.26 | 4.75 | 2.96 |
-Os | 25.05 | 23.33 | 2.29 | 1.38 | 67.35 | 64.02 | 38.8 | 63.44 | 60.11 | 4.75 | 2.96 | |
Shift right signed 32 bit | -O3 | 59.69 | 57.97 | 1.72 | 0.88 | 209.38 | 206.05 | 124.88 | 200.68 | 197.35 | 5.24 | 3.45 |
-Os | 59.42 | 57.7 | 1.8 | 0.89 | 208.16 | 204.83 | 124.14 | 200.12 | 196.79 | 5.24 | 3.45 | |
Shift left unsigned 8 bit | -O3 | 14.86 | 13.14 | 1.83 | 0.99 | 17.81 | 14.48 | 8.78 | 16.03 | 12.7 | 5.01 | 3.22 |
-Os | 14.8 | 13.08 | 1.96 | 1.05 | 17.71 | 14.38 | 8.72 | 15.98 | 12.65 | 5.01 | 3.22 | |
Shift left unsigned 16 bit | -O3 | 25.16 | 23.44 | 1.83 | 0.99 | 62.86 | 59.53 | 36.08 | 58.96 | 55.63 | 4.75 | 2.96 |
-Os | 25.04 | 23.32 | 1.97 | 1.06 | 62.51 | 59.18 | 35.87 | 58.21 | 54.88 | 4.75 | 2.96 | |
Shift left unsigned 32 bit | -O3 | 59.67 | 57.98 | 1.72 | 0.88 | 200.53 | 197.2 | 119.52 | 192.16 | 188.83 | 5.24 | 3.45 |
-Os | 59.41 | 57.96 | 1.8 | 0.89 | 199.42 | 196.09 | 118.84 | 189.73 | 186.4 | 5.24 | 3.45 | |
Shift left signed 8 bit | -O3 | 14.86 | 13.14 | 2.16 | 1.32 | 17.8 | 14.47 | 8.77 | 16.03 | 12.7 | 5.01 | 3.22 |
-Os | 14.8 | 13.08 | 2.29 | 1.38 | 17.7 | 14.37 | 8.71 | 15.82 | 12.49 | 5.01 | 3.22 | |
Shift left signed 16 bit | -O3 | 25.17 | 23.45 | 2.16 | 1.32 | 62.88 | 59.55 | 36.09 | 58.97 | 55.64 | 4.75 | 2.96 |
-Os | 25.04 | 23.32 | 2.29 | 1.38 | 62.51 | 59.18 | 35.87 | 58.21 | 54.88 | 4.75 | 2.96 | |
Shift left signed 32 bit | -O3 | 59.68 | 57.96 | 1.72 | 0.88 | 200.55 | 197.22 | 119.53 | 192.21 | 188.88 | 5.24 | 3.45 |
-Os | 59.41 | 57.69 | 1.8 | 0.89 | 199.44 | 196.11 | 118.85 | 189.73 | 186.4 | 5.24 | 3.45 | |
GPIO | -O3 | 18.088 | 16.368 | 7.03 | 6.19 | 15.6 | 12.27 | 7.44 | 15.55 | 12.22 | 11.5 | 9.71 |
-Os | 18.056 | 16.336 | 7.26 | 6.35 | 15.52 | 12.19 | 7.39 | 15.35 | 12.02 | 11.51 | 9.72 | |
GPIO Constant Generator | -O3 | 14.752 | 13.032 | |||||||||
-Os | 14.758 | 13.038 | ||||||||||
GPIO Masked | -O3 | 3.22 | 2.38 | |||||||||
-Os | 3.52 | 2.61 | ||||||||||
GPIO Bit Operation | -O3 | 8.26 | 4.93 | 2.99 | 8.24 | 4.91 | ||||||
-Os | 8.22 | 4.89 | 2.96 | 8.12 | 4.79 | |||||||
BCD Add 120+325 | -O3 | 47.93 | 46.21 | 17.93 | 16.21 | 42.47 | 40.68 | |||||
-Os | 50.05 | 48.33 | 20.83 | 19.11 | 42.5 | 40.71 | ||||||
BCD Add 120+325 Stored in xdata |
-O3 | 214.03 | 210.7 | 127.7 | 218.71 | 215.38 | ||||||
-Os | 212.13 | 208.8 | 126.55 | 215.79 | 212.46 | |||||||
BCD Add 120+325 Stored in idata |
-O3 | 249.96 | 246.63 | 149.47 | 254.55 | 251.22 | ||||||
-Os | 247.78 | 244.45 | 148.15 | 251.02 | 247.69 | |||||||
BCD Multiply 24 * 13 Without multiplies |
-O3 | 393.4 | 391.68 | 131.49 | 129.77 | 292.5 | 290.71 | |||||
-Os | 375.21 | 373.49 | 149.84 | 148.12 | 292.65 | 290.86 | ||||||
BCD Multiply 24 * 13 Without multiplies, xdata |
-O3 | 1441.8 | 1438.47 | 871.8 | 1471.1 | 1467.77 | ||||||
-Os | 1437 | 1433.67 | 868.89 | 1480.3 | 1476.97 | |||||||
BCD Multiply 24 * 13 Without multiplies, idata |
-O3 | 1658.3 | 1654.97 | 1003.01 | 1683.4 | 1680.07 | ||||||
-Os | 1651.8 | 1648.47 | 999.07 | 1685 | 1681.67 | |||||||
BCD Multiply 24 * 13 With multiplies |
-O3 | 405.64 | 403.92 | 131.88 | 130.16 | 290.85 | 289.06 | |||||
-Os | 508.52 | 506.8 | 140.53 | 138.81 | 290.87 | 289.08 | ||||||
BCD Multiply 24 * 13 With multiplies, xdata |
-O3 | 1565.1 | 1561.77 | 946.53 | 1593.8 | 1590.47 | ||||||
-Os | 1557 | 1553.67 | 941.62 | 1604.9 | 1601.57 | |||||||
BCD Multiply 24 * 13 With multiplies, idata |
-O3 | 1829.5 | 1826.17 | 1106.77 | 1853 | 1849.67 | ||||||
-Os | 1818.9 | 1815.57 | 1100.35 | 1867.4 | 1864.07 |
No comments:
Post a Comment