1 // See LICENSE for license details.
3 //**************************************************************************
4 // Vector-vector add benchmark
5 //--------------------------------------------------------------------------
7 // This benchmark uses adds to vectors and writes the results to a
8 // third vector. The input data (and reference data) should be
9 // generated using the vvadd_gendata.pl perl script and dumped
10 // to a file named dataset1.h The smips-gcc toolchain does not
11 // support system calls so printf's can only be used on a host system,
12 // not on the smips processor simulator itself. You should not change
13 // anything except the HOST_DEBUG and PREALLOCATE macros for your timing
18 //--------------------------------------------------------------------------
19 // Input/Reference Data
23 //--------------------------------------------------------------------------
26 void vvadd( int n
, int a
[], int b
[], int c
[] )
29 for ( i
= 0; i
< n
; i
++ )
33 //--------------------------------------------------------------------------
36 int main( int argc
, char* argv
[] )
38 int results_data
[DATA_SIZE
];
40 // Output the input array
41 printArray( "input1", DATA_SIZE
, input1_data
);
42 printArray( "input2", DATA_SIZE
, input2_data
);
43 printArray( "verify", DATA_SIZE
, verify_data
);
46 // If needed we preallocate everything in the caches
47 vvadd( DATA_SIZE
, input1_data
, input2_data
, results_data
);
52 vvadd( DATA_SIZE
, input1_data
, input2_data
, results_data
);
55 // Print out the results
56 printArray( "results", DATA_SIZE
, results_data
);
59 return verify( DATA_SIZE
, results_data
, verify_data
);