Difference between revisions of "NU32v2: Benchmark Test"

From Mech
Jump to navigationJump to search
 
(7 intermediate revisions by one other user not shown)
Line 1: Line 1:
'''THIS PAGE REFERS TO A PRE-RELEASE VERSION OF THE NU32 PIC32 DEVELOPMENT BOARD. FOR INFORMATION, SAMPLE CODE, AND VIDEOS RELATED TO THE PRODUCTION VERSION (2016 AND LATER), AND TO THE CORRESPONDING BOOK "EMBEDDED COMPUTING AND MECHATRONICS WITH THE PIC32 MICROCONTROLLER," VISIT [[NU32|THE NU32 PAGE]].'''
'''*** UNDER CONSTRUCTION ***'''



Benchmarking is a useful tool in testing how fast a processor can run. With the PIC32, we are primarily interested in seeing how fast its CPU can perform mathematical operations.
Benchmarking is a useful tool in testing how fast a processor can run. With the PIC32, we are primarily interested in seeing how fast its CPU can perform mathematical operations.


== Overview ==
== Overview ==

Add high-level overview of CPU, including:


* The processor executes instructions in an assembly line fashion similar to how cars are assembled. In any given clock cycle, the processor could be executing several instructions at once (each instruction occupying a different stage in the assembly line of course). One issue that commonly arises is when assembly instruction $i$ needs the result of instruction $i-1$ (where $i-1$ is one stage ahead of $i$), but the processor has not yet finished computing the result of $i-1$. Unfortunately, the processor has no choice but to stall instruction $i$ until the value for $i-1$ becomes available. Your timing results will include both the time to execute an instruction and any processor stalls.
* One clock cycle is 1/SYSFREQ and as instructions pass through the processor's ``assembly line'' at 80MHz, the processor is eventually able to complete one instruction every 12.5ns. Therefore, for all intensive purposes, you can pretend that one line of computer assembly code takes one cycle to compelete.
* The PIC has no hardware to compute floating-point operations. This piece of hardware is known as a floating point unit or FPU. The calculations are instead performed in software.


== Details ==
== Details ==
The common arithmetic operators, multiplication (*), division(/), addition (+), and subtraction (-) were tested on the PIC32. Because timing results can vary depending on which C data type (char, short, int, long long, float, and double) is used, the final table includes the number of cycles a particular operator and data type pair took to compute.
The common arithmetic operators, multiplication (*), division(/), addition (+), and subtraction (-) were tested on the PIC32. Because timing results can vary depending on which C data type (char, short, int, long long, float, and double) is used, the final table includes the number of cycles a particular operator and data type pair took to compute. The table below is taken from a student who took ME 333 in the Winter 2011 term. The values, in cycles, are representative of what the class got as a whole.


{| border="1" align="center" style="text-align:center;"
{| border="1" align="center" style="text-align:center;"
Line 23: Line 31:
|12
|12
|68
|68
|101
|102
|-
|-
|sub (-)
|sub (-)
|5
|5
|5
|5
|5
|10
|10
|79
|79
|125
|123
|-
|mult (*)
|7
|7
|7
|23
|56
|106
|-
|div (/)
|16
|16
|16
|119
|149
|314
|}
|}


A small subset of the built-in mathematical functions defined in <math.h> were also tested. The values, as in the previous table, are in cycles.


{| border="1" align="center" style="text-align:center;"

|sinf
A small subset of the built-in mathematical functions defined in <math.h> were also tested.
|263
|-
|sin
|647
|-
|sqrtf
|293
|-
|sqrt
|603
|}


== Library Functions ==
== Library Functions ==

Latest revision as of 05:29, 16 January 2016

THIS PAGE REFERS TO A PRE-RELEASE VERSION OF THE NU32 PIC32 DEVELOPMENT BOARD. FOR INFORMATION, SAMPLE CODE, AND VIDEOS RELATED TO THE PRODUCTION VERSION (2016 AND LATER), AND TO THE CORRESPONDING BOOK "EMBEDDED COMPUTING AND MECHATRONICS WITH THE PIC32 MICROCONTROLLER," VISIT THE NU32 PAGE.


Benchmarking is a useful tool in testing how fast a processor can run. With the PIC32, we are primarily interested in seeing how fast its CPU can perform mathematical operations.

Overview

Add high-level overview of CPU, including:


  • The processor executes instructions in an assembly line fashion similar to how cars are assembled. In any given clock cycle, the processor could be executing several instructions at once (each instruction occupying a different stage in the assembly line of course). One issue that commonly arises is when assembly instruction $i$ needs the result of instruction $i-1$ (where $i-1$ is one stage ahead of $i$), but the processor has not yet finished computing the result of $i-1$. Unfortunately, the processor has no choice but to stall instruction $i$ until the value for $i-1$ becomes available. Your timing results will include both the time to execute an instruction and any processor stalls.
  • One clock cycle is 1/SYSFREQ and as instructions pass through the processor's ``assembly line at 80MHz, the processor is eventually able to complete one instruction every 12.5ns. Therefore, for all intensive purposes, you can pretend that one line of computer assembly code takes one cycle to compelete.
  • The PIC has no hardware to compute floating-point operations. This piece of hardware is known as a floating point unit or FPU. The calculations are instead performed in software.

Details

The common arithmetic operators, multiplication (*), division(/), addition (+), and subtraction (-) were tested on the PIC32. Because timing results can vary depending on which C data type (char, short, int, long long, float, and double) is used, the final table includes the number of cycles a particular operator and data type pair took to compute. The table below is taken from a student who took ME 333 in the Winter 2011 term. The values, in cycles, are representative of what the class got as a whole.

char short int long long float double
add (+) 5 5 5 12 68 102
sub (-) 5 5 5 10 79 123
mult (*) 7 7 7 23 56 106
div (/) 16 16 16 119 149 314

A small subset of the built-in mathematical functions defined in <math.h> were also tested. The values, as in the previous table, are in cycles.

sinf 263
sin 647
sqrtf 293
sqrt 603

Library Functions

Sample Code

More Information