Limerick(3) - SpinalHDL Tutorial: Setting up the Development Environment
Hello, everyone. Welcome to the third episode of FPGA limerick. In this episode, we will get hands-on for SpinalHDL, starting by setting up the Development Environment.
Setup for Windows/MSYS2
As mentioned in the first episode, we will use Windows 11 + MSYS2 + WSL2 as our host platform. And we will start by MSYS2 first. To install MSYS2, please open your browser and go to https://www.msys2.org/
And at this point, we will install the following version for MSYS2:
https://github.com/msys2/msys2-installer/releases/download/2023-01-27/msys2-x86_64-20230127.exe
After the MSYS2 is installed, it needs to be setup for additional packages. Please open the MSYS2 MINGW64 from Windows Start Menu, and type in the following:
pacman -Syuu
After this command, the MSYS2 window will be closed automatically.
Please reopen it through Windows Start Menu (Please choose MSYS2
MINGW64 again), and type in
pacman -Syuu
again. Then please type in the following:
One thing I want to mention is that you will find similar
steps on SpinalHDL’s official website. But it seems those steps on the official
website is not up-to-date. So please follow the steps listed above exactly. This is especially true for the last step above when you try
to install verilator.
Ok. Now after the last step to install verilator, you can close the MSYS2 window, and the put the following two paths in the system path:
(From the start menu, you can choose settings / system / about
/ advanced system settings, then choose environment variables
Double-click the path in system variables, click new and copy paste those two paths. Please make sure those two paths are at the top of the list.)
Setup for Windows/SBT
Now, at this point, we are done with the MSYS2. And next we will install the SBT. Please open
your browser and go to https://www.scala-sbt.org/
And currently we are using SBT 1.8.2 for Windows, which can
be directly downloaded from the following path:
https://github.com/sbt/sbt/
Just run the installer, click “More info” and then click “Run anyway”.
Setup for Windows/JDK
After the SBT is installed, the next is to install JDK. The JDK
can be downloaded from the following path:
https://www.oracle.com/java/
For Windows, we currently use JDK19, which can be downloaded directly from
https://download.oracle.com/
And after installation of the JDK, please add the following path to the system path (like what we did early for MSYS2):
C:\Program Files\Java\jdk-19\bin
Test with Hello World example
Now, at this point, we should be able to run the SBT in
command line and compile the SpinalHDL source code. For this purpose, we have
got a HelloWorld example in the GitHub repo.
Please open a command prompt and use the following command to
check out the GitHub repo for FPGA Limerick
git clone --depth 1 --branch v1.0.0 https://github.com/PulseRain/FpgaLimerick.git
cd FpgaLimerick
cd HelloWorld
sbt
If everything is setup correctly, it will show something
like:
[1] com.pulserain.fpga.NcoCounter
Choose option 2 to run the simulation in verilator. And you are supposed to see the following output:
If you see this, congratulation! You have setup the SBT and
Verilator correctly on Windows!
Setup for Linux
We will talk about the Linux setup in later episodes when we get to the cocotb. However, if you are really itchy to try it out on Linux, you can start by the following:
Use WSL (Windows Subsystem for Linux), set up the distro as:
wsl --install -d Ubuntu-20.04
In other words, please use Ubuntu 20.04 LTS.
And please run the setup script in FpgaLimerick/HelloWorld/script/wsl_setup.sh to install the necessary packages, including verialtor and questa.
Although this script has only been verified on WSL, I believe it can also be applied on the native version of Ubuntu 20.04 LTS.
pacman -U https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-verilator-4.228-1-any.pkg.tar.zst
ReplyDeletethis link does not work, it returns 404
updated verilator link: https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-verilator-5.004-1-any.pkg.tar.zst
ReplyDelete