037de2fbf9569acd38cb494ee87bbe9a2a649769
[riscv-tests.git] / benchmarks / multiply / multiply_main.c
1 // *************************************************************************
2 // multiply filter bencmark
3 // -------------------------------------------------------------------------
4 //
5 // This benchmark tests the software multiply implemenation. The
6 // input data (and reference data) should be generated using the
7 // multiply_gendata.pl perl script and dumped to a file named
8 // dataset1.h You should not change anything except the
9 // HOST_DEBUG and VERIFY macros for your timing run.
10
11 #include "util.h"
12
13 #include "multiply.h"
14
15 //--------------------------------------------------------------------------
16 // Input/Reference Data
17
18 #include "dataset1.h"
19
20 //--------------------------------------------------------------------------
21 // Main
22
23 int main( int argc, char* argv[] )
24 {
25 int i;
26 int results_data[DATA_SIZE];
27
28 // Output the input arrays
29 printArray( "input1", DATA_SIZE, input_data1 );
30 printArray( "input2", DATA_SIZE, input_data2 );
31 printArray( "verify", DATA_SIZE, verify_data );
32
33 #if PREALLOCATE
34 for (i = 0; i < DATA_SIZE; i++)
35 {
36 results_data[i] = multiply( input_data1[i], input_data2[i] );
37 }
38 #endif
39
40 setStats(1);
41 for (i = 0; i < DATA_SIZE; i++)
42 {
43 results_data[i] = multiply( input_data1[i], input_data2[i] );
44 }
45 setStats(0);
46
47 // Print out the results
48 printArray( "results", DATA_SIZE, results_data );
49
50 // Check the results
51 return verify( DATA_SIZE, results_data, verify_data );
52 }