Browse Source
To avoid long CI times, keep the program in binary form. To avoid storing binary files in this repository, store the binaries as an asset on a github release.pull/1096/head
3 changed files with 51 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||
#!/bin/bash |
|||
set -e |
|||
|
|||
rm -rf build |
|||
|
|||
mkdir -p build/pk && cd "$_" |
|||
`git rev-parse --show-toplevel`/../riscv-pk/configure --host=riscv64-unknown-elf |
|||
make -j4 |
|||
cd - |
|||
|
|||
mkdir -p build/hello && cd "$_" |
|||
riscv64-unknown-elf-gcc -O2 -o hello `git rev-parse --show-toplevel`/ci-tests/hello.c |
|||
cd - |
|||
|
|||
mv build/pk/pk . |
|||
mv build/hello/hello . |
|||
|
|||
tar -cf spike-ci.tar pk hello |
|||
|
|||
rm pk hello |
|||
@ -0,0 +1,23 @@ |
|||
#include <stdio.h> |
|||
|
|||
int main() |
|||
{ |
|||
// As a simple benchmark, estimate pi
|
|||
int n = 16384, misses = 0; |
|||
|
|||
for (int i = 0; i < n; i++) { |
|||
|
|||
for (int j = 0; j < n; j++) { |
|||
int x = i - (n / 2); |
|||
int y = j - (n / 2); |
|||
|
|||
misses += (x * x + y * y >= (n / 2) * (n / 2)); |
|||
} |
|||
} |
|||
|
|||
double pi = 4.0 * (n * n - misses) / (n * n); |
|||
|
|||
printf("Hello, world! Pi is approximately %f.\n", pi); |
|||
|
|||
return 0; |
|||
} |
|||
Loading…
Reference in new issue