These are instructions to demo Cohort using the provided test programs in the Cohort SOC repository on the Genesys 2 FPGA. The two steps are to:
- generate a bitstream with OpenPiton, an Ariane tile, and Cohort tile
- build a Linux payload and preload it with the test program
Note this was tested on Jura.
- Clone the Cohort SOC repo: https://github.com/cohort-project/cohort-soc
git clone git@github.com:cohort-project/cohort-soc.git
cd cohort-soc
git submodule update --init --recursive
- Enter the repo directory and set appropriate environment variables
phere
source /tools/Xilinx/Vivado/2022.1/settings64.sh
phere is set like this in my .bashrc:
alias phere="export PITON_ROOT=\$PWD; source piton/piton_settings.bash; export ARIANE_ROOT=\$PITON_ROOT/piton/design/chip/tile/ariane"
- Generate the bitstream
protosyn -b genesys2 --define DECADES_DECOUPLING -d system -c cohort --y_tiles 2 -j 20 --cohort_tiles 1
The output bitstream will be at
build/genesys2/system/genesys2_system/genesys2_system.runs/impl_1/system.bit
- Copy the bitstream file from your local machine to a USB stick.
Now we will build the Linux Kernel payload and preload the rootfs with the Cohort tests
-
Open
piton/verif/diag/c/riscv/ariane/cohort_linux/Makefile
-
Replace
GCC=riscv64-buildroot-linux-gnu-gcc
with the location of this compiler if it's not in your PATH. -
Make sure
DNO_DRIVER
is not added to GCC_OPTS. -
Make sure
DDRIVER_EVALS=1
is added to GCC_OPTS -
From the same directory as this Makefile,
cohort_linux
, compile the test program
make cohort_benchmarks
- Traverse out of the Cohort SOC directory
- Clone the ariane-sdk: https://github.com/cohort-project/ariane-sdk-private/tree/a-vinod_g2_cohort.
git clone git@github.com:cohort-project/ariane-sdk-private.git
cd ariane-sdk
git checkout a-vinod_g2_cohort
git submodule update --init --recursive
- Create a
cohort
directory in therootfs
directory.
mkdir rootfs/cohort
-
Copy the benchmark binaries from Cohort SOC
verif/diag/c/riscv/ariane/cohort_linux/build
to the Ariane SDKcohort
directory -
Build the Linux payload
make fw_payload.bin
-
Plug in the micoSD to your local machine
-
Find the location of the microSD
sudo fdisk -l
- Partition the disk (substitute
/dev/sda
with the location of your miroSD)
sudo sgdisk --clear --new=1:2048:67583 --new=2 --typecode=1:3000 --typecode=2:8300 /dev/sda
- Copy the payload to a partition on the disk (NOTE: here it is sda1 not sda)
sudo dd if=fw_payload.bin of=/dev/sda1 status=progress oflag=sync bs=1M
- Make sure data is persisted
sync
Now plug in the USB into the top of the two USB ports on the FPGA and insert the microSD card. Switch it on and the Linux kernel will boot!