1 //**************************************************************************
2 // Vector-vector add benchmark
3 //--------------------------------------------------------------------------
5 // This benchmark uses adds to vectors and writes the results to a
6 // third vector. The input data (and reference data) should be
7 // generated using the vvadd_gendata.pl perl script and dumped
8 // to a file named dataset1.h The smips-gcc toolchain does not
9 // support system calls so printf's can only be used on a host system,
10 // not on the smips processor simulator itself. You should not change
11 // anything except the HOST_DEBUG and PREALLOCATE macros for your timing
16 //--------------------------------------------------------------------------
17 // Input/Reference Data
21 //--------------------------------------------------------------------------
24 void vvadd( int n
, int a
[], int b
[], int c
[] )
27 for ( i
= 0; i
< n
; i
++ )
31 //--------------------------------------------------------------------------
34 int main( int argc
, char* argv
[] )
36 int results_data
[DATA_SIZE
];
38 // Output the input array
39 printArray( "input1", DATA_SIZE
, input1_data
);
40 printArray( "input2", DATA_SIZE
, input2_data
);
41 printArray( "verify", DATA_SIZE
, verify_data
);
44 // If needed we preallocate everything in the caches
45 vvadd( DATA_SIZE
, input1_data
, input2_data
, results_data
);
50 vvadd( DATA_SIZE
, input1_data
, input2_data
, results_data
);
53 // Print out the results
54 printArray( "results", DATA_SIZE
, results_data
);
57 return verify( DATA_SIZE
, results_data
, verify_data
);