Merge remote-tracking branch 'origin/main' into bump-fs

This commit is contained in:
abejgonzalez
2023-04-21 14:24:25 -07:00
16 changed files with 1272 additions and 942 deletions

View File

@@ -103,7 +103,7 @@ dependencies:
- sty
- open_pdks.sky130a
- pip:
- hammer-vlsi[asap7]==1.1.0
- hammer-vlsi[asap7]==1.1.1
# doc requirements
- sphinx

View File

@@ -91,6 +91,7 @@ run_step() {
# Check for this, since many users will be attempting to use this with gemmini
if [ $TOOLCHAIN_TYPE == "esp-tools" ]; then
while true; do
printf '\033[2J'
read -p "WARNING: You are trying to install the esp-tools toolchain."$'\n'"This should ONLY be used for Hwacha development."$'\n'"Gemmini should be used with riscv-tools."$'\n'"Type \"y\" to continue if this is intended, or \"n\" if not: " validate
case "$validate" in
y | Y)

View File

@@ -65,6 +65,7 @@ restore_bash_options
if [ "$git_tag_rc" -ne 0 ]; then
if [ "$FORCE" == false ]; then
while true; do
printf '\033[2J'
read -p "WARNING: You are not on an official release of Chipyard."$'\n'"Type \"y\" to continue if this is intended or \"n\" if not: " validate
case "$validate" in
y | Y)

1
software/tutorial/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
overlay

21
software/tutorial/build.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
set -ex
CYDIR=$(git rev-parse --show-toplevel)
G_DIR=$CYDIR/generators/gemmini/software/gemmini-rocc-tests
O_DIR=$CYDIR/software/tutorial/overlay/root
echo "Building Gemmini RoCC tests"
cd $G_DIR
./build.sh imagenet
cd build
rm -rf $O_DIR
mkdir -p $O_DIR
cp -r imagenet/resnet50-baremetal $O_DIR/
cp -r imagenet/resnet50-linux $O_DIR/
cp -r imagenet/mobilenet-baremetal $O_DIR/
cp -r imagenet/mobilenet-linux $O_DIR/
echo "Complete!"

View File

@@ -0,0 +1,8 @@
{
"name" : "mobilenet-baremetal",
"base" : "bare-base.json",
"workdir" : "..",
"host-init" : "build.sh",
"bin" : "overlay/root/mobilenet-baremetal",
"spike-args" : "--extension=gemmini"
}

View File

@@ -0,0 +1,8 @@
{
"name" : "resnet50-baremetal",
"base" : "bare-base.json",
"workdir" : "..",
"host-init" : "build.sh",
"bin" : "overlay/root/resnet50-baremetal",
"spike-args" : "--extension=gemmini"
}

View File

@@ -0,0 +1,8 @@
{
"name" : "resnet50-linux-interactive",
"base" : "br-base.json",
"workdir" : "..",
"host-init" : "build.sh",
"overlay" : "overlay",
"spike-args" : "--extension=gemmini"
}

View File

@@ -0,0 +1,9 @@
{
"name" : "resnet50-linux",
"base" : "br-base.json",
"workdir" : "..",
"host-init" : "build.sh",
"overlay" : "overlay",
"command" : "/root/resnet50-linux",
"spike-args" : "--extension=gemmini"
}

View File

@@ -29,7 +29,7 @@ include libgloss.mk
PROGRAMS = pwm blkdev accum charcount nic-loopback big-blkdev pingd \
streaming-passthrough streaming-fir nvdla spiflashread spiflashwrite fft gcd \
hello
hello mt-hello
.DEFAULT_GOAL := default

1
tests/encoding.h Symbolic link
View File

@@ -0,0 +1 @@
../toolchains/riscv-tools/riscv-tests/env/encoding.h

View File

@@ -1,6 +1,10 @@
#include <stdio.h>
#include "encoding.h"
#include "marchid.h"
int main(void) {
printf("Hello world\n");
uint64_t marchid = read_csr(marchid);
const char* march = get_march(marchid);
printf("Hello world from core 0, a %s\n", march);
return 0;
}

17
tests/marchid.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef MARCHID_H
#define MARCHID_H
const char* get_march(size_t marchid) {
switch (marchid) {
case 1:
return "rocket";
case 2:
return "sonicboom";
case 5:
return "spike";
default:
return "unknown";
}
}
#endif

48
tests/mt-hello.c Normal file
View File

@@ -0,0 +1,48 @@
#include "encoding.h"
#include <stdio.h>
#include "marchid.h"
// EDIT THIS
static size_t n_cores = 4;
static void __attribute__((noinline)) barrier()
{
static volatile int sense;
static volatile int count;
static __thread int threadsense;
__sync_synchronize();
threadsense = !threadsense;
if (__sync_fetch_and_add(&count, 1) == n_cores-1)
{
count = 0;
sense = threadsense;
}
else while(sense != threadsense)
;
__sync_synchronize();
}
void __main(void) {
size_t mhartid = read_csr(mhartid);
if (mhartid >= n_cores) while (1);
const char* march = get_march(read_csr(marchid));
for (size_t i = 0; i < n_cores; i++) {
if (mhartid == i) {
printf("Hello world from core %lu, a %s\n", mhartid, march);
}
barrier();
}
// Spin if not core 0
if (mhartid > 0) while (1);
}
int main(void) {
__main();
return 0;
}