Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolu1990 committed Dec 26, 2024
2 parents 0077b57 + 823054e commit de03870
Show file tree
Hide file tree
Showing 16 changed files with 313 additions and 1,221 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ regression/
tmp/
/archive.tar.gz
*.out32

vnc_done
docker_xfce4.lop
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,24 @@ Here is the online documentation :
A roadmap is available here :

- https://github.com/SpinalHDL/VexiiRiscv/issues/1

# TL;DR Getting started

The quickest way for getting started is to pull the Docker image with all the dependencies installed

Please refer to the self contained tutorial for a comprehensive step by step instruction manual with
screenshots: https://spinalhdl.github.io/VexiiRiscv-RTD/master/VexiiRiscv/Tutorial/index.html

After running the generation you'll find a file named "VexiiRiscv.v" in the root
of the repository folder, which you can drag into your Quartus or whatever.

We decided to not start covering FPGA boards because there's just too many, so it's up to you
to define your pin configuration for your specific FPGA board

If you want to know what else you can do with sbt, please refer to the complete documentation.

# Rebuild the Docker container

In case you wanna rebuild leviathan's Docker container you can run

docker build . -f docker/Dockerfile -t vexiiriscv --progress=plain
97 changes: 97 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
FROM leviathanch/riscv-toolchain as build

COPY docker/sbt.asc /root/sbt.asc

RUN apt-get update
RUN apt install -y software-properties-common
RUN add-apt-repository -y ppa:openjdk-r/ppa
RUN apt-get update

# Add SBT repo
RUN echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list
RUN echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list

RUN apt-key add /root/sbt.asc
RUN apt-get update
RUN apt-get install -y \
openjdk-21-jdk \
sbt \
gtkwave \
nodejs \
npm \
libgtk-3-0 \
libxss1 \
libnss3 \
libx11-xcb1 \
libcanberra-gtk3-module \
xvfb \
x11vnc \
xfce4 \
git \
make \
autoconf \
g++ \
flex \
bison \
help2man \
device-tree-compiler \
libboost-all-dev \
dbus-x11 \
sudo \
wget \
gosu

WORKDIR /root
RUN git clone https://github.com/verilator/verilator.git
WORKDIR verilator
RUN autoconf
RUN ./configure
RUN make -j2
RUN make install
WORKDIR /root
RUN rm -rf verilator

WORKDIR /root
RUN git clone https://github.com/serge1/ELFIO.git
WORKDIR ELFIO
RUN git checkout d251da09a07dff40af0b63b8f6c8ae71d2d1938d
RUN mkdir -p /usr/include && cp -r elfio /usr/include/elfio
RUN chown ubuntu -R /usr/include/elfio && chmod 0777 -R /usr/include/elfio
WORKDIR /root
RUN rm -rf ELFIO

WORKDIR /root
RUN rm /root/sbt.asc
ENV DISPLAY=:1

COPY docker/fix_fesvr.patch /home/ubuntu/fix_fesvr.patch
RUN chown ubuntu /home/ubuntu/fix_fesvr.patch
COPY docker/setup_userspace.sh /home/ubuntu/setup_userspace.sh
COPY docker/fix_userid.sh /root/fix_userid.sh
COPY docker/init_graphics.sh /home/ubuntu/init_graphics.sh
COPY docker/Konata.desktop /usr/share/applications/Konata.desktop

COPY docker/setup_intellij.sh /root/setup_intellij.sh

RUN chmod 0777 /home/ubuntu/setup_userspace.sh \
/root/fix_userid.sh \
/home/ubuntu/init_graphics.sh

RUN gosu ubuntu /home/ubuntu/setup_userspace.sh
RUN cd /home/ubuntu/VexiiRiscv/ext/riscv-isa-sim/build && make install

WORKDIR /root
RUN bash /root/setup_intellij.sh
RUN rm /root/setup_intellij.sh
RUN mkdir -p /home/ubuntu/Desktop
RUN ln -s /usr/share/applications/IDEA.desktop /home/ubuntu/Desktop/IDEA.desktop
RUN ln -s /usr/share/applications/Konata.desktop /home/ubuntu/Desktop/Konata.desktop

COPY docker/generate_verilog.sh /home/ubuntu/
COPY docker/run_simulation.sh /home/ubuntu/

RUN chown ubuntu /home/ubuntu/*.sh
RUN chmod 0777 /home/ubuntu/*.sh

WORKDIR /work
ENTRYPOINT /root/fix_userid.sh && gosu ubuntu /home/ubuntu/init_graphics.sh
11 changes: 11 additions & 0 deletions docker/Konata.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Konata
Comment=The Viewer
Exec=/bin/bash -c "cd /home/ubuntu/konata && make"
Icon=
Path=/work
Terminal=false
StartupNotify=false
GenericName=Konata Viewer
12 changes: 12 additions & 0 deletions docker/fix_fesvr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/fesvr/device.h b/fesvr/device.h
index 1387b745..639b8374 100644
--- a/fesvr/device.h
+++ b/fesvr/device.h
@@ -6,6 +6,7 @@
#include <cstring>
#include <string>
#include <functional>
+#include <cstdint>

class memif_t;

12 changes: 12 additions & 0 deletions docker/fix_userid.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
nuid=$(stat -c "%u" /work)
ouid=$(id -u ubuntu)

if [ "$nuid" -ne "$ouid" ]; then
echo "Adjusting user access rights... please wait"
usermod -u $nuid ubuntu
chown ubuntu -R /home/ubuntu
fi

chown root /home/ubuntu/konata/node_modules/electron/dist/chrome-sandbox
chmod 4755 /home/ubuntu/konata/node_modules/electron/dist/chrome-sandbox
2 changes: 2 additions & 0 deletions docker/generate_verilog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
sbt "Test/runMain vexiiriscv.Generate"
9 changes: 9 additions & 0 deletions docker/init_graphics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
Xvfb :1 -screen 0 1024x768x16 &> /work/xvfb.log &
until pids=$(pidof Xvfb)
do
sleep 1
done
x11vnc -display :1 -bg -forever -nopw -quiet -xkb
touch /work/vnc_done
startxfce4 &> /work/docker_xfce4.lop
2 changes: 2 additions & 0 deletions docker/run_simulation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
sbt "Test/runMain vexiiriscv.tester.TestBench --with-mul --with-div --load-elf ext/NaxSoftware/baremetal/dhrystone/build/rv32ima/dhrystone.elf --trace-all"
53 changes: 53 additions & 0 deletions docker/sbt.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: Hostname:
Version: Hockeypuck 2.2

xsFNBFVo8ucBEADTNUhKCz/6031bXPy1EOMk3qmsRp1ZIbLNN+KGFEE02qt3/4Hd
B2QtrHu1XK/ZZfD84d/RywMj/A14ESBxqaPa4uStOBUeU38+gV05b4Y/jvJ1x4wD
kCH+FTz0HlrLpwq/UQEWTX1vTH9wLQQXDcgngs45fVdGe5RDNtvnsd1pP4rp4ZTE
jqIJl2fRLd9Jd1uNGv1s9QaLKOVHkprzhphVWil16ET5wIdwivPdi7PFFJv94gXP
gbduYZiAYUdywkXHPS18s/6qWMgKcg718rn0orC6oA+zgbUzEJYHqI2OV7HFTzMw
/m+tfifWf7dgroOMFtQi5BRzMMoeVOtDXNsOTD9gv5WhzrfyfyLUgnb+nAyH1jHH
DZ6f0LdYsD6W9aSEkW0DnmlTKMGUVwRltEgmFCD45VWm/ghwwyVmQ7oyspA6h6r7
3ha5PiymCbkYoUFUMxXHhfRPDS/9JL/40+rgiyHEuKlKniIhcbT29oBDXHLfw0fu
QSIGEJ3j+T9mguDOmjnZg6BpVkmrXZtxscWJsDeWPCqz42Htx8mrFB/CRu4XKgiZ
zpVAbicwEAWZAFS08kwsixHkbuaOMIrj/Kxz4jODdyV2n+I2rZz01FSOBLtidJ00
7fUbnzxKzXiGAqw0BMyWSVyB/sA36gLs5RRG5ily0uPQAu2RSvatS+EzfwARAQAB
zSNzYnQgYnVpbGQgdG9vbCA8c2NhbGFzYnRAZ21haWwuY29tPsLBeAQTAQIAIgUC
VWjy5wIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQmegqd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bggEB9kjIsnsrl8I
Tgs=
=A2KV
-----END PGP PUBLIC KEY BLOCK-----
46 changes: 46 additions & 0 deletions docker/setup_intellij.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

echo "Installing IntelliJ IDEA..."

# We need root to install
[ $(id -u) != "0" ] && exec sudo "$0" "$@"

# define version (ultimate. change to 'C' for Community)
ed='C'

# Fetch the most recent community edition URL
VERSION=$(wget "https://www.jetbrains.com/intellij-repository/releases" -qO- | grep -P -o -m 1 "(?<=https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/idea/BUILD/)[^/]+(?=/)")
URL="https://download.jetbrains.com/idea/ideaI$ed-$VERSION.tar.gz"

echo "URL: ${URL}"
echo "basename(url): $(basename ${URL})"

# Truncate filename
FILE=$(basename ${URL})

echo "File: ${FILE}"

# Download binary
wget -cO /tmp/${FILE} ${URL} --read-timeout=5 --tries=0

# Set directory name
DIR="${FILE%\.tar\.gz}"

# Untar file
mkdir -p /opt/${DIR}
tar -xvzf /tmp/${FILE} -C /opt/${DIR} --strip-components=1

# Grab executable folder
BIN="/opt/$DIR/bin"

# Add permissions to install directory
chmod 755 ${BIN}/idea.sh

# Set desktop shortcut path
DESK=/usr/share/applications/IDEA.desktop

# Add desktop shortcut
echo -e "[Desktop Entry]\nEncoding=UTF-8\nName=IntelliJ IDEA\nComment=IntelliJ IDEA\nExec=${BIN}/idea.sh\nIcon=${BIN}/idea.png\nTerminal=false\nStartupNotify=true\nType=Application" > ${DESK}
chmod 644 ${DESK}

echo "Done."
29 changes: 29 additions & 0 deletions docker/setup_userspace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

cd /home/ubuntu

git clone --recursive https://github.com/SpinalHDL/VexiiRiscv.git

pushd VexiiRiscv/ext/riscv-isa-sim/fesvr
echo "Patching fesvr"
git apply /home/ubuntu/fix_fesvr.patch
popd

mkdir VexiiRiscv/ext/riscv-isa-sim/build
pushd VexiiRiscv/ext/riscv-isa-sim/build
../configure --prefix=/opt/riscv --enable-commitlog --without-boost --without-boost-asio --without-boost-regex
make
popd

pushd VexiiRiscv/ext/rvls
make
popd

pushd VexiiRiscv
sbt update
popd

git clone https://github.com/shioyadan/konata.git
pushd konata
npm install
popd
Loading

0 comments on commit de03870

Please sign in to comment.