From: Luke Kenneth Casson Leighton Date: Wed, 15 Nov 2023 14:18:20 +0000 (+0000) Subject: move maxloc to isacaller directory X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=97b5b366728d65d1b7b48f9767cebf4dda96d912;p=openpower-isa.git move maxloc to isacaller directory --- diff --git a/maxloc/Makefile b/maxloc/Makefile deleted file mode 100644 index 776006b9..00000000 --- a/maxloc/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -maxloc: maxloc.c - gcc maxloc.c -o maxloc - # for ppc64sffs - gcc -Os -mno-vsx -mno-altivec maxloc.c -o maxloc diff --git a/maxloc/maxloc.c b/maxloc/maxloc.c deleted file mode 100644 index f0786e73..00000000 --- a/maxloc/maxloc.c +++ /dev/null @@ -1,36 +0,0 @@ -#include - -int m2(int *a, int n) -{ - int m = 0; - int nm = -1; - int i = 0; - - while (i m) { - printf("%d idx %d > m %d\n", i, a[i], m); - m = a[i]; - nm = i; - i++; - } - } - return nm; -} - -/*Testbench*/ - -int main() -{ - - int arr[]= {5,2,8,1,3,7,9,4}; - int size = sizeof(arr) / sizeof(arr[0]); - int result = m2(arr, size); - - printf("Index of the maximum value in an array is: %d\n", result); - return 0; - -} diff --git a/maxloc/maxloc.py b/maxloc/maxloc.py deleted file mode 100644 index bb260d25..00000000 --- a/maxloc/maxloc.py +++ /dev/null @@ -1,25 +0,0 @@ -def m2(a): - m = 0; - nm = -1; - i = 0; - n = len(a) - - while (i m) : - print("%d idx %d > m %d" % (i, a[i], m)) - m = a[i] - nm = i - i += 1 - return nm; - -# /*Testbench*/ - -if __name__ == '__main__': - arr = [5,2,8,1,3,7,9,4] - print("search list", arr) - result = m2(arr) - - print("Index of the maximum value in an array is: %d" % result) diff --git a/src/openpower/decoder/isa/maxloc/Makefile b/src/openpower/decoder/isa/maxloc/Makefile new file mode 100644 index 00000000..776006b9 --- /dev/null +++ b/src/openpower/decoder/isa/maxloc/Makefile @@ -0,0 +1,3 @@ +maxloc: maxloc.c + gcc maxloc.c -o maxloc + # for ppc64sffs - gcc -Os -mno-vsx -mno-altivec maxloc.c -o maxloc diff --git a/src/openpower/decoder/isa/maxloc/maxloc.c b/src/openpower/decoder/isa/maxloc/maxloc.c new file mode 100644 index 00000000..f0786e73 --- /dev/null +++ b/src/openpower/decoder/isa/maxloc/maxloc.c @@ -0,0 +1,36 @@ +#include + +int m2(int *a, int n) +{ + int m = 0; + int nm = -1; + int i = 0; + + while (i m) { + printf("%d idx %d > m %d\n", i, a[i], m); + m = a[i]; + nm = i; + i++; + } + } + return nm; +} + +/*Testbench*/ + +int main() +{ + + int arr[]= {5,2,8,1,3,7,9,4}; + int size = sizeof(arr) / sizeof(arr[0]); + int result = m2(arr, size); + + printf("Index of the maximum value in an array is: %d\n", result); + return 0; + +} diff --git a/src/openpower/decoder/isa/maxloc/maxloc.py b/src/openpower/decoder/isa/maxloc/maxloc.py new file mode 100644 index 00000000..bb260d25 --- /dev/null +++ b/src/openpower/decoder/isa/maxloc/maxloc.py @@ -0,0 +1,25 @@ +def m2(a): + m = 0; + nm = -1; + i = 0; + n = len(a) + + while (i m) : + print("%d idx %d > m %d" % (i, a[i], m)) + m = a[i] + nm = i + i += 1 + return nm; + +# /*Testbench*/ + +if __name__ == '__main__': + arr = [5,2,8,1,3,7,9,4] + print("search list", arr) + result = m2(arr) + + print("Index of the maximum value in an array is: %d" % result)