# 使用WSL建立實驗環境 雖然助教有提供已預先安裝好所有所需軟體的虛擬機映像檔,但虛擬機所需的硬體資源較高,在某些電腦上運作效率不佳,因此我想改用WSL進行實驗。 :::info 由於所安裝的軟體版本與助教所提供的虛擬機映像檔不同,模擬結果不一定完全相同 ::: ## 步驟 1. 安裝WSL及Ubuntu 詳細步驟可以參考(https://learn.microsoft.com/zh-tw/windows/wsl/install) 2. 安裝RISC-V GCC Toolchain :::warning RISC-V ISA spec(20191213) 將CSR指令移到 "Zicsr" extension中,因此若使用新版toolchain,要將'run_sim'檔案中`-march=rv32i`改為`-march=rv32i_zicsr` ::: 2-1. Clone the repo. :::warning Warning: git clone takes around 6.65 GB of disk and download size ::: ```bash= git clone https://github.com/riscv/riscv-gnu-toolchain ``` 2-2. Install some standard packages that are needed to build the toolchain. ```bash= sudo apt-get install autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev ``` 2-3. Add `/opt/riscv/bin` to path ```bash= echo 'export PATH=$PATH:/opt/riscv/bin' >> ~/.bashrc ``` 2-4. Compile and install the toolchain :::warning 這個步驟會花費較長時間 ::: ```bash= ./configure --prefix=/opt/riscv --with-arch=rv32gc --with-abi=ilp32 make ``` 3. 安装iverilog及GTKWave ```bash= sudo apt-get install iverilog sudo apt-get install gtkwave ``` 4. (optional)安裝VS Code及相關extensions [一些好用的東西](/-ozjIMKKRP-Tt3VryaPpjw) :::success :confetti_ball: :confetti_ball: :confetti_ball: ::: ### Reference: - WSL https://learn.microsoft.com/zh-tw/windows/wsl/install - RISC-V GCC Toolchain github repo https://github.com/riscv-collab/riscv-gnu-toolchain - iverilog及GTKWave使用教學 https://zhuanlan.zhihu.com/p/95081329 - [[Caravel_SoC] Error: unrecognized opcode, extension ‘zicsr’ required](/DpddfE5LQcmCvYbBkD0GtQ)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up