NU32v2: Benchmark Test

From Mech
Revision as of 13:06, 21 February 2011 by Nelson Rosa (talk | contribs) (NU32v2: NU32v2 Benchmark Test moved to NU32v2: Benchmark Test: redundant usage of NU32v2)
Jump to navigationJump to search

*** 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.

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