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