riscv-mini实验环境搭建
apt update
apt install curl wget apt-transport-https -y
# Java的安装,选择temurin-17-jdk
wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://mirrors.tuna.tsinghua.edu.cn/Adoptium/deb jammy main" >> /etc/apt/sources.list.d/adoptium.list
apt-get update
apt-get install temurin-17-jdk -y
# 安装sbt
curl -s -L https://github.com/sbt/sbt/releases/download/v1.9.7/sbt-1.9.7.tgz | tar xvz
mv sbt/bin/sbt /usr/local/bin/
curl -fL https://github.com/Virtuslab/scala-cli/releases/latest/download/scala-cli-x86_64-pc-linux.gz | gzip -d > scala-cli
chmod +x scala-cli
mv scala-cli /usr/local/bin/scala-cli
# 安装verilator
apt-get install autoconf g++ flex bison help2man make python3 git -y
git clone https://github.com/verilator/verilator.git
unset VERILATOR_ROOT
cd verilator
git checkout stable
autoconf
./configure
make
make install
# 安装firtool
curl -o - -L https://github.com/llvm/circt/releases/download/firtool-1.40.0/firrtl-bin-ubuntu-20.04.tar.gz | tar zxf - \
mv firtool-1.40.0/bin/firtool /usr/local/bin/
编译riscv-mini出现的问题
cd /
git clone https://github.com/ucb-bar/riscv-mini.git
cd /riscv-mini
make
make verilator
make run-tests
- 执行
make verilator
, 提示c++<14 - 修改Makefile, 令std=c++14,再执行make verilator
dockerfile
FROM ubuntu
# install Java
RUN apt update \
&& apt-get install wget curl apt-transport-https -y \
&& wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc \
&& echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://mirrors.tuna.tsinghua.edu.cn/Adoptium/deb jammy main" >> /etc/apt/sources.list.d/adoptium.list \
&& apt-get update \
&& apt-get install temurin-17-jdk -y
# install sbt and scala-cli
RUN apt update \
&& curl -s -L https://github.com/sbt/sbt/releases/download/v1.9.7/sbt-1.9.7.tgz | tar xvz \
&& mv sbt/bin/sbt /usr/local/bin/ \
&& curl -fL https://github.com/Virtuslab/scala-cli/releases/latest/download/scala-cli-x86_64-pc-linux.gz | gzip -d > scala-cli \
&& chmod +x scala-cli \
&& mv scala-cli /usr/local/bin/scala-cli
# install verilator
RUN apt update\
&& apt-get install autoconf g++ flex bison help2man make python3 git -y \
&& git clone https://github.com/verilator/verilator.git \
&& git clone https://github.com/ucb-bar/riscv-mini.git \
&& unset VERILATOR_ROOT \
&& cd verilator \
&& git checkout stable \
&& autoconf \
&& ./configure \
&& make \
&& make install \
&& cd /riscv-mini \
&& curl -o - -L https://github.com/llvm/circt/releases/download/firtool-1.40.0/firrtl-bin-ubuntu-20.04.tar.gz | tar zxf - \
&& mv firtool-1.40.0/bin/firtool /usr/local/bin/ \
&& echo 'check if std=c++14 in Makefile, then run: make, make verilator, make run-tests' >> readme.txt
也可以直接从Dockerhub拉取
docker pull werewebro/rcore-init:v1