resources: Add the matrix-multiply resource

Change-Id: I23d711a5b83434da20176d0f0c33701ab0762d9a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5-resources/+/62732
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
diff --git a/resources.json b/resources.json
index d9117e4..556699d 100644
--- a/resources.json
+++ b/resources.json
@@ -88,6 +88,16 @@
         },
         {
             "type" : "resource",
+            "name" : "x86-matrix-multiply",
+            "documentation" : "A simple binary which runs a matrix mutiply operation on two 100x100 matrixes. After multiplication it will return the print the of the multiplication.",
+            "architecture" : "X86",
+            "is_zipped" : false,
+            "md5sum" : "bfedb18f311ba5f59af6e115c1f7f58c",
+            "url" : "{url_base}/test-progs/matrix-multiply/x86-matrix-multiply-20220825",
+            "source" : "src/matrix-multiply"
+        },
+        {
+            "type" : "resource",
             "name" : "x86-parsec",
             "documentation" : "A disk image containing the PARSEC benchmark suite, compiled to X86, built on top of Ubuntu 18.04.",
             "architecture" : "X86",
diff --git a/src/matrix-multiply/Makefile b/src/matrix-multiply/Makefile
new file mode 100644
index 0000000..ed5d45a
--- /dev/null
+++ b/src/matrix-multiply/Makefile
@@ -0,0 +1,33 @@
+# Copyright (c) 2022 The Regents of the University of California
+# All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+.DEFAULT_GOAL := matrix-multiply
+
+matrix-multiply:
+	gcc -o matrix-multiply matrix-multiply.c --static
+
+clean:
+	- rm matrix-multiply
\ No newline at end of file
diff --git a/src/matrix-multiply/README.md b/src/matrix-multiply/README.md
new file mode 100644
index 0000000..f3fd8e1
--- /dev/null
+++ b/src/matrix-multiply/README.md
@@ -0,0 +1,46 @@
+---
+title: The 'matrix-multiply' binary
+layout: default
+permalink: resources/matrix-multiply
+shortdoc: >
+    Source for 'matrix-multiply'. A matrix-multiply binary runs a multiplication on two 100x100 matrixes. The sum of the multiplied matrix is printed upon completion.
+author: ["Bobby R. Bruce"]
+---
+
+The 'matrix-multiply' resource runs a multiplication on two 100x100 matrixes.
+The sum of the multiplied matrix is printed upon completion.
+
+## Building Instructions
+
+Run `make`.
+
+This will only compile the binary to the X86 ISA.
+
+## Cleaning Instructions
+
+Run `make clean` in the Makefile directory.
+
+## Usage
+
+As this binary does not contain any special `m5` library code it can be run outside of a gem5 simulation:
+
+```sh
+./matrix-multiply
+```
+
+It can also be run in a gem5 simulation in SE mode.
+Below is a snippet which utilizes the gem5 standard library to do so:
+
+```py
+board.set_se_workload(Resource("x86-matrix-multiply"))
+
+simulator = Simulator(board = board)
+```
+
+## Pre-built binaries
+
+Compiled to the X86 ISA: http://dist.gem5.org/dist/develop/test-progs/matrix-multiply/x86-matrix-multiply-20220825
+
+## License
+
+This code is covered by By the [03-Clause BSD License (BSD-3-Clause)](https://opensource.org/licenses/BSD-3-Clause).
diff --git a/src/matrix-multiply/matrix-multiply.c b/src/matrix-multiply/matrix-multiply.c
new file mode 100644
index 0000000..39ccfdd
--- /dev/null
+++ b/src/matrix-multiply/matrix-multiply.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2022 The Regents of the University of California
+ * All rights reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+int main()
+{
+    const int size = 100;
+    int first[size][size], second[size][size], multiply[size][size];
+
+    printf("Populating the first and second matrix...\n");
+    for(int x=0; x<size; x++)
+    {
+        for(int y=0; y<size; y++)
+        {
+            first[x][y] = x + y;
+            second[x][y] = (4 * x) + (7 * y);
+        }
+    }
+    printf("Done!\n");
+
+    printf("Multiplying the matrixes...\n");
+    for(int c=0; c<size; c++)
+    {
+        for(int d=0; d<size; d++)
+        {
+            int sum = 0;
+            for(int k=0; k<size; k++)
+            {
+                sum += first[c][k] * second[k][d];
+            }
+           multiply[c][d] = sum;
+        }
+    }
+    printf("Done!\n");
+
+    printf("Calculating the sum of all elements in the matrix...\n");
+    long int sum = 0;
+    for(int x=0; x<size; x++)
+        for(int y=0; y<size; y++)
+            sum += multiply[x][y];
+    printf("Done\n");
+
+    printf("The sum is %ld\n", sum);
+}